Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sve/cond_fmaxnm_2.c

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