Debian Codegraph @

gcc/testsuite/gcc.target/gcn/smin_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, int count) \
11 { \
12 for (int i = 0; i < count; ++i) \
13 x[i] = x[i] < y[i] ? x[i] : y[i]; \
14 }
15
16 #define DO_IMMEDIATE_OPS(VALUE, TYPE, NAME) \
17 void __attribute__ ((noclone)) \
18 varithimm_##NAME##_##TYPE (TYPE *__restrict x, int count) \
19 { \
20 for (int i = 0; i < count; ++i) \
21 x[i] = x[i] < (TYPE) VALUE ? x[i] : (TYPE) VALUE; \
22 }
23
24 #define DO_ARITH_OPS(REG, IMM, TYPE) \
25 REG (TYPE); \
26 IMM (0, TYPE, 0); \
27 IMM (86, TYPE, 86); \
28 IMM (109, TYPE, 109); \
29 IMM (141, TYPE, 141); \
30 IMM (92137445376, TYPE, 92137445376); \
31 IMM (-1, TYPE, minus1); \
32 IMM (-110, TYPE, minus110); \
33 IMM (-141, TYPE, minus141); \
34 IMM (-92137445376, TYPE, minus92137445376);
35
36 #define TEST_ALL(REG, IMM) \
37 DO_ARITH_OPS (REG, IMM, int8_t) \
38 DO_ARITH_OPS (REG, IMM, int16_t) \
39 DO_ARITH_OPS (REG, IMM, int32_t) \
40 DO_ARITH_OPS (REG, IMM, int64_t)
41
42 TEST_ALL (DO_REGREG_OPS, DO_IMMEDIATE_OPS)
43
44 /* One per 64-bit test case: */
45 /* { dg-final { scan-assembler-times {vec_cmpv64didi} 10 } } */
46 /* { dg-final { scan-assembler-times {\tv_cmp_lt_i64\tvcc, v[[0-9]+:[0-9]+], v[[0-9]+:[0-9]+]} 10 } } */
47
48 /* Two per test case:*/
49 /* { dg-final { scan-assembler-times {\tv_cmpx_gt_i32\tvcc, s[0-9]+, v[0-9]+} 80 } } */