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