Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_copysign-template.h

raw
1 #include <stdint-gcc.h>
2
3 #define TEST_TYPE(TYPE, SUFFIX) \
4 __attribute__ ((noipa)) void copysign_##TYPE (TYPE *restrict dst, \
5 TYPE *restrict a, \
6 TYPE *restrict b, \
7 int *restrict pred, int n) \
8 { \
9 for (int i = 0; i < n; i++) \
10 dst[i] = pred[i] ? __builtin_copysign##SUFFIX (a[i], b[i]) : dst[i]; \
11 }
12
13 #define TEST_TYPE2(TYPE, SUFFIX) \
14 __attribute__ ((noipa)) void copysigns_##TYPE (TYPE *restrict dst, \
15 TYPE *restrict a, TYPE b, \
16 int *restrict pred, int n) \
17 { \
18 for (int i = 0; i < n; i++) \
19 dst[i] = pred[i] ? __builtin_copysign##SUFFIX (a[i], b) : dst[i]; \
20 }
21
22 #define TEST_TYPE3(TYPE, SUFFIX) \
23 __attribute__ ((noipa)) void xorsign_##TYPE (TYPE *restrict dst, \
24 TYPE *restrict a, \
25 TYPE *restrict b, \
26 int *restrict pred, int n) \
27 { \
28 for (int i = 0; i < n; i++) \
29 dst[i] \
30 = pred[i] ? a[i] * __builtin_copysign##SUFFIX (1.0, b[i]) : dst[i]; \
31 }
32
33 #define TEST_TYPE4(TYPE, SUFFIX) \
34 __attribute__ ((noipa)) void xorsigns_##TYPE (TYPE *restrict dst, \
35 TYPE *restrict a, TYPE b, \
36 int *restrict pred, int n) \
37 { \
38 for (int i = 0; i < n; i++) \
39 dst[i] = pred[i] ? a[i] * __builtin_copysign##SUFFIX (1.0, b) : dst[i]; \
40 }
41
42 #define TEST_TYPE5(TYPE, SUFFIX) \
43 __attribute__ ((noipa)) void ncopysign_##TYPE (TYPE *restrict dst, \
44 TYPE *restrict a, \
45 TYPE *restrict b, \
46 int *restrict pred, int n) \
47 { \
48 for (int i = 0; i < n; i++) \
49 dst[i] = pred[i] ? -__builtin_copysign##SUFFIX (a[i], b[i]) : dst[i]; \
50 }
51
52 #define TEST_TYPE6(TYPE, SUFFIX) \
53 __attribute__ ((noipa)) void ncopysigns_##TYPE (TYPE *restrict dst, \
54 TYPE *restrict a, TYPE b, \
55 int *restrict pred, int n) \
56 { \
57 for (int i = 0; i < n; i++) \
58 dst[i] = pred[i] ? -__builtin_copysign##SUFFIX (a[i], b) : dst[i]; \
59 }
60
61 #define TEST_ALL() \
62 TEST_TYPE (_Float16, f16) \
63 TEST_TYPE (float, f) \
64 TEST_TYPE (double, ) \
65 TEST_TYPE2 (_Float16, f16) \
66 TEST_TYPE2 (float, f) \
67 TEST_TYPE2 (double, ) \
68 TEST_TYPE3 (_Float16, f16) \
69 TEST_TYPE3 (float, f) \
70 TEST_TYPE3 (double, ) \
71 TEST_TYPE4 (_Float16, f16) \
72 TEST_TYPE4 (float, f) \
73 TEST_TYPE4 (double, ) \
74 TEST_TYPE5 (_Float16, f16) \
75 TEST_TYPE5 (float, f) \
76 TEST_TYPE5 (double, ) \
77 TEST_TYPE6 (_Float16, f16) \
78 TEST_TYPE6 (float, f) \
79 TEST_TYPE6 (double, )
80
81 TEST_ALL ()