2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sse-14.c
blob35db725def896cb1d0f83ed1dce6c6b3b239b026
1 /* { dg-do compile } */
2 /* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -m3dnow -msse4 -msse5 -maes -mpclmul" } */
4 #include <mm_malloc.h>
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}mmintrin.h and mm3dnow.h
8 that reference the proper builtin functions. Defining away "extern" and
9 "__inline" results in all of them being compiled as proper functions. */
11 #define extern
12 #define __inline
14 #include <wmmintrin.h>
15 #include <bmmintrin.h>
16 #include <smmintrin.h>
17 #include <mm3dnow.h>
19 #define _CONCAT(x,y) x ## y
21 #define test_1(func, type, op1_type, imm) \
22 type _CONCAT(_,func) (op1_type A, int const I) \
23 { return func (A, imm); }
25 #define test_1x(func, type, op1_type, imm1, imm2) \
26 type _CONCAT(_,func) (op1_type A, int const I, int const L) \
27 { return func (A, imm1, imm2); }
29 #define test_2(func, type, op1_type, op2_type, imm) \
30 type _CONCAT(_,func) (op1_type A, op2_type B, int const I) \
31 { return func (A, B, imm); }
33 #define test_2x(func, type, op1_type, op2_type, imm1, imm2) \
34 type _CONCAT(_,func) (op1_type A, op2_type B, int const I, int const L) \
35 { return func (A, B, imm1, imm2); }
37 #define test_4(func, type, op1_type, op2_type, op3_type, op4_type, imm) \
38 type _CONCAT(_,func) (op1_type A, op2_type B, \
39 op3_type C, op4_type D, int const I) \
40 { return func (A, B, C, D, imm); }
43 /* Following intrinsics require immediate arguments. They
44 are defined as macros for non-optimized compilations. */
46 /* ammintrin.h */
47 test_1x (_mm_extracti_si64, __m128i, __m128i, 1, 1)
48 test_2x (_mm_inserti_si64, __m128i, __m128i, __m128i, 1, 1)
50 /* wmmintrin.h */
51 test_1 (_mm_aeskeygenassist_si128, __m128i, __m128i, 1)
52 test_2 (_mm_clmulepi64_si128, __m128i, __m128i, __m128i, 1)
54 /* mmintrin-common.h */
55 test_1 (_mm_round_pd, __m128d, __m128d, 1)
56 test_1 (_mm_round_ps, __m128, __m128, 1)
57 test_2 (_mm_round_sd, __m128d, __m128d, __m128d, 1)
58 test_2 (_mm_round_ss, __m128, __m128, __m128, 1)
60 /* smmintrin.h */
61 test_2 (_mm_blend_epi16, __m128i, __m128i, __m128i, 1)
62 test_2 (_mm_blend_ps, __m128, __m128, __m128, 1)
63 test_2 (_mm_blend_pd, __m128d, __m128d, __m128d, 1)
64 test_2 (_mm_dp_ps, __m128, __m128, __m128, 1)
65 test_2 (_mm_dp_pd, __m128d, __m128d, __m128d, 1)
66 test_2 (_mm_insert_ps, __m128, __m128, __m128, 1)
67 test_1 (_mm_extract_ps, int, __m128, 1)
68 test_2 (_mm_insert_epi8, __m128i, __m128i, int, 1)
69 test_2 (_mm_insert_epi32, __m128i, __m128i, int, 1)
70 #ifdef __x86_64__
71 test_2 (_mm_insert_epi64, __m128i, __m128i, long long, 1)
72 #endif
73 test_1 (_mm_extract_epi8, int, __m128i, 1)
74 test_1 (_mm_extract_epi32, int, __m128i, 1)
75 #ifdef __x86_64__
76 test_1 (_mm_extract_epi64, long long, __m128i, 1)
77 #endif
78 test_2 (_mm_mpsadbw_epu8, __m128i, __m128i, __m128i, 1)
79 test_2 (_mm_cmpistrm, __m128i, __m128i, __m128i, 1)
80 test_2 (_mm_cmpistri, int, __m128i, __m128i, 1)
81 test_4 (_mm_cmpestrm, __m128i, __m128i, int, __m128i, int, 1)
82 test_4 (_mm_cmpestri, int, __m128i, int, __m128i, int, 1)
83 test_2 (_mm_cmpistra, int, __m128i, __m128i, 1)
84 test_2 (_mm_cmpistrc, int, __m128i, __m128i, 1)
85 test_2 (_mm_cmpistro, int, __m128i, __m128i, 1)
86 test_2 (_mm_cmpistrs, int, __m128i, __m128i, 1)
87 test_2 (_mm_cmpistrz, int, __m128i, __m128i, 1)
88 test_4 (_mm_cmpestra, int, __m128i, int, __m128i, int, 1)
89 test_4 (_mm_cmpestrc, int, __m128i, int, __m128i, int, 1)
90 test_4 (_mm_cmpestro, int, __m128i, int, __m128i, int, 1)
91 test_4 (_mm_cmpestrs, int, __m128i, int, __m128i, int, 1)
92 test_4 (_mm_cmpestrz, int, __m128i, int, __m128i, int, 1)
94 /* tmmintrin.h */
95 test_2 (_mm_alignr_epi8, __m128i, __m128i, __m128i, 1)
96 test_2 (_mm_alignr_pi8, __m64, __m64, __m64, 1)
98 /* emmintrin.h */
99 test_2 (_mm_shuffle_pd, __m128d, __m128d, __m128d, 1)
100 test_1 (_mm_srli_si128, __m128i, __m128i, 1)
101 test_1 (_mm_slli_si128, __m128i, __m128i, 1)
102 test_1 (_mm_extract_epi16, int, __m128i, 1)
103 test_2 (_mm_insert_epi16, __m128i, __m128i, int, 1)
104 test_1 (_mm_shufflehi_epi16, __m128i, __m128i, 1)
105 test_1 (_mm_shufflelo_epi16, __m128i, __m128i, 1)
106 test_1 (_mm_shuffle_epi32, __m128i, __m128i, 1)
108 /* xmmintrin.h */
109 test_2 (_mm_shuffle_ps, __m128, __m128, __m128, 1)
110 test_1 (_mm_extract_pi16, int, __m64, 1)
111 test_1 (_m_pextrw, int, __m64, 1)
112 test_2 (_mm_insert_pi16, __m64, __m64, int, 1)
113 test_2 (_m_pinsrw, __m64, __m64, int, 1)
114 test_1 (_mm_shuffle_pi16, __m64, __m64, 1)
115 test_1 (_m_pshufw, __m64, __m64, 1)
116 test_1 (_mm_prefetch, void, void *, _MM_HINT_NTA)
118 /* bmmintrin.h */
119 test_1 (_mm_roti_epi8, __m128i, __m128i, 1)
120 test_1 (_mm_roti_epi16, __m128i, __m128i, 1)
121 test_1 (_mm_roti_epi32, __m128i, __m128i, 1)
122 test_1 (_mm_roti_epi64, __m128i, __m128i, 1)