Debian Codegraph @

gcc/testsuite/gcc.target/gcn/cond_umax_1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize -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 #define DO_REGREG_OPS(TYPE) \
9 void __attribute__ ((noclone)) \
10 varith_##TYPE##_reg (TYPE *__restrict x, TYPE *__restrict y, \
11 TYPE *__restrict pred, int count) \
12 { \
13 for (int i = 0; i < count; ++i) \
14 x[i] = (pred[i] != 1) ? (x[i] > y[i] ? x[i] : y[i]) : 4; \
15 }
16
17 #define DO_IMMEDIATE_OPS(VALUE, TYPE) \
18 void __attribute__ ((noclone)) \
19 varithimm_##VALUE##_##TYPE (TYPE *__restrict x, TYPE *__restrict pred, \
20 int count) \
21 { \
22 for (int i = 0; i < count; ++i) \
23 x[i] = (pred[i] != 1) ? (x[i] > (TYPE) VALUE ? x[i] : (TYPE) VALUE) : 4; \
24 }
25
26 #define DO_ARITH_OPS(REG, IMM, TYPE) \
27 REG (TYPE); \
28 IMM (2, TYPE); \
29 IMM (86, TYPE); \
30 IMM (109, TYPE); \
31 IMM (141, TYPE); \
32 IMM (229, TYPE); \
33 IMM (255, TYPE); \
34 IMM (992137445376, TYPE);
35
36 #define TEST_ALL(REG, IMM) \
37 DO_ARITH_OPS (REG, IMM, uint8_t) \
38 DO_ARITH_OPS (REG, IMM, uint16_t) \
39 DO_ARITH_OPS (REG, IMM, uint32_t) \
40 DO_ARITH_OPS (REG, IMM, uint64_t)
41
42 TEST_ALL (DO_REGREG_OPS, DO_IMMEDIATE_OPS)
43
44 /* Two per test case < 64 bits with wide-enough type:*/
45 /* { dg-final { scan-assembler-times {umaxv64si3_exec} 20 } } */
46 /* { dg-final { scan-assembler-not {umaxv64si3/0} } } */
47 /* { dg-final { scan-assembler-not {\tv_writelane_b32\tv[0-9]+, vcc_??, 0} } } */
48
49 /* Two per test case with wide-enough type:*/
50 /* { dg-final { scan-assembler-times {\tv_cmp_gt_i32\tvcc, s[0-9]+, v[0-9]+} 56 } } */
51 /* { dg-final { scan-assembler-not {\ts_cmpk_lg_u32\tvcc_lo, 0} } } */
52
53 /* One per 64-bit test case: */
54 /* { dg-final { scan-assembler-times {\tv_cmp_ne_u64\ts\[[0-9]+:[0-9]+\], v\[[0-9]+:[0-9]+\], 1} 8 } } */
55 /* { dg-final { scan-assembler-times {\tv_cmp_gt_u64\tvcc, v[[0-9]+:[0-9]+], v[[0-9]+:[0-9]+]} 8 } } */
56