1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +avx512f -emit-llvm -o - -Werror | FileCheck %s
// Don't include mm_malloc.h, it's system specific.
#define __MM_MALLOC_H
#include <immintrin.h>
__m512d test_mm512_sqrt_pd(__m512d a)
{
// CHECK-LABEL: @test_mm512_sqrt_pd
// CHECK: @llvm.x86.avx512.sqrt.pd.512
return _mm512_sqrt_pd(a);
}
__m512 test_mm512_sqrt_ps(__m512 a)
{
// CHECK-LABEL: @test_mm512_sqrt_ps
// CHECK: @llvm.x86.avx512.sqrt.ps.512
return _mm512_sqrt_ps(a);
}
__m512d test_mm512_rsqrt14_pd(__m512d a)
{
// CHECK-LABEL: @test_mm512_rsqrt14_pd
// CHECK: @llvm.x86.avx512.rsqrt14.pd.512
return _mm512_rsqrt14_pd(a);
}
__m512 test_mm512_rsqrt14_ps(__m512 a)
{
// CHECK-LABEL: @test_mm512_rsqrt14_ps
// CHECK: @llvm.x86.avx512.rsqrt14.ps.512
return _mm512_rsqrt14_ps(a);
}
__m512 test_mm512_add_ps(__m512 a, __m512 b)
{
// CHECK-LABEL: @test_mm512_add_ps
// CHECK: fadd <16 x float>
return _mm512_add_ps(a, b);
}
__m512d test_mm512_add_pd(__m512d a, __m512d b)
{
// CHECK-LABEL: @test_mm512_add_pd
// CHECK: fadd <8 x double>
return _mm512_add_pd(a, b);
}
__m512 test_mm512_mul_ps(__m512 a, __m512 b)
{
// CHECK-LABEL: @test_mm512_mul_ps
// CHECK: fmul <16 x float>
return _mm512_mul_ps(a, b);
}
__m512d test_mm512_mul_pd(__m512d a, __m512d b)
{
// CHECK-LABEL: @test_mm512_mul_pd
// CHECK: fmul <8 x double>
return _mm512_mul_pd(a, b);
}
void test_mm512_storeu_ps(void *p, __m512 a)
{
// CHECK-LABEL: @test_mm512_storeu_ps
// CHECK: @llvm.x86.avx512.mask.storeu.ps.512
_mm512_storeu_ps(p, a);
}
void test_mm512_storeu_pd(void *p, __m512d a)
{
// CHECK-LABEL: @test_mm512_storeu_pd
// CHECK: @llvm.x86.avx512.mask.storeu.pd.512
_mm512_storeu_pd(p, a);
}
void test_mm512_store_ps(void *p, __m512 a)
{
// CHECK-LABEL: @test_mm512_store_ps
// CHECK: store <16 x float>
_mm512_store_ps(p, a);
}
void test_mm512_store_pd(void *p, __m512d a)
{
// CHECK-LABEL: @test_mm512_store_pd
// CHECK: store <8 x double>
_mm512_store_pd(p, a);
}
__m512 test_mm512_loadu_ps(void *p)
{
// CHECK-LABEL: @test_mm512_loadu_ps
// CHECK: load <16 x float>* {{.*}}, align 1{{$}}
return _mm512_loadu_ps(p);
}
__m512d test_mm512_loadu_pd(void *p)
{
// CHECK-LABEL: @test_mm512_loadu_pd
// CHECK: load <8 x double>* {{.*}}, align 1{{$}}
return _mm512_loadu_pd(p);
}
__m512d test_mm512_set1_pd(double d)
{
// CHECK-LABEL: @test_mm512_set1_pd
// CHECK: insertelement <8 x double> {{.*}}, i32 0
// CHECK: insertelement <8 x double> {{.*}}, i32 1
// CHECK: insertelement <8 x double> {{.*}}, i32 2
// CHECK: insertelement <8 x double> {{.*}}, i32 3
// CHECK: insertelement <8 x double> {{.*}}, i32 4
// CHECK: insertelement <8 x double> {{.*}}, i32 5
// CHECK: insertelement <8 x double> {{.*}}, i32 6
// CHECK: insertelement <8 x double> {{.*}}, i32 7
return _mm512_set1_pd(d);
}
__m512d test_mm512_castpd256_pd512(__m256d a)
{
// CHECK-LABEL: @test_mm512_castpd256_pd512
// CHECK: shufflevector <4 x double> {{.*}} <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
return _mm512_castpd256_pd512(a);
}
__mmask16 test_mm512_knot(__mmask16 a)
{
// CHECK-LABEL: @test_mm512_knot
// CHECK: @llvm.x86.avx512.knot.w
return _mm512_knot(a);
}
__m512i test_mm512_valign_epi64(__m512i a, __m512i b)
{
// CHECK-LABEL: @test_mm512_valign_epi64
// CHECK: @llvm.x86.avx512.mask.valign.q.512
return _mm512_valign_epi64(a, b, 2);
}
__m512d test_mm512_broadcastsd_pd(__m128d a)
{
// CHECK-LABEL: @test_mm512_broadcastsd_pd
// CHECK: insertelement <8 x double> {{.*}}, i32 0
// CHECK: insertelement <8 x double> {{.*}}, i32 1
// CHECK: insertelement <8 x double> {{.*}}, i32 2
// CHECK: insertelement <8 x double> {{.*}}, i32 3
// CHECK: insertelement <8 x double> {{.*}}, i32 4
// CHECK: insertelement <8 x double> {{.*}}, i32 5
// CHECK: insertelement <8 x double> {{.*}}, i32 6
// CHECK: insertelement <8 x double> {{.*}}, i32 7
return _mm512_broadcastsd_pd(a);
}
__m512i test_mm512_fmadd_pd(__m512d a, __m512d b, __m512d c)
{
// CHECK-LABEL: @test_mm512_fmadd_pd
// CHECK: @llvm.x86.fma.mask.vfmadd.pd.512
return _mm512_fmadd_pd(a, b, c);
}
__mmask16 test_mm512_cmpeq_epi32_mask(__m512i __a, __m512i __b) {
// CHECK-LABEL: @test_mm512_cmpeq_epi32_mask
// CHECK: @llvm.x86.avx512.mask.pcmpeq.d.512
return (__mmask16)_mm512_cmpeq_epi32_mask(__a, __b);
}
__mmask16 test_mm512_mask_cmpeq_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
// CHECK-LABEL: @test_mm512_mask_cmpeq_epi32_mask
// CHECK: @llvm.x86.avx512.mask.pcmpeq.d.512
return (__mmask16)_mm512_mask_cmpeq_epi32_mask(__u, __a, __b);
}
__mmask8 test_mm512_mask_cmpeq_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
// CHECK-LABEL: @test_mm512_mask_cmpeq_epi64_mask
// CHECK: @llvm.x86.avx512.mask.pcmpeq.q.512
return (__mmask8)_mm512_mask_cmpeq_epi64_mask(__u, __a, __b);
}
__mmask8 test_mm512_cmpeq_epi64_mask(__m512i __a, __m512i __b) {
// CHECK-LABEL: @test_mm512_cmpeq_epi64_mask
// CHECK: @llvm.x86.avx512.mask.pcmpeq.q.512
return (__mmask8)_mm512_cmpeq_epi64_mask(__a, __b);
}
__m512d test_mm512_unpackhi_pd(__m512d a, __m512d b)
{
// CHECK-LABEL: @test_mm512_unpackhi_pd
// CHECK: shufflevector <8 x double> {{.*}} <i32 1, i32 9, i32 3, i32 11, i32 5, i32 13, i32 7, i32 15>
return _mm512_unpackhi_pd(a, b);
}
__m512d test_mm512_unpacklo_pd(__m512d a, __m512d b)
{
// CHECK-LABEL: @test_mm512_unpacklo_pd
// CHECK: shufflevector <8 x double> {{.*}} <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
return _mm512_unpacklo_pd(a, b);
}
__m512d test_mm512_unpackhi_ps(__m512d a, __m512d b)
{
// CHECK-LABEL: @test_mm512_unpackhi_ps
// CHECK: shufflevector <16 x float> {{.*}} <i32 2, i32 18, i32 3, i32 19, i32 6, i32 22, i32 7, i32 23, i32 10, i32 26, i32 11, i32 27, i32 14, i32 30, i32 15, i32 31>
return _mm512_unpackhi_ps(a, b);
}
__m512d test_mm512_unpacklo_ps(__m512d a, __m512d b)
{
// CHECK-LABEL: @test_mm512_unpacklo_ps
// CHECK: shufflevector <16 x float> {{.*}} <i32 0, i32 16, i32 1, i32 17, i32 4, i32 20, i32 5, i32 21, i32 8, i32 24, i32 9, i32 25, i32 12, i32 28, i32 13, i32 29>
return _mm512_unpacklo_ps(a, b);
}
|