Skip to content

Commit 1e9ed91

Browse files
authored
[X86][AVX512BITALG] add C/C++ and 32/64-bit builtins test coverage (#152693)
1 parent 672f82a commit 1e9ed91

File tree

2 files changed

+32
-26
lines changed

2 files changed

+32
-26
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,57 @@
1-
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512bitalg -emit-llvm -o - -Wall -Werror | FileCheck %s
1+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512bitalg -emit-llvm -o - -Wall -Werror | FileCheck %s
2+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +avx512bitalg -emit-llvm -o - -Wall -Werror | FileCheck %s
3+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512bitalg -emit-llvm -o - -Wall -Werror | FileCheck %s
4+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +avx512bitalg -emit-llvm -o - -Wall -Werror | FileCheck %s
25

36
#include <immintrin.h>
47

58
__m512i test_mm512_popcnt_epi16(__m512i __A) {
6-
// CHECK-LABEL: @test_mm512_popcnt_epi16
9+
// CHECK-LABEL: test_mm512_popcnt_epi16
710
// CHECK: @llvm.ctpop.v32i16
811
return _mm512_popcnt_epi16(__A);
912
}
1013

1114
__m512i test_mm512_mask_popcnt_epi16(__m512i __A, __mmask32 __U, __m512i __B) {
12-
// CHECK-LABEL: @test_mm512_mask_popcnt_epi16
15+
// CHECK-LABEL: test_mm512_mask_popcnt_epi16
1316
// CHECK: @llvm.ctpop.v32i16
1417
// CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
1518
return _mm512_mask_popcnt_epi16(__A, __U, __B);
1619
}
1720
__m512i test_mm512_maskz_popcnt_epi16(__mmask32 __U, __m512i __B) {
18-
// CHECK-LABEL: @test_mm512_maskz_popcnt_epi16
21+
// CHECK-LABEL: test_mm512_maskz_popcnt_epi16
1922
// CHECK: @llvm.ctpop.v32i16
2023
// CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
2124
return _mm512_maskz_popcnt_epi16(__U, __B);
2225
}
2326

2427
__m512i test_mm512_popcnt_epi8(__m512i __A) {
25-
// CHECK-LABEL: @test_mm512_popcnt_epi8
28+
// CHECK-LABEL: test_mm512_popcnt_epi8
2629
// CHECK: @llvm.ctpop.v64i8
2730
return _mm512_popcnt_epi8(__A);
2831
}
2932

3033
__m512i test_mm512_mask_popcnt_epi8(__m512i __A, __mmask64 __U, __m512i __B) {
31-
// CHECK-LABEL: @test_mm512_mask_popcnt_epi8
34+
// CHECK-LABEL: test_mm512_mask_popcnt_epi8
3235
// CHECK: @llvm.ctpop.v64i8
3336
// CHECK: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{.*}}, <64 x i8> %{{.*}}
3437
return _mm512_mask_popcnt_epi8(__A, __U, __B);
3538
}
3639
__m512i test_mm512_maskz_popcnt_epi8(__mmask64 __U, __m512i __B) {
37-
// CHECK-LABEL: @test_mm512_maskz_popcnt_epi8
40+
// CHECK-LABEL: test_mm512_maskz_popcnt_epi8
3841
// CHECK: @llvm.ctpop.v64i8
3942
// CHECK: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{.*}}, <64 x i8> %{{.*}}
4043
return _mm512_maskz_popcnt_epi8(__U, __B);
4144
}
4245

4346
__mmask64 test_mm512_mask_bitshuffle_epi64_mask(__mmask64 __U, __m512i __A, __m512i __B) {
44-
// CHECK-LABEL: @test_mm512_mask_bitshuffle_epi64_mask
47+
// CHECK-LABEL: test_mm512_mask_bitshuffle_epi64_mask
4548
// CHECK: @llvm.x86.avx512.vpshufbitqmb.512
4649
// CHECK: and <64 x i1> %{{.*}}, %{{.*}}
4750
return _mm512_mask_bitshuffle_epi64_mask(__U, __A, __B);
4851
}
4952

5053
__mmask64 test_mm512_bitshuffle_epi64_mask(__m512i __A, __m512i __B) {
51-
// CHECK-LABEL: @test_mm512_bitshuffle_epi64_mask
54+
// CHECK-LABEL: test_mm512_bitshuffle_epi64_mask
5255
// CHECK: @llvm.x86.avx512.vpshufbitqmb.512
5356
return _mm512_bitshuffle_epi64_mask(__A, __B);
5457
}

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

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,108 @@
1-
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512bitalg -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
1+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512bitalg -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
2+
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +avx512bitalg -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
3+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512bitalg -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
4+
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +avx512bitalg -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
25

36
#include <immintrin.h>
47

58
__m256i test_mm256_popcnt_epi16(__m256i __A) {
6-
// CHECK-LABEL: @test_mm256_popcnt_epi16
9+
// CHECK-LABEL: test_mm256_popcnt_epi16
710
// CHECK: @llvm.ctpop.v16i16
811
return _mm256_popcnt_epi16(__A);
912
}
1013

1114
__m256i test_mm256_mask_popcnt_epi16(__m256i __A, __mmask16 __U, __m256i __B) {
12-
// CHECK-LABEL: @test_mm256_mask_popcnt_epi16
15+
// CHECK-LABEL: test_mm256_mask_popcnt_epi16
1316
// CHECK: @llvm.ctpop.v16i16
1417
// CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
1518
return _mm256_mask_popcnt_epi16(__A, __U, __B);
1619
}
1720
__m256i test_mm256_maskz_popcnt_epi16(__mmask16 __U, __m256i __B) {
18-
// CHECK-LABEL: @test_mm256_maskz_popcnt_epi16
21+
// CHECK-LABEL: test_mm256_maskz_popcnt_epi16
1922
// CHECK: @llvm.ctpop.v16i16
2023
// CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
2124
return _mm256_maskz_popcnt_epi16(__U, __B);
2225
}
2326

2427
__m128i test_mm_popcnt_epi16(__m128i __A) {
25-
// CHECK-LABEL: @test_mm_popcnt_epi16
28+
// CHECK-LABEL: test_mm_popcnt_epi16
2629
// CHECK: @llvm.ctpop.v8i16
2730
return _mm_popcnt_epi16(__A);
2831
}
2932

3033
__m128i test_mm_mask_popcnt_epi16(__m128i __A, __mmask8 __U, __m128i __B) {
31-
// CHECK-LABEL: @test_mm_mask_popcnt_epi16
34+
// CHECK-LABEL: test_mm_mask_popcnt_epi16
3235
// CHECK: @llvm.ctpop.v8i16
3336
// CHECK: select <8 x i1> %{{[0-9]+}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
3437
return _mm_mask_popcnt_epi16(__A, __U, __B);
3538
}
3639
__m128i test_mm_maskz_popcnt_epi16(__mmask8 __U, __m128i __B) {
37-
// CHECK-LABEL: @test_mm_maskz_popcnt_epi16
40+
// CHECK-LABEL: test_mm_maskz_popcnt_epi16
3841
// CHECK: @llvm.ctpop.v8i16
3942
// CHECK: select <8 x i1> %{{[0-9]+}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
4043
return _mm_maskz_popcnt_epi16(__U, __B);
4144
}
4245

4346
__m256i test_mm256_popcnt_epi8(__m256i __A) {
44-
// CHECK-LABEL: @test_mm256_popcnt_epi8
47+
// CHECK-LABEL: test_mm256_popcnt_epi8
4548
// CHECK: @llvm.ctpop.v32i8
4649
return _mm256_popcnt_epi8(__A);
4750
}
4851

4952
__m256i test_mm256_mask_popcnt_epi8(__m256i __A, __mmask32 __U, __m256i __B) {
50-
// CHECK-LABEL: @test_mm256_mask_popcnt_epi8
53+
// CHECK-LABEL: test_mm256_mask_popcnt_epi8
5154
// CHECK: @llvm.ctpop.v32i8
5255
// CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{.*}}, <32 x i8> %{{.*}}
5356
return _mm256_mask_popcnt_epi8(__A, __U, __B);
5457
}
5558
__m256i test_mm256_maskz_popcnt_epi8(__mmask32 __U, __m256i __B) {
56-
// CHECK-LABEL: @test_mm256_maskz_popcnt_epi8
59+
// CHECK-LABEL: test_mm256_maskz_popcnt_epi8
5760
// CHECK: @llvm.ctpop.v32i8
5861
// CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{.*}}, <32 x i8> %{{.*}}
5962
return _mm256_maskz_popcnt_epi8(__U, __B);
6063
}
6164

6265
__m128i test_mm_popcnt_epi8(__m128i __A) {
63-
// CHECK-LABEL: @test_mm_popcnt_epi8
66+
// CHECK-LABEL: test_mm_popcnt_epi8
6467
// CHECK: @llvm.ctpop.v16i8
6568
return _mm_popcnt_epi8(__A);
6669
}
6770

6871
__m128i test_mm_mask_popcnt_epi8(__m128i __A, __mmask16 __U, __m128i __B) {
69-
// CHECK-LABEL: @test_mm_mask_popcnt_epi8
72+
// CHECK-LABEL: test_mm_mask_popcnt_epi8
7073
// CHECK: @llvm.ctpop.v16i8
7174
// CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}
7275
return _mm_mask_popcnt_epi8(__A, __U, __B);
7376
}
7477
__m128i test_mm_maskz_popcnt_epi8(__mmask16 __U, __m128i __B) {
75-
// CHECK-LABEL: @test_mm_maskz_popcnt_epi8
78+
// CHECK-LABEL: test_mm_maskz_popcnt_epi8
7679
// CHECK: @llvm.ctpop.v16i8
7780
// CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}
7881
return _mm_maskz_popcnt_epi8(__U, __B);
7982
}
8083

8184
__mmask32 test_mm256_mask_bitshuffle_epi64_mask(__mmask32 __U, __m256i __A, __m256i __B) {
82-
// CHECK-LABEL: @test_mm256_mask_bitshuffle_epi64_mask
85+
// CHECK-LABEL: test_mm256_mask_bitshuffle_epi64_mask
8386
// CHECK: @llvm.x86.avx512.vpshufbitqmb.256
8487
// CHECK: and <32 x i1> %{{.*}}, %{{.*}}
8588
return _mm256_mask_bitshuffle_epi64_mask(__U, __A, __B);
8689
}
8790

8891
__mmask32 test_mm256_bitshuffle_epi64_mask(__m256i __A, __m256i __B) {
89-
// CHECK-LABEL: @test_mm256_bitshuffle_epi64_mask
92+
// CHECK-LABEL: test_mm256_bitshuffle_epi64_mask
9093
// CHECK: @llvm.x86.avx512.vpshufbitqmb.256
9194
return _mm256_bitshuffle_epi64_mask(__A, __B);
9295
}
9396

9497
__mmask16 test_mm_mask_bitshuffle_epi64_mask(__mmask16 __U, __m128i __A, __m128i __B) {
95-
// CHECK-LABEL: @test_mm_mask_bitshuffle_epi64_mask
98+
// CHECK-LABEL: test_mm_mask_bitshuffle_epi64_mask
9699
// CHECK: @llvm.x86.avx512.vpshufbitqmb.128
97100
// CHECK: and <16 x i1> %{{.*}}, %{{.*}}
98101
return _mm_mask_bitshuffle_epi64_mask(__U, __A, __B);
99102
}
100103

101104
__mmask16 test_mm_bitshuffle_epi64_mask(__m128i __A, __m128i __B) {
102-
// CHECK-LABEL: @test_mm_bitshuffle_epi64_mask
105+
// CHECK-LABEL: test_mm_bitshuffle_epi64_mask
103106
// CHECK: @llvm.x86.avx512.vpshufbitqmb.128
104107
return _mm_bitshuffle_epi64_mask(__A, __B);
105108
}

0 commit comments

Comments
 (0)