1 /* { dg-options "-O2 -ftree-vectorize" } */ 2 3 #define TEST_OP(NAME, TYPE, OP) \ 4 void \ 5 NAME##_##TYPE (TYPE *restrict a, TYPE *restrict b, \ 6 TYPE *restrict c, int n) \ 7 { \ 8 for (int i = 0; i < n; ++i) \ 9 a[i] = b[i] OP c[i]; \ 10 } 11 12 #define TEST_TYPE(TYPE) \ 13 TEST_OP (add, TYPE, +) \ 14 TEST_OP (sub, TYPE, -) \ 15 TEST_OP (mult, TYPE, *) \ 16 17 TEST_TYPE (float) 18 TEST_TYPE (double) 19 20 /* { dg-final { scan-assembler-times {\tfadd\t} 2 } } */ 21 /* { dg-final { scan-assembler-times {\tfsub\t} 2 } } */ 22 /* { dg-final { scan-assembler-times {\tfmul\t} 2 } } */ 23 /* { dg-final { scan-assembler-not {\tptrue\t} } } */ 24