1 |
318 |
jeremybenn |
/* Same as sse-14, except converted to use #pragma GCC option. */
|
2 |
|
|
/* { dg-do compile } */
|
3 |
|
|
/* { dg-options "-O0 -Werror-implicit-function-declaration" } */
|
4 |
|
|
|
5 |
|
|
#include <mm_malloc.h>
|
6 |
|
|
|
7 |
|
|
/* Test that the intrinsics compile without optimization. All of them
|
8 |
|
|
are defined as inline functions in {,x,e,p,t,s,w,a}mmintrin.h,
|
9 |
|
|
xopintrin.h, lwpintrin.h, popcntintrin.h and mm3dnow.h that
|
10 |
|
|
reference the proper builtin functions. Defining away "extern" and
|
11 |
|
|
"__inline" results in all of them being compiled as proper
|
12 |
|
|
functions. */
|
13 |
|
|
|
14 |
|
|
#define extern
|
15 |
|
|
#define __inline
|
16 |
|
|
|
17 |
|
|
#define _CONCAT(x,y) x ## y
|
18 |
|
|
|
19 |
|
|
#define test_1(func, type, op1_type, imm) \
|
20 |
|
|
type _CONCAT(_,func) (op1_type A, int const I) \
|
21 |
|
|
{ return func (A, imm); }
|
22 |
|
|
|
23 |
|
|
#define test_1x(func, type, op1_type, imm1, imm2) \
|
24 |
|
|
type _CONCAT(_,func) (op1_type A, int const I, int const L) \
|
25 |
|
|
{ return func (A, imm1, imm2); }
|
26 |
|
|
|
27 |
|
|
#define test_2(func, type, op1_type, op2_type, imm) \
|
28 |
|
|
type _CONCAT(_,func) (op1_type A, op2_type B, int const I) \
|
29 |
|
|
{ return func (A, B, imm); }
|
30 |
|
|
|
31 |
|
|
#define test_2x(func, type, op1_type, op2_type, imm1, imm2) \
|
32 |
|
|
type _CONCAT(_,func) (op1_type A, op2_type B, int const I, int const L) \
|
33 |
|
|
{ return func (A, B, imm1, imm2); }
|
34 |
|
|
|
35 |
|
|
#define test_4(func, type, op1_type, op2_type, op3_type, op4_type, imm) \
|
36 |
|
|
type _CONCAT(_,func) (op1_type A, op2_type B, \
|
37 |
|
|
op3_type C, op4_type D, int const I) \
|
38 |
|
|
{ return func (A, B, C, D, imm); }
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
#ifndef DIFFERENT_PRAGMAS
|
42 |
|
|
#pragma GCC target ("mmx,3dnow,sse,sse2,sse3,ssse3,sse4.1,sse4.2,sse4a,aes,pclmul,xop,popcnt,abm,lwp")
|
43 |
|
|
#endif
|
44 |
|
|
|
45 |
|
|
/* Following intrinsics require immediate arguments. They
|
46 |
|
|
are defined as macros for non-optimized compilations. */
|
47 |
|
|
|
48 |
|
|
/* mmintrin.h (MMX). */
|
49 |
|
|
#ifdef DIFFERENT_PRAGMAS
|
50 |
|
|
#pragma GCC target ("mmx")
|
51 |
|
|
#endif
|
52 |
|
|
#include <mmintrin.h>
|
53 |
|
|
|
54 |
|
|
/* mm3dnow.h (3DNOW). */
|
55 |
|
|
#ifdef DIFFERENT_PRAGMAS
|
56 |
|
|
#pragma GCC target ("3dnow")
|
57 |
|
|
#endif
|
58 |
|
|
#include <mm3dnow.h>
|
59 |
|
|
|
60 |
|
|
/* xmmintrin.h (SSE). */
|
61 |
|
|
#ifdef DIFFERENT_PRAGMAS
|
62 |
|
|
#pragma GCC target ("sse")
|
63 |
|
|
#endif
|
64 |
|
|
#include <xmmintrin.h>
|
65 |
|
|
test_2 (_mm_shuffle_ps, __m128, __m128, __m128, 1)
|
66 |
|
|
test_1 (_mm_extract_pi16, int, __m64, 1)
|
67 |
|
|
test_1 (_m_pextrw, int, __m64, 1)
|
68 |
|
|
test_2 (_mm_insert_pi16, __m64, __m64, int, 1)
|
69 |
|
|
test_2 (_m_pinsrw, __m64, __m64, int, 1)
|
70 |
|
|
test_1 (_mm_shuffle_pi16, __m64, __m64, 1)
|
71 |
|
|
test_1 (_m_pshufw, __m64, __m64, 1)
|
72 |
|
|
test_1 (_mm_prefetch, void, void *, _MM_HINT_NTA)
|
73 |
|
|
|
74 |
|
|
/* emmintrin.h (SSE2). */
|
75 |
|
|
#ifdef DIFFERENT_PRAGMAS
|
76 |
|
|
#pragma GCC target ("sse2")
|
77 |
|
|
#endif
|
78 |
|
|
#include <emmintrin.h>
|
79 |
|
|
test_2 (_mm_shuffle_pd, __m128d, __m128d, __m128d, 1)
|
80 |
|
|
test_1 (_mm_srli_si128, __m128i, __m128i, 1)
|
81 |
|
|
test_1 (_mm_slli_si128, __m128i, __m128i, 1)
|
82 |
|
|
test_1 (_mm_extract_epi16, int, __m128i, 1)
|
83 |
|
|
test_2 (_mm_insert_epi16, __m128i, __m128i, int, 1)
|
84 |
|
|
test_1 (_mm_shufflehi_epi16, __m128i, __m128i, 1)
|
85 |
|
|
test_1 (_mm_shufflelo_epi16, __m128i, __m128i, 1)
|
86 |
|
|
test_1 (_mm_shuffle_epi32, __m128i, __m128i, 1)
|
87 |
|
|
|
88 |
|
|
/* pmmintrin.h (SSE3). */
|
89 |
|
|
#ifdef DIFFERENT_PRAGMAS
|
90 |
|
|
#pragma GCC target ("sse3")
|
91 |
|
|
#endif
|
92 |
|
|
#include <pmmintrin.h>
|
93 |
|
|
|
94 |
|
|
/* tmmintrin.h (SSSE3). */
|
95 |
|
|
#ifdef DIFFERENT_PRAGMAS
|
96 |
|
|
#pragma GCC target ("ssse3")
|
97 |
|
|
#endif
|
98 |
|
|
#include <tmmintrin.h>
|
99 |
|
|
test_2 (_mm_alignr_epi8, __m128i, __m128i, __m128i, 1)
|
100 |
|
|
test_2 (_mm_alignr_pi8, __m64, __m64, __m64, 1)
|
101 |
|
|
|
102 |
|
|
/* ammintrin.h (SSE4A). */
|
103 |
|
|
#ifdef DIFFERENT_PRAGMAS
|
104 |
|
|
#pragma GCC target ("sse4a")
|
105 |
|
|
#endif
|
106 |
|
|
#include <ammintrin.h>
|
107 |
|
|
test_1x (_mm_extracti_si64, __m128i, __m128i, 1, 1)
|
108 |
|
|
test_2x (_mm_inserti_si64, __m128i, __m128i, __m128i, 1, 1)
|
109 |
|
|
|
110 |
|
|
/* smmintrin.h (SSE4.1). */
|
111 |
|
|
/* nmmintrin.h (SSE4.2). */
|
112 |
|
|
/* Note, nmmintrin.h includes smmintrin.h, and smmintrin.h checks for the
|
113 |
|
|
#ifdef. So just set the option to SSE4.2. */
|
114 |
|
|
#ifdef DIFFERENT_PRAGMAS
|
115 |
|
|
#pragma GCC target ("sse4.2")
|
116 |
|
|
#endif
|
117 |
|
|
#include <nmmintrin.h>
|
118 |
|
|
test_2 (_mm_blend_epi16, __m128i, __m128i, __m128i, 1)
|
119 |
|
|
test_2 (_mm_blend_ps, __m128, __m128, __m128, 1)
|
120 |
|
|
test_2 (_mm_blend_pd, __m128d, __m128d, __m128d, 1)
|
121 |
|
|
test_2 (_mm_dp_ps, __m128, __m128, __m128, 1)
|
122 |
|
|
test_2 (_mm_dp_pd, __m128d, __m128d, __m128d, 1)
|
123 |
|
|
test_2 (_mm_insert_ps, __m128, __m128, __m128, 1)
|
124 |
|
|
test_1 (_mm_extract_ps, int, __m128, 1)
|
125 |
|
|
test_2 (_mm_insert_epi8, __m128i, __m128i, int, 1)
|
126 |
|
|
test_2 (_mm_insert_epi32, __m128i, __m128i, int, 1)
|
127 |
|
|
#ifdef __x86_64__
|
128 |
|
|
test_2 (_mm_insert_epi64, __m128i, __m128i, long long, 1)
|
129 |
|
|
#endif
|
130 |
|
|
test_1 (_mm_extract_epi8, int, __m128i, 1)
|
131 |
|
|
test_1 (_mm_extract_epi32, int, __m128i, 1)
|
132 |
|
|
#ifdef __x86_64__
|
133 |
|
|
test_1 (_mm_extract_epi64, long long, __m128i, 1)
|
134 |
|
|
#endif
|
135 |
|
|
test_2 (_mm_mpsadbw_epu8, __m128i, __m128i, __m128i, 1)
|
136 |
|
|
test_2 (_mm_cmpistrm, __m128i, __m128i, __m128i, 1)
|
137 |
|
|
test_2 (_mm_cmpistri, int, __m128i, __m128i, 1)
|
138 |
|
|
test_4 (_mm_cmpestrm, __m128i, __m128i, int, __m128i, int, 1)
|
139 |
|
|
test_4 (_mm_cmpestri, int, __m128i, int, __m128i, int, 1)
|
140 |
|
|
test_2 (_mm_cmpistra, int, __m128i, __m128i, 1)
|
141 |
|
|
test_2 (_mm_cmpistrc, int, __m128i, __m128i, 1)
|
142 |
|
|
test_2 (_mm_cmpistro, int, __m128i, __m128i, 1)
|
143 |
|
|
test_2 (_mm_cmpistrs, int, __m128i, __m128i, 1)
|
144 |
|
|
test_2 (_mm_cmpistrz, int, __m128i, __m128i, 1)
|
145 |
|
|
test_4 (_mm_cmpestra, int, __m128i, int, __m128i, int, 1)
|
146 |
|
|
test_4 (_mm_cmpestrc, int, __m128i, int, __m128i, int, 1)
|
147 |
|
|
test_4 (_mm_cmpestro, int, __m128i, int, __m128i, int, 1)
|
148 |
|
|
test_4 (_mm_cmpestrs, int, __m128i, int, __m128i, int, 1)
|
149 |
|
|
test_4 (_mm_cmpestrz, int, __m128i, int, __m128i, int, 1)
|
150 |
|
|
|
151 |
|
|
/* wmmintrin.h (AES/PCLMUL). */
|
152 |
|
|
#ifdef DIFFERENT_PRAGMAS
|
153 |
|
|
#pragma GCC target ("aes,pclmul")
|
154 |
|
|
#endif
|
155 |
|
|
#include <wmmintrin.h>
|
156 |
|
|
test_1 (_mm_aeskeygenassist_si128, __m128i, __m128i, 1)
|
157 |
|
|
test_2 (_mm_clmulepi64_si128, __m128i, __m128i, __m128i, 1)
|
158 |
|
|
|
159 |
|
|
/* smmintrin.h (SSE4.1). */
|
160 |
|
|
test_1 (_mm_round_pd, __m128d, __m128d, 1)
|
161 |
|
|
test_1 (_mm_round_ps, __m128, __m128, 1)
|
162 |
|
|
test_2 (_mm_round_sd, __m128d, __m128d, __m128d, 1)
|
163 |
|
|
test_2 (_mm_round_ss, __m128, __m128, __m128, 1)
|
164 |
|
|
|
165 |
|
|
/* xopintrin.h (XOP). */
|
166 |
|
|
#ifdef DIFFERENT_PRAGMAS
|
167 |
|
|
#pragma GCC target ("xop,lwp")
|
168 |
|
|
#endif
|
169 |
|
|
#include <x86intrin.h>
|
170 |
|
|
test_1 ( _mm_roti_epi8, __m128i, __m128i, 1)
|
171 |
|
|
test_1 ( _mm_roti_epi16, __m128i, __m128i, 1)
|
172 |
|
|
test_1 ( _mm_roti_epi32, __m128i, __m128i, 1)
|
173 |
|
|
test_1 ( _mm_roti_epi64, __m128i, __m128i, 1)
|
174 |
|
|
|
175 |
|
|
/* lwpintrin.h (LWP). */
|
176 |
|
|
test_2 ( __lwpval32, void, unsigned int, unsigned int, 1)
|
177 |
|
|
test_2 ( __lwpins32, unsigned char, unsigned int, unsigned int, 1)
|
178 |
|
|
#ifdef __x86_64__
|
179 |
|
|
test_2 ( __lwpval64, void, unsigned long long, unsigned int, 1)
|
180 |
|
|
test_2 ( __lwpins64, unsigned char, unsigned long long, unsigned int, 1)
|
181 |
|
|
#endif
|