Debian Codegraph @

gcc/testsuite/gcc.target/gcn/cond_fmaxnm_1.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, PRED_TYPE, NAME, CONST) \
13 void __attribute__ ((noipa)) \
14 test_##TYPE##_##NAME (TYPE *__restrict x, TYPE *__restrict y, \
15 PRED_TYPE *__restrict pred, int n) \
16 { \
17 for (int i = 0; i < n; ++i) \
18 x[i] = pred[i] != 1 ? FN (y[i], CONST) : y[i]; \
19 }
20
21 #define TEST_TYPE(T, FN, TYPE, PRED_TYPE) \
22 T (FN, TYPE, PRED_TYPE, zero, 0) \
23 T (FN, TYPE, PRED_TYPE, one, 1) \
24 T (FN, TYPE, PRED_TYPE, two, 2)
25
26 #define TEST_ALL(T) \
27 TEST_TYPE (T, FN (f32), float, int32_t) \
28 TEST_TYPE (T, FN (f64), double, int64_t)
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_..} } } */