Debian Codegraph @

gcc/testsuite/gcc.target/gcn/cond_fmaxnm_2.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize -ffast-math -dp" } */
3 /* The 'scan-assembler' directives are specific to 64-lane vectors.
4 { dg-additional-options --param=gcn-preferred-vectorization-factor=64 } */
5
6 #include <stdint.h>
7
8 #ifndef FN
9 #define FN(X) __builtin_fmax##X
10 #endif
11
12 #define DEF_LOOP(FN, TYPE, NAME, CONST) \
13 void __attribute__ ((noipa)) \
14 test_##TYPE##_##NAME (TYPE *__restrict x, TYPE *__restrict y, \
15 TYPE *__restrict z, 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 {smaxv64sf3_exec} 3 } } */
33 /* { dg-final { scan-assembler-times {smaxv64df3_exec} 3 } } */
34
35 /* { dg-final { scan-assembler-not {\tv_writelane_b32\tv[0-9]+, vcc_..} } } */