2 /* { dg-options "-O2 -mavx512f -std=c99" } */
3 /* { dg-require-effective-target avx512f } */
4 /* { dg-require-effective-target c99_runtime } */
8 #include "avx512f-helper.h"
11 #define SIZE (AVX512F_LEN / 32)
12 #include "avx512f-mask-type.h"
19 #if AVX512F_LEN == 512
20 #define SUF(fun) _mm512##fun
23 #define GEN_CMP(type) \
25 dst3 = _mm512_cmp##type##_ps_mask(source1.x, source2.x);\
26 dst4 = _mm512_mask_cmp##type##_ps_mask(mask, source1.x, source2.x);\
27 if (dst3 != dst1) abort(); \
28 if (dst4 != dst2) abort(); \
31 #define CHECK_CMP(imm) \
32 if (imm == _CMP_EQ_OQ) GEN_CMP(eq) \
33 if (imm == _CMP_LT_OS) GEN_CMP(lt) \
34 if (imm == _CMP_LE_OS) GEN_CMP(le) \
35 if (imm == _CMP_UNORD_Q) GEN_CMP(unord) \
36 if (imm == _CMP_NEQ_UQ) GEN_CMP(neq) \
37 if (imm == _CMP_NLT_US) GEN_CMP(nlt) \
38 if (imm == _CMP_NLE_US) GEN_CMP(nle) \
39 if (imm == _CMP_ORD_Q) GEN_CMP(ord)
43 #if AVX512F_LEN == 256
44 #define SUF(fun) _mm256##fun
47 #define CHECK_CMP(imm)
50 #if AVX512F_LEN == 128
51 #define SUF(fun) _mm##fun
54 #define CHECK_CMP(imm)
58 #define CMP(imm, rel) \
60 for (i = 0; i < SSIZE; i++) \
62 dst_ref = (((int) rel) << i) | dst_ref; \
64 source1.x = SUF(_loadu_ps)(s1); \
65 source2.x = SUF(_loadu_ps)(s2); \
66 dst1 = SUF(_cmp_ps_mask)(source1.x, source2.x, imm);\
67 dst2 = SUF(_mask_cmp_ps_mask)(mask, source1.x, source2.x, imm);\
68 if (dst_ref != dst1) abort(); \
69 if ((dst_ref & mask) != dst2) abort(); \
75 UNION_TYPE (AVX512F_LEN
,) source1
, source2
;
76 MASK_TYPE dst1
, dst2
, dst3
, dst4
, dst_ref
;
77 MASK_TYPE mask
= MASK_VALUE
;
79 float s1
[16] = {2134.3343, 6678.346, 453.345635, 54646.464,
80 231.23311, 5674.455, 111.111111, 23241.152,
81 123.14811, 1245.124, 244.151353, 53454.141,
82 926.16717, 3733.261, 643.161644, 23514.633};
83 float s2
[16] = {41124.234, 6678.346, 8653.65635, 856.43576,
84 231.23311, 4646.123, 111.111111, 124.12455,
85 123.14811, 1245.124, 244.151353, 53454.141,
86 2134.3343, 6678.346, 453.345635, 54646.464};
88 CMP(_CMP_EQ_OQ
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] == s2
[i
]);
89 CMP(_CMP_LT_OS
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] < s2
[i
]);
90 CMP(_CMP_LE_OS
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] <= s2
[i
]);
91 CMP(_CMP_UNORD_Q
, isunordered(s1
[i
], s2
[i
]));
92 CMP(_CMP_NEQ_UQ
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] != s2
[i
]);
93 CMP(_CMP_NLT_US
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] >= s2
[i
]);
94 CMP(_CMP_NLE_US
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] > s2
[i
]);
95 CMP(_CMP_ORD_Q
, !isunordered(s1
[i
], s2
[i
]));
97 CMP(_CMP_EQ_UQ
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] == s2
[i
]);
98 CMP(_CMP_NGE_US
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] < s2
[i
]);
99 CMP(_CMP_NGT_US
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] <= s2
[i
]);
101 CMP(_CMP_FALSE_OQ
, 0);
102 CMP(_CMP_NEQ_OQ
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] != s2
[i
]);
103 CMP(_CMP_GE_OS
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] >= s2
[i
]);
104 CMP(_CMP_GT_OS
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] > s2
[i
]);
105 CMP(_CMP_TRUE_UQ
, 1);
107 CMP(_CMP_EQ_OS
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] == s2
[i
]);
108 CMP(_CMP_LT_OQ
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] < s2
[i
]);
109 CMP(_CMP_LE_OQ
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] <= s2
[i
]);
110 CMP(_CMP_UNORD_S
, isunordered(s1
[i
], s2
[i
]));
111 CMP(_CMP_NEQ_US
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] != s2
[i
]);
112 CMP(_CMP_NLT_UQ
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] >= s2
[i
]);
113 CMP(_CMP_NLE_UQ
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] > s2
[i
]);
114 CMP(_CMP_ORD_S
, !isunordered(s1
[i
], s2
[i
]));
115 CMP(_CMP_EQ_US
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] == s2
[i
]);
116 CMP(_CMP_NGE_UQ
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] < s2
[i
]);
117 CMP(_CMP_NGT_UQ
, isunordered(s1
[i
], s2
[i
]) || s1
[i
] <= s2
[i
]);
118 CMP(_CMP_FALSE_OS
, 0);
119 CMP(_CMP_NEQ_OS
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] != s2
[i
]);
120 CMP(_CMP_GE_OQ
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] >= s2
[i
]);
121 CMP(_CMP_GT_OQ
, !isunordered(s1
[i
], s2
[i
]) && s1
[i
] > s2
[i
]);