1 /* Helper methods for builtin intrinsic tests */
5 #if defined(__cplusplus) && (__cplusplus >= 201103L)
7 constexpr bool match_m64(__m64 _v
, unsigned long long a
) {
12 constexpr bool match_v1di(__m64 v
, long long a
) {
16 constexpr bool match_v2si(__m64 _v
, int a
, int b
) {
17 __v2si v
= (__v2si
)_v
;
18 return v
[0] == a
&& v
[1] == b
;
21 constexpr bool match_v4hi(__m64 _v
, short a
, short b
, short c
, short d
) {
22 __v4hi v
= (__v4hi
)_v
;
23 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
;
26 constexpr bool match_v8qi(__m64 _v
, char a
, char b
, char c
, char d
, char e
, char f
, char g
, char h
) {
27 __v8qi v
= (__v8qi
)_v
;
28 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
&& v
[4] == e
&& v
[5] == f
&& v
[6] == g
&& v
[7] == h
;
31 constexpr bool match_m128(__m128 v
, float a
, float b
, float c
, float d
) {
32 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
;
35 constexpr bool match_m128d(__m128d v
, double a
, double b
) {
36 return v
[0] == a
&& v
[1] == b
;
39 constexpr bool match_m128i(__m128i _v
, unsigned long long a
, unsigned long long b
) {
40 __v2du v
= (__v2du
)_v
;
41 return v
[0] == a
&& v
[1] == b
;
44 constexpr bool match_v2di(__m128i v
, long long a
, long long b
) {
45 return v
[0] == a
&& v
[1] == b
;
48 constexpr bool match_v4si(__m128i _v
, int a
, int b
, int c
, int d
) {
49 __v4si v
= (__v4si
)_v
;
50 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
;
53 constexpr bool match_v8hi(__m128i _v
, short a
, short b
, short c
, short d
, short e
, short f
, short g
, short h
) {
54 __v8hi v
= (__v8hi
)_v
;
55 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
&& v
[4] == e
&& v
[5] == f
&& v
[6] == g
&& v
[7] == h
;
58 constexpr bool match_v16qi(__m128i _v
, char a
, char b
, char c
, char d
, char e
, char f
, char g
, char h
, char i
, char j
, char k
, char l
, char m
, char n
, char o
, char p
) {
59 __v16qi v
= (__v16qi
)_v
;
60 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
&& v
[4] == e
&& v
[5] == f
&& v
[6] == g
&& v
[7] == h
&& v
[8] == i
&& v
[9] == j
&& v
[10] == k
&& v
[11] == l
&& v
[12] == m
&& v
[13] == n
&& v
[14] == o
&& v
[15] == p
;
63 constexpr bool match_m256(__m256 v
, float a
, float b
, float c
, float d
, float e
, float f
, float g
, float h
) {
64 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
&& v
[4] == e
&& v
[5] == f
&& v
[6] == g
&& v
[7] == h
;
67 constexpr bool match_m256d(__m256d v
, double a
, double b
, double c
, double d
) {
68 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
;
71 constexpr bool match_m256i(__m256i _v
, unsigned long long a
, unsigned long long b
, unsigned long long c
, unsigned long long d
) {
72 __v4du v
= (__v4du
)_v
;
73 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
;
76 constexpr bool match_m512(__m512 v
, float a
, float b
, float c
, float d
, float e
, float f
, float g
, float h
, float i
, float j
, float k
, float l
, float m
, float n
, float o
, float p
) {
77 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
&& v
[4] == e
&& v
[5] == f
&& v
[6] == g
&& v
[7] == h
&& v
[8] == i
&& v
[9] == j
&& v
[10] == k
&& v
[11] == l
&& v
[12] == m
&& v
[13] == n
&& v
[14] == o
&& v
[15] == p
;
80 constexpr bool match_m512d(__m512d v
, double a
, double b
, double c
, double d
, double e
, double f
, double g
, double h
) {
81 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
&& v
[4] == e
&& v
[5] == f
&& v
[6] == g
&& v
[7] == h
;
84 constexpr bool match_m512i(__m512i _v
, unsigned long long a
, unsigned long long b
, unsigned long long c
, unsigned long long d
, unsigned long long e
, unsigned long long f
, unsigned long long g
, unsigned long long h
) {
85 __v8du v
= (__v8du
)_v
;
86 return v
[0] == a
&& v
[1] == b
&& v
[2] == c
&& v
[3] == d
&& v
[4] == e
&& v
[5] == f
&& v
[6] == g
&& v
[7] == h
;
89 #define TEST_CONSTEXPR(...) static_assert(__VA_ARGS__)
93 #define TEST_CONSTEXPR(...)