Skip to content

Commit 44df106

Browse files
committed
[clang][x86] Update SSE41 intrinsic tests for both C/C++
Requires some better checking of labels and some call instructions to handle additional markers
1 parent 7c50c1e commit 44df106

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

clang/test/CodeGen/X86/sse41-builtins.c

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64
2-
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64
3-
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
4-
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
1+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64
2+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64
3+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
4+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
5+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64
6+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64
7+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
8+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
59

610

711
#include <immintrin.h>
@@ -34,37 +38,37 @@ __m128i test_mm_blendv_epi8(__m128i V1, __m128i V2, __m128i V3) {
3438

3539
__m128d test_mm_blendv_pd(__m128d V1, __m128d V2, __m128d V3) {
3640
// CHECK-LABEL: test_mm_blendv_pd
37-
// CHECK: call <2 x double> @llvm.x86.sse41.blendvpd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}})
41+
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.blendvpd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}})
3842
return _mm_blendv_pd(V1, V2, V3);
3943
}
4044

4145
__m128 test_mm_blendv_ps(__m128 V1, __m128 V2, __m128 V3) {
4246
// CHECK-LABEL: test_mm_blendv_ps
43-
// CHECK: call <4 x float> @llvm.x86.sse41.blendvps(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})
47+
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.blendvps(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})
4448
return _mm_blendv_ps(V1, V2, V3);
4549
}
4650

4751
__m128d test_mm_ceil_pd(__m128d x) {
4852
// CHECK-LABEL: test_mm_ceil_pd
49-
// CHECK: call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 2)
53+
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 2)
5054
return _mm_ceil_pd(x);
5155
}
5256

5357
__m128 test_mm_ceil_ps(__m128 x) {
5458
// CHECK-LABEL: test_mm_ceil_ps
55-
// CHECK: call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 2)
59+
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 2)
5660
return _mm_ceil_ps(x);
5761
}
5862

5963
__m128d test_mm_ceil_sd(__m128d x, __m128d y) {
6064
// CHECK-LABEL: test_mm_ceil_sd
61-
// CHECK: call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 2)
65+
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 2)
6266
return _mm_ceil_sd(x, y);
6367
}
6468

6569
__m128 test_mm_ceil_ss(__m128 x, __m128 y) {
6670
// CHECK-LABEL: test_mm_ceil_ss
67-
// CHECK: call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 2)
71+
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 2)
6872
return _mm_ceil_ss(x, y);
6973
}
7074

@@ -161,13 +165,13 @@ __m128i test_mm_cvtepu32_epi64(__m128i a) {
161165

162166
__m128d test_mm_dp_pd(__m128d x, __m128d y) {
163167
// CHECK-LABEL: test_mm_dp_pd
164-
// CHECK: call <2 x double> @llvm.x86.sse41.dppd(<2 x double> {{.*}}, <2 x double> {{.*}}, i8 7)
168+
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.dppd(<2 x double> {{.*}}, <2 x double> {{.*}}, i8 7)
165169
return _mm_dp_pd(x, y, 7);
166170
}
167171

168172
__m128 test_mm_dp_ps(__m128 x, __m128 y) {
169173
// CHECK-LABEL: test_mm_dp_ps
170-
// CHECK: call <4 x float> @llvm.x86.sse41.dpps(<4 x float> {{.*}}, <4 x float> {{.*}}, i8 7)
174+
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.dpps(<4 x float> {{.*}}, <4 x float> {{.*}}, i8 7)
171175
return _mm_dp_ps(x, y, 7);
172176
}
173177

@@ -198,25 +202,25 @@ int test_mm_extract_ps(__m128 x) {
198202

199203
__m128d test_mm_floor_pd(__m128d x) {
200204
// CHECK-LABEL: test_mm_floor_pd
201-
// CHECK: call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 1)
205+
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 1)
202206
return _mm_floor_pd(x);
203207
}
204208

205209
__m128 test_mm_floor_ps(__m128 x) {
206210
// CHECK-LABEL: test_mm_floor_ps
207-
// CHECK: call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 1)
211+
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 1)
208212
return _mm_floor_ps(x);
209213
}
210214

211215
__m128d test_mm_floor_sd(__m128d x, __m128d y) {
212216
// CHECK-LABEL: test_mm_floor_sd
213-
// CHECK: call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 1)
217+
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 1)
214218
return _mm_floor_sd(x, y);
215219
}
216220

217221
__m128 test_mm_floor_ss(__m128 x, __m128 y) {
218222
// CHECK-LABEL: test_mm_floor_ss
219-
// CHECK: call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 1)
223+
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 1)
220224
return _mm_floor_ss(x, y);
221225
}
222226

@@ -242,7 +246,7 @@ __m128i test_mm_insert_epi64(__m128i x, long long b) {
242246

243247
__m128 test_mm_insert_ps(__m128 x, __m128 y) {
244248
// CHECK-LABEL: test_mm_insert_ps
245-
// CHECK: call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 4)
249+
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.insertps(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 4)
246250
return _mm_insert_ps(x, y, 4);
247251
}
248252

@@ -330,25 +334,25 @@ __m128i test_mm_packus_epi32(__m128i x, __m128i y) {
330334

331335
__m128d test_mm_round_pd(__m128d x) {
332336
// CHECK-LABEL: test_mm_round_pd
333-
// CHECK: call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 4)
337+
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 4)
334338
return _mm_round_pd(x, 4);
335339
}
336340

337341
__m128 test_mm_round_ps(__m128 x) {
338342
// CHECK-LABEL: test_mm_round_ps
339-
// CHECK: call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 4)
343+
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 4)
340344
return _mm_round_ps(x, 4);
341345
}
342346

343347
__m128d test_mm_round_sd(__m128d x, __m128d y) {
344348
// CHECK-LABEL: test_mm_round_sd
345-
// CHECK: call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 4)
349+
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 4)
346350
return _mm_round_sd(x, y, 4);
347351
}
348352

349353
__m128 test_mm_round_ss(__m128 x, __m128 y) {
350354
// CHECK-LABEL: test_mm_round_ss
351-
// CHECK: call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 4)
355+
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 4)
352356
return _mm_round_ss(x, y, 4);
353357
}
354358

@@ -366,37 +370,37 @@ __m128i test_mm_stream_load_si128_void(const void *a) {
366370

367371
int test_mm_test_all_ones(__m128i x) {
368372
// CHECK-LABEL: test_mm_test_all_ones
369-
// CHECK: call i32 @llvm.x86.sse41.ptestc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
373+
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
370374
return _mm_test_all_ones(x);
371375
}
372376

373377
int test_mm_test_all_zeros(__m128i x, __m128i y) {
374378
// CHECK-LABEL: test_mm_test_all_zeros
375-
// CHECK: call i32 @llvm.x86.sse41.ptestz(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
379+
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestz(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
376380
return _mm_test_all_zeros(x, y);
377381
}
378382

379383
int test_mm_test_mix_ones_zeros(__m128i x, __m128i y) {
380384
// CHECK-LABEL: test_mm_test_mix_ones_zeros
381-
// CHECK: call i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
385+
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
382386
return _mm_test_mix_ones_zeros(x, y);
383387
}
384388

385389
int test_mm_testc_si128(__m128i x, __m128i y) {
386390
// CHECK-LABEL: test_mm_testc_si128
387-
// CHECK: call i32 @llvm.x86.sse41.ptestc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
391+
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
388392
return _mm_testc_si128(x, y);
389393
}
390394

391395
int test_mm_testnzc_si128(__m128i x, __m128i y) {
392396
// CHECK-LABEL: test_mm_testnzc_si128
393-
// CHECK: call i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
397+
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
394398
return _mm_testnzc_si128(x, y);
395399
}
396400

397401
int test_mm_testz_si128(__m128i x, __m128i y) {
398402
// CHECK-LABEL: test_mm_testz_si128
399-
// CHECK: call i32 @llvm.x86.sse41.ptestz(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
403+
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestz(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
400404
return _mm_testz_si128(x, y);
401405
}
402406

0 commit comments

Comments
 (0)