1 /* { dg-do compile } */
2 /* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -msse4a -maes -mpclmul" } */
6 /* Test that the intrinsics compile without optimization. All of them are
7 defined as inline functions in {,x,e,p,t,s,w,g,a,b}mmintrin.h and
8 mm3dnow.h that reference the proper builtin functions. Defining away
9 "extern" and "__inline" results in all of them being compiled as proper
15 #include <wmmintrin.h>
16 #include <immintrin.h>
17 #include <ammintrin.h>
20 #define _CONCAT(x,y) x ## y
22 #define test_1(func, type, op1_type, imm) \
23 type _CONCAT(_,func) (op1_type A, int const I) \
24 { return func (A, imm); }
26 #define test_1x(func, type, op1_type, imm1, imm2) \
27 type _CONCAT(_,func) (op1_type A, int const I, int const L) \
28 { return func (A, imm1, imm2); }
30 #define test_2(func, type, op1_type, op2_type, imm) \
31 type _CONCAT(_,func) (op1_type A, op2_type B, int const I) \
32 { return func (A, B, imm); }
34 #define test_2x(func, type, op1_type, op2_type, imm1, imm2) \
35 type _CONCAT(_,func) (op1_type A, op2_type B, int const I, int const L) \
36 { return func (A, B, imm1, imm2); }
38 #define test_3(func, type, op1_type, op2_type, op3_type, imm) \
39 type _CONCAT(_,func) (op1_type A, op2_type B, \
40 op3_type C, int const I) \
41 { return func (A, B, C, imm); }
43 #define test_4(func, type, op1_type, op2_type, op3_type, op4_type, imm) \
44 type _CONCAT(_,func) (op1_type A, op2_type B, \
45 op3_type C, op4_type D, int const I) \
46 { return func (A, B, C, D, imm); }
49 /* Following intrinsics require immediate arguments. They
50 are defined as macros for non-optimized compilations. */
53 test_1x (_mm_extracti_si64
, __m128i
, __m128i
, 1, 1)
54 test_2x (_mm_inserti_si64
, __m128i
, __m128i
, __m128i
, 1, 1)
57 test_2 (_mm256_blend_pd
, __m256d
, __m256d
, __m256d
, 1)
58 test_2 (_mm256_blend_ps
, __m256
, __m256
, __m256
, 1)
59 test_2 (_mm256_dp_ps
, __m256
, __m256
, __m256
, 1)
60 test_2 (_mm256_shuffle_pd
, __m256d
, __m256d
, __m256d
, 1)
61 test_2 (_mm256_shuffle_ps
, __m256
, __m256
, __m256
, 1)
62 test_2 (_mm_cmp_sd
, __m128d
, __m128d
, __m128d
, 1)
63 test_2 (_mm_cmp_ss
, __m128
, __m128
, __m128
, 1)
64 test_2 (_mm_cmp_pd
, __m128d
, __m128d
, __m128d
, 1)
65 test_2 (_mm_cmp_ps
, __m128
, __m128
, __m128
, 1)
66 test_2 (_mm256_cmp_pd
, __m256d
, __m256d
, __m256d
, 1)
67 test_2 (_mm256_cmp_ps
, __m256
, __m256
, __m256
, 1)
68 test_1 (_mm256_extractf128_pd
, __m128d
, __m256d
, 1)
69 test_1 (_mm256_extractf128_ps
, __m128
, __m256
, 1)
70 test_1 (_mm256_extractf128_si256
, __m128i
, __m256i
, 1)
71 test_1 (_mm256_extract_epi8
, int, __m256i
, 20)
72 test_1 (_mm256_extract_epi16
, int, __m256i
, 13)
73 test_1 (_mm256_extract_epi32
, int, __m256i
, 6)
75 test_1 (_mm256_extract_epi64
, long long, __m256i
, 2)
77 test_1 (_mm_permute_pd
, __m128d
, __m128d
, 1)
78 test_1 (_mm256_permute_pd
, __m256d
, __m256d
, 1)
79 test_1 (_mm_permute_ps
, __m128
, __m128
, 1)
80 test_1 (_mm256_permute_ps
, __m256
, __m256
, 1)
81 test_2 (_mm256_permute2f128_pd
, __m256d
, __m256d
, __m256d
, 1)
82 test_2 (_mm256_permute2f128_ps
, __m256
, __m256
, __m256
, 1)
83 test_2 (_mm256_permute2f128_si256
, __m256i
, __m256i
, __m256i
, 1)
84 test_2 (_mm256_insertf128_pd
, __m256d
, __m256d
, __m128d
, 1)
85 test_2 (_mm256_insertf128_ps
, __m256
, __m256
, __m128
, 1)
86 test_2 (_mm256_insertf128_si256
, __m256i
, __m256i
, __m128i
, 1)
87 test_2 (_mm256_insert_epi8
, __m256i
, __m256i
, int, 30)
88 test_2 (_mm256_insert_epi16
, __m256i
, __m256i
, int, 7)
89 test_2 (_mm256_insert_epi32
, __m256i
, __m256i
, int, 3)
91 test_2 (_mm256_insert_epi64
, __m256i
, __m256i
, long long, 1)
93 test_1 (_mm256_round_pd
, __m256d
, __m256d
, 1)
94 test_1 (_mm256_round_ps
, __m256
, __m256
, 1)
97 test_1 (_mm_aeskeygenassist_si128
, __m128i
, __m128i
, 1)
98 test_2 (_mm_clmulepi64_si128
, __m128i
, __m128i
, __m128i
, 1)
101 test_1 (_mm_round_pd
, __m128d
, __m128d
, 1)
102 test_1 (_mm_round_ps
, __m128
, __m128
, 1)
103 test_2 (_mm_round_sd
, __m128d
, __m128d
, __m128d
, 1)
104 test_2 (_mm_round_ss
, __m128
, __m128
, __m128
, 1)
106 test_2 (_mm_blend_epi16
, __m128i
, __m128i
, __m128i
, 1)
107 test_2 (_mm_blend_ps
, __m128
, __m128
, __m128
, 1)
108 test_2 (_mm_blend_pd
, __m128d
, __m128d
, __m128d
, 1)
109 test_2 (_mm_dp_ps
, __m128
, __m128
, __m128
, 1)
110 test_2 (_mm_dp_pd
, __m128d
, __m128d
, __m128d
, 1)
111 test_2 (_mm_insert_ps
, __m128
, __m128
, __m128
, 1)
112 test_1 (_mm_extract_ps
, int, __m128
, 1)
113 test_2 (_mm_insert_epi8
, __m128i
, __m128i
, int, 1)
114 test_2 (_mm_insert_epi32
, __m128i
, __m128i
, int, 1)
116 test_2 (_mm_insert_epi64
, __m128i
, __m128i
, long long, 1)
118 test_1 (_mm_extract_epi8
, int, __m128i
, 1)
119 test_1 (_mm_extract_epi32
, int, __m128i
, 1)
121 test_1 (_mm_extract_epi64
, long long, __m128i
, 1)
123 test_2 (_mm_mpsadbw_epu8
, __m128i
, __m128i
, __m128i
, 1)
124 test_2 (_mm_cmpistrm
, __m128i
, __m128i
, __m128i
, 1)
125 test_2 (_mm_cmpistri
, int, __m128i
, __m128i
, 1)
126 test_4 (_mm_cmpestrm
, __m128i
, __m128i
, int, __m128i
, int, 1)
127 test_4 (_mm_cmpestri
, int, __m128i
, int, __m128i
, int, 1)
128 test_2 (_mm_cmpistra
, int, __m128i
, __m128i
, 1)
129 test_2 (_mm_cmpistrc
, int, __m128i
, __m128i
, 1)
130 test_2 (_mm_cmpistro
, int, __m128i
, __m128i
, 1)
131 test_2 (_mm_cmpistrs
, int, __m128i
, __m128i
, 1)
132 test_2 (_mm_cmpistrz
, int, __m128i
, __m128i
, 1)
133 test_4 (_mm_cmpestra
, int, __m128i
, int, __m128i
, int, 1)
134 test_4 (_mm_cmpestrc
, int, __m128i
, int, __m128i
, int, 1)
135 test_4 (_mm_cmpestro
, int, __m128i
, int, __m128i
, int, 1)
136 test_4 (_mm_cmpestrs
, int, __m128i
, int, __m128i
, int, 1)
137 test_4 (_mm_cmpestrz
, int, __m128i
, int, __m128i
, int, 1)
140 test_2 (_mm_alignr_epi8
, __m128i
, __m128i
, __m128i
, 1)
141 test_2 (_mm_alignr_pi8
, __m64
, __m64
, __m64
, 1)
144 test_2 (_mm_shuffle_pd
, __m128d
, __m128d
, __m128d
, 1)
145 test_1 (_mm_srli_si128
, __m128i
, __m128i
, 1)
146 test_1 (_mm_slli_si128
, __m128i
, __m128i
, 1)
147 test_1 (_mm_extract_epi16
, int, __m128i
, 1)
148 test_2 (_mm_insert_epi16
, __m128i
, __m128i
, int, 1)
149 test_1 (_mm_shufflehi_epi16
, __m128i
, __m128i
, 1)
150 test_1 (_mm_shufflelo_epi16
, __m128i
, __m128i
, 1)
151 test_1 (_mm_shuffle_epi32
, __m128i
, __m128i
, 1)
154 test_2 (_mm_shuffle_ps
, __m128
, __m128
, __m128
, 1)
155 test_1 (_mm_extract_pi16
, int, __m64
, 1)
156 test_1 (_m_pextrw
, int, __m64
, 1)
157 test_2 (_mm_insert_pi16
, __m64
, __m64
, int, 1)
158 test_2 (_m_pinsrw
, __m64
, __m64
, int, 1)
159 test_1 (_mm_shuffle_pi16
, __m64
, __m64
, 1)
160 test_1 (_m_pshufw
, __m64
, __m64
, 1)
161 test_1 (_mm_prefetch
, void, void *, _MM_HINT_NTA
)