OSDN Git Service

286748a8594ea5c3702f25bcc86201c3bbc94a48
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / i386 / sse-14.c
1 /* { dg-do compile } */
2 /* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -m3dnow -msse4 -msse5" } */
3
4 #include <mm_malloc.h>
5
6 /* Test that the intrinsics compile without optimization.  All of them are
7    defined as inline functions in {,x,e,p,t,s,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.  */
10
11 #define extern
12 #define __inline
13
14 #include <bmmintrin.h>
15 #include <smmintrin.h>
16 #include <mm3dnow.h>
17
18 #define _CONCAT(x,y) x ## y
19
20 #define test_1(func, type, op1_type, imm)                               \
21   type _CONCAT(_,func) (op1_type A, int const I)                        \
22   { return func (A, imm); }
23
24 #define test_1x(func, type, op1_type, imm1, imm2)                       \
25   type _CONCAT(_,func) (op1_type A, int const I, int const L)           \
26   { return func (A, imm1, imm2); }
27
28 #define test_2(func, type, op1_type, op2_type, imm)                     \
29   type _CONCAT(_,func) (op1_type A, op2_type B, int const I)            \
30   { return func (A, B, imm); }
31
32 #define test_2x(func, type, op1_type, op2_type, imm1, imm2)             \
33   type _CONCAT(_,func) (op1_type A, op2_type B, int const I, int const L) \
34   { return func (A, B, imm1, imm2); }
35
36 #define test_4(func, type, op1_type, op2_type, op3_type, op4_type, imm) \
37   type _CONCAT(_,func) (op1_type A, op2_type B,                         \
38                         op3_type C, op4_type D, int const I)            \
39   { return func (A, B, C, D, imm); }
40
41
42 /* Following intrinsics require immediate arguments.  They
43    are defined as macros for non-optimized compilations. */
44
45 /* ammintrin.h */
46 test_1x (_mm_extracti_si64, __m128i, __m128i, 1, 1)
47 test_2x (_mm_inserti_si64, __m128i, __m128i, __m128i, 1, 1)
48
49 /* smmintrin.h */
50 test_2 (_mm_blend_epi16, __m128i, __m128i, __m128i, 1)
51 test_2 (_mm_blend_ps, __m128, __m128, __m128, 1)
52 test_2 (_mm_blend_pd, __m128d, __m128d, __m128d, 1)
53 test_2 (_mm_dp_ps, __m128, __m128, __m128, 1)
54 test_2 (_mm_dp_pd, __m128d, __m128d, __m128d, 1)
55 test_2 (_mm_insert_ps, __m128, __m128, __m128, 1)
56 test_1 (_mm_extract_ps, int, __m128, 1)
57 test_2 (_mm_insert_epi8, __m128i, __m128i, int, 1)
58 test_2 (_mm_insert_epi32, __m128i, __m128i, int, 1)
59 #ifdef __x86_64__
60 test_2 (_mm_insert_epi64, __m128i, __m128i, long long, 1)
61 #endif
62 test_1 (_mm_extract_epi8, int, __m128i, 1)
63 test_1 (_mm_extract_epi32, int, __m128i, 1)
64 #ifdef __x86_64__
65 test_1 (_mm_extract_epi64, long long, __m128i, 1)
66 #endif
67 test_2 (_mm_mpsadbw_epu8, __m128i, __m128i, __m128i, 1)
68 test_2 (_mm_cmpistrm, __m128i, __m128i, __m128i, 1)
69 test_2 (_mm_cmpistri, int, __m128i, __m128i, 1)
70 test_4 (_mm_cmpestrm, __m128i, __m128i, int, __m128i, int, 1)
71 test_4 (_mm_cmpestri, int, __m128i, int, __m128i, int, 1)
72 test_2 (_mm_cmpistra, int, __m128i, __m128i, 1)
73 test_2 (_mm_cmpistrc, int, __m128i, __m128i, 1)
74 test_2 (_mm_cmpistro, int, __m128i, __m128i, 1)
75 test_2 (_mm_cmpistrs, int, __m128i, __m128i, 1)
76 test_2 (_mm_cmpistrz, int, __m128i, __m128i, 1)
77 test_4 (_mm_cmpestra, int, __m128i, int, __m128i, int, 1)
78 test_4 (_mm_cmpestrc, int, __m128i, int, __m128i, int, 1)
79 test_4 (_mm_cmpestro, int, __m128i, int, __m128i, int, 1)
80 test_4 (_mm_cmpestrs, int, __m128i, int, __m128i, int, 1)
81 test_4 (_mm_cmpestrz, int, __m128i, int, __m128i, int, 1)
82
83 /* tmmintrin.h */
84 test_2 (_mm_alignr_epi8, __m128i, __m128i, __m128i, 1)
85 test_2 (_mm_alignr_pi8, __m64, __m64, __m64, 1)
86
87 /* emmintrin.h */
88 test_2 (_mm_shuffle_pd, __m128d, __m128d, __m128d, 1)
89 test_1 (_mm_srli_si128, __m128i, __m128i, 1)
90 test_1 (_mm_slli_si128, __m128i, __m128i, 1)
91 test_1 (_mm_extract_epi16, int, __m128i, 1)
92 test_2 (_mm_insert_epi16, __m128i, __m128i, int, 1)
93 test_1 (_mm_shufflehi_epi16, __m128i, __m128i, 1)
94 test_1 (_mm_shufflelo_epi16, __m128i, __m128i, 1)
95 test_1 (_mm_shuffle_epi32, __m128i, __m128i, 1)
96
97 /* xmmintrin.h */
98 test_2 (_mm_shuffle_ps, __m128, __m128, __m128, 1)
99 test_1 (_mm_extract_pi16, int, __m64, 1)
100 test_1 (_m_pextrw, int, __m64, 1)
101 test_2 (_mm_insert_pi16, __m64, __m64, int, 1)
102 test_2 (_m_pinsrw, __m64, __m64, int, 1)
103 test_1 (_mm_shuffle_pi16, __m64, __m64, 1)
104 test_1 (_m_pshufw, __m64, __m64, 1)
105 test_1 (_mm_prefetch, void, void *, _MM_HINT_NTA)
106
107 /* bmmintrin.h */
108 test_1 (_mm_roti_epi8, __m128i, __m128i, 1)
109 test_1 (_mm_roti_epi16, __m128i, __m128i, 1)
110 test_1 (_mm_roti_epi32, __m128i, __m128i, 1)
111 test_1 (_mm_roti_epi64, __m128i, __m128i, 1)