1 /* { dg-do compile } */ 2 /* { dg-options "-O2 -ftree-vectorize" } */ 3 4 #include <stdint.h> 5 6 #define DEF_LOOP(TYPE, NAME, CONST) \ 7 void __attribute__ ((noipa)) \ 8 test_##TYPE##_##NAME (TYPE *__restrict x, \ 9 TYPE *__restrict y, \ 10 TYPE *__restrict z, \ 11 int n) \ 12 { \ 13 for (int i = 0; i < n; ++i) \ 14 x[i] = y[i] < 8 ? z[i] + (TYPE) CONST : y[i]; \ 15 } 16 17 #define TEST_TYPE(T, TYPE) \ 18 T (TYPE, half, 0.5) \ 19 T (TYPE, one, 1.0) \ 20 T (TYPE, two, 2.0) \ 21 T (TYPE, minus_half, -0.5) \ 22 T (TYPE, minus_one, -1.0) \ 23 T (TYPE, minus_two, -2.0) 24 25 #define TEST_ALL(T) \ 26 TEST_TYPE (T, float) \ 27 TEST_TYPE (T, double) 28 29 TEST_ALL (DEF_LOOP) 30 31 /* { dg-final { scan-assembler-times {\tfadd\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, #0\.5\n} 1 } } */ 32 /* { dg-final { scan-assembler-times {\tfadd\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, #0\.5\n} 1 } } */ 33 34 /* { dg-final { scan-assembler-times {\tfadd\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, #1\.0\n} 1 } } */ 35 /* { dg-final { scan-assembler-times {\tfadd\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, #1\.0\n} 1 } } */ 36 37 /* { dg-final { scan-assembler-times {\tfsub\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, #0\.5\n} 1 } } */ 38 /* { dg-final { scan-assembler-times {\tfsub\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, #0\.5\n} 1 } } */ 39 40 /* { dg-final { scan-assembler-times {\tfsub\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, #1\.0\n} 1 } } */ 41 /* { dg-final { scan-assembler-times {\tfsub\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, #1\.0\n} 1 } } */ 42 43 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #2\.0} 1 } } */ 44 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #2\.0} 1 } } */ 45 46 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #-2\.0} 1 } } */ 47 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #-2\.0} 1 } } */ 48 49 /* { dg-final { scan-assembler-times {\tfadd\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 2 } } */ 50 /* { dg-final { scan-assembler-times {\tfadd\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */ 51 52 /* { dg-final { scan-assembler-times {\tmovprfx\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s\n} 6 } } */ 53 /* { dg-final { scan-assembler-times {\tmovprfx\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d\n} 6 } } */ 54 55 /* { dg-final { scan-assembler-not {\tmov\tz} } } */ 56 /* { dg-final { scan-assembler-not {\tsel\t} } } */ 57