Skip to content

Commit f15fe73

Browse files
committed
[clang][x86] Update AVX2 intrinsic tests for both C/C++
Requires some call instructions to handle additional markers
1 parent aa4d948 commit f15fe73

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

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

Lines changed: 32 additions & 28 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 +avx2 -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 +avx2 -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 +avx2 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X86
4-
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +avx2 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X86
1+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx2 -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 +avx2 -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 +avx2 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X86
4+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +avx2 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X86
5+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx2 -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 +avx2 -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 +avx2 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X86
8+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +avx2 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X86
59

610

711
#include <immintrin.h>
@@ -457,28 +461,28 @@ __m256i test_mm256_mask_i32gather_epi32(__m256i a, int const *b, __m256i c, __m2
457461

458462
__m128i test_mm_i32gather_epi64(long long const *b, __m128i c) {
459463
// CHECK-LABEL: test_mm_i32gather_epi64
460-
// CHECK: call <2 x i64> @llvm.x86.avx2.gather.d.q(<2 x i64> zeroinitializer, ptr %{{.*}}, <4 x i32> %{{.*}}, <2 x i64> %{{.*}}, i8 2)
464+
// CHECK: call {{.*}}<2 x i64> @llvm.x86.avx2.gather.d.q(<2 x i64> zeroinitializer, ptr %{{.*}}, <4 x i32> %{{.*}}, <2 x i64> %{{.*}}, i8 2)
461465
return _mm_i32gather_epi64(b, c, 2);
462466
}
463467

464468
__m128i test_mm_mask_i32gather_epi64(__m128i a, long long const *b, __m128i c, __m128i d) {
465469
// CHECK-LABEL: test_mm_mask_i32gather_epi64
466-
// CHECK: call <2 x i64> @llvm.x86.avx2.gather.d.q(<2 x i64> %{{.*}}, ptr %{{.*}}, <4 x i32> %{{.*}}, <2 x i64> %{{.*}}, i8 2)
470+
// CHECK: call {{.*}}<2 x i64> @llvm.x86.avx2.gather.d.q(<2 x i64> %{{.*}}, ptr %{{.*}}, <4 x i32> %{{.*}}, <2 x i64> %{{.*}}, i8 2)
467471
return _mm_mask_i32gather_epi64(a, b, c, d, 2);
468472
}
469473

470474
__m256i test_mm256_i32gather_epi64(long long const *b, __m128i c) {
471475
// X64-LABEL: test_mm256_i32gather_epi64
472-
// X64: call <4 x i64> @llvm.x86.avx2.gather.d.q.256(<4 x i64> zeroinitializer, ptr %{{.*}}, <4 x i32> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
476+
// X64: call {{.*}}<4 x i64> @llvm.x86.avx2.gather.d.q.256(<4 x i64> zeroinitializer, ptr %{{.*}}, <4 x i32> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
473477
//
474478
// X86-LABEL: test_mm256_i32gather_epi64
475-
// X86: call <4 x i64> @llvm.x86.avx2.gather.d.q.256(<4 x i64> %{{.*}}, ptr %{{.*}}, <4 x i32> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
479+
// X86: call {{.*}}<4 x i64> @llvm.x86.avx2.gather.d.q.256(<4 x i64> %{{.*}}, ptr %{{.*}}, <4 x i32> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
476480
return _mm256_i32gather_epi64(b, c, 2);
477481
}
478482

479483
__m256i test_mm256_mask_i32gather_epi64(__m256i a, long long const *b, __m128i c, __m256i d) {
480484
// CHECK-LABEL: test_mm256_mask_i32gather_epi64
481-
// CHECK: call <4 x i64> @llvm.x86.avx2.gather.d.q.256(<4 x i64> %{{.*}}, ptr %{{.*}}, <4 x i32> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
485+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.gather.d.q.256(<4 x i64> %{{.*}}, ptr %{{.*}}, <4 x i32> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
482486
return _mm256_mask_i32gather_epi64(a, b, c, d, 2);
483487
}
484488

@@ -592,28 +596,28 @@ __m128i test_mm256_mask_i64gather_epi32(__m128i a, int const *b, __m256i c, __m1
592596

593597
__m128i test_mm_i64gather_epi64(long long const *b, __m128i c) {
594598
// CHECK-LABEL: test_mm_i64gather_epi64
595-
// CHECK: call <2 x i64> @llvm.x86.avx2.gather.q.q(<2 x i64> zeroinitializer, ptr %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, i8 2)
599+
// CHECK: call {{.*}}<2 x i64> @llvm.x86.avx2.gather.q.q(<2 x i64> zeroinitializer, ptr %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, i8 2)
596600
return _mm_i64gather_epi64(b, c, 2);
597601
}
598602

599603
__m128i test_mm_mask_i64gather_epi64(__m128i a, long long const *b, __m128i c, __m128i d) {
600604
// CHECK-LABEL: test_mm_mask_i64gather_epi64
601-
// CHECK: call <2 x i64> @llvm.x86.avx2.gather.q.q(<2 x i64> %{{.*}}, ptr %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, i8 2)
605+
// CHECK: call {{.*}}<2 x i64> @llvm.x86.avx2.gather.q.q(<2 x i64> %{{.*}}, ptr %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, i8 2)
602606
return _mm_mask_i64gather_epi64(a, b, c, d, 2);
603607
}
604608

605609
__m256i test_mm256_i64gather_epi64(long long const *b, __m256i c) {
606610
// X64-LABEL: test_mm256_i64gather_epi64
607-
// X64: call <4 x i64> @llvm.x86.avx2.gather.q.q.256(<4 x i64> zeroinitializer, ptr %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
611+
// X64: call {{.*}}<4 x i64> @llvm.x86.avx2.gather.q.q.256(<4 x i64> zeroinitializer, ptr %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
608612
//
609613
// X86-LABEL: test_mm256_i64gather_epi64
610-
// X86: call <4 x i64> @llvm.x86.avx2.gather.q.q.256(<4 x i64> %{{.*}}, ptr %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
614+
// X86: call {{.*}}<4 x i64> @llvm.x86.avx2.gather.q.q.256(<4 x i64> %{{.*}}, ptr %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
611615
return _mm256_i64gather_epi64(b, c, 2);
612616
}
613617

614618
__m256i test_mm256_mask_i64gather_epi64(__m256i a, long long const *b, __m256i c, __m256i d) {
615619
// CHECK-LABEL: test_mm256_mask_i64gather_epi64
616-
// CHECK: call <4 x i64> @llvm.x86.avx2.gather.q.q.256(<4 x i64> %{{.*}}, ptr %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
620+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.gather.q.q.256(<4 x i64> %{{.*}}, ptr %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, i8 2)
617621
return _mm256_mask_i64gather_epi64(a, b, c, d, 2);
618622
}
619623

@@ -745,13 +749,13 @@ __m256i test_mm256_maskload_epi32(int const *a, __m256i m) {
745749

746750
__m128i test_mm_maskload_epi64(long long const *a, __m128i m) {
747751
// CHECK-LABEL: test_mm_maskload_epi64
748-
// CHECK: call <2 x i64> @llvm.x86.avx2.maskload.q(ptr %{{.*}}, <2 x i64> %{{.*}})
752+
// CHECK: call {{.*}}<2 x i64> @llvm.x86.avx2.maskload.q(ptr %{{.*}}, <2 x i64> %{{.*}})
749753
return _mm_maskload_epi64(a, m);
750754
}
751755

752756
__m256i test_mm256_maskload_epi64(long long const *a, __m256i m) {
753757
// CHECK-LABEL: test_mm256_maskload_epi64
754-
// CHECK: call <4 x i64> @llvm.x86.avx2.maskload.q.256(ptr %{{.*}}, <4 x i64> %{{.*}})
758+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.maskload.q.256(ptr %{{.*}}, <4 x i64> %{{.*}})
755759
return _mm256_maskload_epi64(a, m);
756760
}
757761

@@ -853,7 +857,7 @@ __m256i test_mm256_min_epu32(__m256i a, __m256i b) {
853857

854858
int test_mm256_movemask_epi8(__m256i a) {
855859
// CHECK-LABEL: test_mm256_movemask_epi8
856-
// CHECK: call i32 @llvm.x86.avx2.pmovmskb(<32 x i8> %{{.*}})
860+
// CHECK: call {{.*}}i32 @llvm.x86.avx2.pmovmskb(<32 x i8> %{{.*}})
857861
return _mm256_movemask_epi8(a);
858862
}
859863

@@ -967,13 +971,13 @@ __m256i test_mm256_permutevar8x32_epi32(__m256i a, __m256i b) {
967971

968972
__m256 test_mm256_permutevar8x32_ps(__m256 a, __m256i b) {
969973
// CHECK-LABEL: test_mm256_permutevar8x32_ps
970-
// CHECK: call <8 x float> @llvm.x86.avx2.permps(<8 x float> %{{.*}}, <8 x i32> %{{.*}})
974+
// CHECK: call {{.*}}<8 x float> @llvm.x86.avx2.permps(<8 x float> %{{.*}}, <8 x i32> %{{.*}})
971975
return _mm256_permutevar8x32_ps(a, b);
972976
}
973977

974978
__m256i test_mm256_sad_epu8(__m256i x, __m256i y) {
975979
// CHECK-LABEL: test_mm256_sad_epu8
976-
// CHECK: call <4 x i64> @llvm.x86.avx2.psad.bw(<32 x i8> %{{.*}}, <32 x i8> %{{.*}})
980+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.psad.bw(<32 x i8> %{{.*}}, <32 x i8> %{{.*}})
977981
return _mm256_sad_epu8(x, y);
978982
}
979983

@@ -1045,13 +1049,13 @@ __m256i test_mm256_slli_epi32_2(__m256i a, int b) {
10451049

10461050
__m256i test_mm256_slli_epi64(__m256i a) {
10471051
// CHECK-LABEL: test_mm256_slli_epi64
1048-
// CHECK: call <4 x i64> @llvm.x86.avx2.pslli.q(<4 x i64> %{{.*}}, i32 %{{.*}})
1052+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.pslli.q(<4 x i64> %{{.*}}, i32 %{{.*}})
10491053
return _mm256_slli_epi64(a, 3);
10501054
}
10511055

10521056
__m256i test_mm256_slli_epi64_2(__m256i a, int b) {
10531057
// CHECK-LABEL: test_mm256_slli_epi64_2
1054-
// CHECK: call <4 x i64> @llvm.x86.avx2.pslli.q(<4 x i64> %{{.*}}, i32 %{{.*}})
1058+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.pslli.q(<4 x i64> %{{.*}}, i32 %{{.*}})
10551059
return _mm256_slli_epi64(a, b);
10561060
}
10571061

@@ -1075,13 +1079,13 @@ __m256i test_mm256_sllv_epi32(__m256i a, __m256i b) {
10751079

10761080
__m128i test_mm_sllv_epi64(__m128i a, __m128i b) {
10771081
// CHECK-LABEL: test_mm_sllv_epi64
1078-
// CHECK: call <2 x i64> @llvm.x86.avx2.psllv.q(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
1082+
// CHECK: call {{.*}}<2 x i64> @llvm.x86.avx2.psllv.q(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
10791083
return _mm_sllv_epi64(a, b);
10801084
}
10811085

10821086
__m256i test_mm256_sllv_epi64(__m256i a, __m256i b) {
10831087
// CHECK-LABEL: test_mm256_sllv_epi64
1084-
// CHECK: call <4 x i64> @llvm.x86.avx2.psllv.q.256(<4 x i64> %{{.*}}, <4 x i64> %{{.*}})
1088+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.psllv.q.256(<4 x i64> %{{.*}}, <4 x i64> %{{.*}})
10851089
return _mm256_sllv_epi64(a, b);
10861090
}
10871091

@@ -1147,7 +1151,7 @@ __m256i test_mm256_srl_epi32(__m256i a, __m128i b) {
11471151

11481152
__m256i test_mm256_srl_epi64(__m256i a, __m128i b) {
11491153
// CHECK-LABEL: test_mm256_srl_epi64
1150-
// CHECK: call <4 x i64> @llvm.x86.avx2.psrl.q(<4 x i64> %{{.*}}, <2 x i64> %{{.*}})
1154+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.psrl.q(<4 x i64> %{{.*}}, <2 x i64> %{{.*}})
11511155
return _mm256_srl_epi64(a, b);
11521156
}
11531157

@@ -1177,13 +1181,13 @@ __m256i test_mm256_srli_epi32_2(__m256i a, int b) {
11771181

11781182
__m256i test_mm256_srli_epi64(__m256i a) {
11791183
// CHECK-LABEL: test_mm256_srli_epi64
1180-
// CHECK: call <4 x i64> @llvm.x86.avx2.psrli.q(<4 x i64> %{{.*}}, i32 %{{.*}})
1184+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.psrli.q(<4 x i64> %{{.*}}, i32 %{{.*}})
11811185
return _mm256_srli_epi64(a, 3);
11821186
}
11831187

11841188
__m256i test_mm256_srli_epi64_2(__m256i a, int b) {
11851189
// CHECK-LABEL: test_mm256_srli_epi64_2
1186-
// CHECK: call <4 x i64> @llvm.x86.avx2.psrli.q(<4 x i64> %{{.*}}, i32 %{{.*}})
1190+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.psrli.q(<4 x i64> %{{.*}}, i32 %{{.*}})
11871191
return _mm256_srli_epi64(a, b);
11881192
}
11891193

@@ -1207,13 +1211,13 @@ __m256i test_mm256_srlv_epi32(__m256i a, __m256i b) {
12071211

12081212
__m128i test_mm_srlv_epi64(__m128i a, __m128i b) {
12091213
// CHECK-LABEL: test_mm_srlv_epi64
1210-
// CHECK: call <2 x i64> @llvm.x86.avx2.psrlv.q(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
1214+
// CHECK: call {{.*}}<2 x i64> @llvm.x86.avx2.psrlv.q(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
12111215
return _mm_srlv_epi64(a, b);
12121216
}
12131217

12141218
__m256i test_mm256_srlv_epi64(__m256i a, __m256i b) {
12151219
// CHECK-LABEL: test_mm256_srlv_epi64
1216-
// CHECK: call <4 x i64> @llvm.x86.avx2.psrlv.q.256(<4 x i64> %{{.*}}, <4 x i64> %{{.*}})
1220+
// CHECK: call {{.*}}<4 x i64> @llvm.x86.avx2.psrlv.q.256(<4 x i64> %{{.*}}, <4 x i64> %{{.*}})
12171221
return _mm256_srlv_epi64(a, b);
12181222
}
12191223

0 commit comments

Comments
 (0)