1 /* { dg-do compile } */
2 /* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mprfchw" } */
6 /* Test that the intrinsics compile without optimization. All of them are
7 defined as inline functions in {,x,e,p,t,s,w,a,b,i}mmintrin.h, mm3dnow.h,
8 fma4intrin.h, xopintrin.h, abmintrin.h, bmiintrin.h, tbmintrin.h,
9 lwpintrin.h, fmaintrin.h and mm_malloc.h that reference the proper
12 Defining away "extern" and "__inline" results in all of them being compiled
13 as proper functions. */
18 #include <x86intrin.h>
20 #define _CONCAT(x,y) x ## y
22 #define test_0(func, type, imm) \
23 type _CONCAT(_,func) (int const I) \
24 { return func (imm); }
26 #define test_1(func, type, op1_type, imm) \
27 type _CONCAT(_,func) (op1_type A, int const I) \
28 { return func (A, imm); }
30 #define test_1x(func, type, op1_type, imm1, imm2) \
31 type _CONCAT(_,func) (op1_type A, int const I, int const L) \
32 { return func (A, imm1, imm2); }
34 #define test_2(func, type, op1_type, op2_type, imm) \
35 type _CONCAT(_,func) (op1_type A, op2_type B, int const I) \
36 { return func (A, B, imm); }
38 #define test_2x(func, type, op1_type, op2_type, imm1, imm2) \
39 type _CONCAT(_,func) (op1_type A, op2_type B, int const I, int const L) \
40 { return func (A, B, imm1, imm2); }
42 #define test_3(func, type, op1_type, op2_type, op3_type, imm) \
43 type _CONCAT(_,func) (op1_type A, op2_type B, \
44 op3_type C, int const I) \
45 { return func (A, B, C, imm); }
47 #define test_4(func, type, op1_type, op2_type, op3_type, op4_type, imm) \
48 type _CONCAT(_,func) (op1_type A, op2_type B, \
49 op3_type C, op4_type D, int const I) \
50 { return func (A, B, C, D, imm); }
53 /* Following intrinsics require immediate arguments. They
54 are defined as macros for non-optimized compilations. */
57 test_1x (_mm_extracti_si64
, __m128i
, __m128i
, 1, 1)
58 test_2x (_mm_inserti_si64
, __m128i
, __m128i
, __m128i
, 1, 1)
61 test_2 (_mm256_blend_pd
, __m256d
, __m256d
, __m256d
, 1)
62 test_2 (_mm256_blend_ps
, __m256
, __m256
, __m256
, 1)
63 test_2 (_mm256_dp_ps
, __m256
, __m256
, __m256
, 1)
64 test_2 (_mm256_shuffle_pd
, __m256d
, __m256d
, __m256d
, 1)
65 test_2 (_mm256_shuffle_ps
, __m256
, __m256
, __m256
, 1)
66 test_2 (_mm_cmp_sd
, __m128d
, __m128d
, __m128d
, 1)
67 test_2 (_mm_cmp_ss
, __m128
, __m128
, __m128
, 1)
68 test_2 (_mm_cmp_pd
, __m128d
, __m128d
, __m128d
, 1)
69 test_2 (_mm_cmp_ps
, __m128
, __m128
, __m128
, 1)
70 test_2 (_mm256_cmp_pd
, __m256d
, __m256d
, __m256d
, 1)
71 test_2 (_mm256_cmp_ps
, __m256
, __m256
, __m256
, 1)
72 test_1 (_mm256_extractf128_pd
, __m128d
, __m256d
, 1)
73 test_1 (_mm256_extractf128_ps
, __m128
, __m256
, 1)
74 test_1 (_mm256_extractf128_si256
, __m128i
, __m256i
, 1)
75 test_1 (_mm256_extract_epi8
, int, __m256i
, 20)
76 test_1 (_mm256_extract_epi16
, int, __m256i
, 13)
77 test_1 (_mm256_extract_epi32
, int, __m256i
, 6)
79 test_1 (_mm256_extract_epi64
, long long, __m256i
, 2)
81 test_1 (_mm_permute_pd
, __m128d
, __m128d
, 1)
82 test_1 (_mm256_permute_pd
, __m256d
, __m256d
, 1)
83 test_1 (_mm_permute_ps
, __m128
, __m128
, 1)
84 test_1 (_mm256_permute_ps
, __m256
, __m256
, 1)
85 test_2 (_mm256_permute2f128_pd
, __m256d
, __m256d
, __m256d
, 1)
86 test_2 (_mm256_permute2f128_ps
, __m256
, __m256
, __m256
, 1)
87 test_2 (_mm256_permute2f128_si256
, __m256i
, __m256i
, __m256i
, 1)
88 test_2 (_mm256_insertf128_pd
, __m256d
, __m256d
, __m128d
, 1)
89 test_2 (_mm256_insertf128_ps
, __m256
, __m256
, __m128
, 1)
90 test_2 (_mm256_insertf128_si256
, __m256i
, __m256i
, __m128i
, 1)
91 test_2 (_mm256_insert_epi8
, __m256i
, __m256i
, int, 30)
92 test_2 (_mm256_insert_epi16
, __m256i
, __m256i
, int, 7)
93 test_2 (_mm256_insert_epi32
, __m256i
, __m256i
, int, 3)
95 test_2 (_mm256_insert_epi64
, __m256i
, __m256i
, long long, 1)
97 test_1 (_mm256_round_pd
, __m256d
, __m256d
, 1)
98 test_1 (_mm256_round_ps
, __m256
, __m256
, 1)
99 test_1 (_cvtss_sh
, unsigned short, float, 1)
100 test_1 (_mm_cvtps_ph
, __m128i
, __m128
, 1)
101 test_1 (_mm256_cvtps_ph
, __m128i
, __m256
, 1)
102 test_0 (_xabort
, void, 1)
105 test_1 (_mm_aeskeygenassist_si128
, __m128i
, __m128i
, 1)
106 test_2 (_mm_clmulepi64_si128
, __m128i
, __m128i
, __m128i
, 1)
109 test_1 (_mm_round_pd
, __m128d
, __m128d
, 1)
110 test_1 (_mm_round_ps
, __m128
, __m128
, 1)
111 test_2 (_mm_round_sd
, __m128d
, __m128d
, __m128d
, 1)
112 test_2 (_mm_round_ss
, __m128
, __m128
, __m128
, 1)
114 test_2 (_mm_blend_epi16
, __m128i
, __m128i
, __m128i
, 1)
115 test_2 (_mm_blend_ps
, __m128
, __m128
, __m128
, 1)
116 test_2 (_mm_blend_pd
, __m128d
, __m128d
, __m128d
, 1)
117 test_2 (_mm_dp_ps
, __m128
, __m128
, __m128
, 1)
118 test_2 (_mm_dp_pd
, __m128d
, __m128d
, __m128d
, 1)
119 test_2 (_mm_insert_ps
, __m128
, __m128
, __m128
, 1)
120 test_1 (_mm_extract_ps
, int, __m128
, 1)
121 test_2 (_mm_insert_epi8
, __m128i
, __m128i
, int, 1)
122 test_2 (_mm_insert_epi32
, __m128i
, __m128i
, int, 1)
124 test_2 (_mm_insert_epi64
, __m128i
, __m128i
, long long, 1)
126 test_1 (_mm_extract_epi8
, int, __m128i
, 1)
127 test_1 (_mm_extract_epi32
, int, __m128i
, 1)
129 test_1 (_mm_extract_epi64
, long long, __m128i
, 1)
131 test_2 (_mm_mpsadbw_epu8
, __m128i
, __m128i
, __m128i
, 1)
132 test_2 (_mm_cmpistrm
, __m128i
, __m128i
, __m128i
, 1)
133 test_2 (_mm_cmpistri
, int, __m128i
, __m128i
, 1)
134 test_4 (_mm_cmpestrm
, __m128i
, __m128i
, int, __m128i
, int, 1)
135 test_4 (_mm_cmpestri
, int, __m128i
, int, __m128i
, int, 1)
136 test_2 (_mm_cmpistra
, int, __m128i
, __m128i
, 1)
137 test_2 (_mm_cmpistrc
, int, __m128i
, __m128i
, 1)
138 test_2 (_mm_cmpistro
, int, __m128i
, __m128i
, 1)
139 test_2 (_mm_cmpistrs
, int, __m128i
, __m128i
, 1)
140 test_2 (_mm_cmpistrz
, int, __m128i
, __m128i
, 1)
141 test_4 (_mm_cmpestra
, int, __m128i
, int, __m128i
, int, 1)
142 test_4 (_mm_cmpestrc
, int, __m128i
, int, __m128i
, int, 1)
143 test_4 (_mm_cmpestro
, int, __m128i
, int, __m128i
, int, 1)
144 test_4 (_mm_cmpestrs
, int, __m128i
, int, __m128i
, int, 1)
145 test_4 (_mm_cmpestrz
, int, __m128i
, int, __m128i
, int, 1)
148 test_2 (_mm_alignr_epi8
, __m128i
, __m128i
, __m128i
, 1)
149 test_2 (_mm_alignr_pi8
, __m64
, __m64
, __m64
, 1)
152 test_2 (_mm_shuffle_pd
, __m128d
, __m128d
, __m128d
, 1)
153 test_1 (_mm_srli_si128
, __m128i
, __m128i
, 1)
154 test_1 (_mm_slli_si128
, __m128i
, __m128i
, 1)
155 test_1 (_mm_extract_epi16
, int, __m128i
, 1)
156 test_2 (_mm_insert_epi16
, __m128i
, __m128i
, int, 1)
157 test_1 (_mm_shufflehi_epi16
, __m128i
, __m128i
, 1)
158 test_1 (_mm_shufflelo_epi16
, __m128i
, __m128i
, 1)
159 test_1 (_mm_shuffle_epi32
, __m128i
, __m128i
, 1)
162 test_2 (_mm_shuffle_ps
, __m128
, __m128
, __m128
, 1)
163 test_1 (_mm_extract_pi16
, int, __m64
, 1)
164 test_1 (_m_pextrw
, int, __m64
, 1)
165 test_2 (_mm_insert_pi16
, __m64
, __m64
, int, 1)
166 test_2 (_m_pinsrw
, __m64
, __m64
, int, 1)
167 test_1 (_mm_shuffle_pi16
, __m64
, __m64
, 1)
168 test_1 (_m_pshufw
, __m64
, __m64
, 1)
169 test_1 (_mm_prefetch
, void, void *, _MM_HINT_NTA
)
172 test_1 ( _mm_roti_epi8
, __m128i
, __m128i
, 1)
173 test_1 ( _mm_roti_epi16
, __m128i
, __m128i
, 1)
174 test_1 ( _mm_roti_epi32
, __m128i
, __m128i
, 1)
175 test_1 ( _mm_roti_epi64
, __m128i
, __m128i
, 1)
176 test_3 (_mm_permute2_pd
, __m128d
, __m128d
, __m128d
, __m128d
, 1)
177 test_3 (_mm256_permute2_pd
, __m256d
, __m256d
, __m256d
, __m256d
, 1)
178 test_3 (_mm_permute2_ps
, __m128
, __m128
, __m128
, __m128
, 1)
179 test_3 (_mm256_permute2_ps
, __m256
, __m256
, __m256
, __m256
, 1)
182 test_2 ( __lwpval32
, void, unsigned int, unsigned int, 1)
183 test_2 ( __lwpins32
, unsigned char, unsigned int, unsigned int, 1)
185 test_2 ( __lwpval64
, void, unsigned long long, unsigned int, 1)
186 test_2 ( __lwpins64
, unsigned char, unsigned long long, unsigned int, 1)
190 test_1 ( __bextri_u32
, unsigned int, unsigned int, 1)
192 test_1 ( __bextri_u64
, unsigned long long, unsigned long long, 1)