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
2 
3 #include <immintrin.h>
4 
test_mm256_popcnt_epi16(__m256i __A)5 __m256i test_mm256_popcnt_epi16(__m256i __A) {
6   // CHECK-LABEL: @test_mm256_popcnt_epi16
7   // CHECK: @llvm.ctpop.v16i16
8   return _mm256_popcnt_epi16(__A);
9 }
10 
test_mm256_mask_popcnt_epi16(__m256i __A,__mmask16 __U,__m256i __B)11 __m256i test_mm256_mask_popcnt_epi16(__m256i __A, __mmask16 __U, __m256i __B) {
12   // CHECK-LABEL: @test_mm256_mask_popcnt_epi16
13   // CHECK: @llvm.ctpop.v16i16
14   // CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i16> %{{[0-9]+}}, <16 x i16> {{.*}}
15   return _mm256_mask_popcnt_epi16(__A, __U, __B);
16 }
test_mm256_maskz_popcnt_epi16(__mmask16 __U,__m256i __B)17 __m256i test_mm256_maskz_popcnt_epi16(__mmask16 __U, __m256i __B) {
18   // CHECK-LABEL: @test_mm256_maskz_popcnt_epi16
19   // CHECK: @llvm.ctpop.v16i16
20   // CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i16> %{{[0-9]+}}, <16 x i16> {{.*}}
21   return _mm256_maskz_popcnt_epi16(__U, __B);
22 }
23 
test_mm_popcnt_epi16(__m128i __A)24 __m128i test_mm_popcnt_epi16(__m128i __A) {
25   // CHECK-LABEL: @test_mm_popcnt_epi16
26   // CHECK: @llvm.ctpop.v8i16
27   return _mm_popcnt_epi16(__A);
28 }
29 
test_mm_mask_popcnt_epi16(__m128i __A,__mmask8 __U,__m128i __B)30 __m128i test_mm_mask_popcnt_epi16(__m128i __A, __mmask8 __U, __m128i __B) {
31   // CHECK-LABEL: @test_mm_mask_popcnt_epi16
32   // CHECK: @llvm.ctpop.v8i16
33   // CHECK: select <8 x i1> %{{[0-9]+}}, <8 x i16> %{{[0-9]+}}, <8 x i16> {{.*}}
34   return _mm_mask_popcnt_epi16(__A, __U, __B);
35 }
test_mm_maskz_popcnt_epi16(__mmask8 __U,__m128i __B)36 __m128i test_mm_maskz_popcnt_epi16(__mmask8 __U, __m128i __B) {
37   // CHECK-LABEL: @test_mm_maskz_popcnt_epi16
38   // CHECK: @llvm.ctpop.v8i16
39   // CHECK: select <8 x i1> %{{[0-9]+}}, <8 x i16> %{{[0-9]+}}, <8 x i16> {{.*}}
40   return _mm_maskz_popcnt_epi16(__U, __B);
41 }
42 
test_mm256_popcnt_epi8(__m256i __A)43 __m256i test_mm256_popcnt_epi8(__m256i __A) {
44   // CHECK-LABEL: @test_mm256_popcnt_epi8
45   // CHECK: @llvm.ctpop.v32i8
46   return _mm256_popcnt_epi8(__A);
47 }
48 
test_mm256_mask_popcnt_epi8(__m256i __A,__mmask32 __U,__m256i __B)49 __m256i test_mm256_mask_popcnt_epi8(__m256i __A, __mmask32 __U, __m256i __B) {
50   // CHECK-LABEL: @test_mm256_mask_popcnt_epi8
51   // CHECK: @llvm.ctpop.v32i8
52   // CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{[0-9]+}}, <32 x i8> {{.*}}
53   return _mm256_mask_popcnt_epi8(__A, __U, __B);
54 }
test_mm256_maskz_popcnt_epi8(__mmask32 __U,__m256i __B)55 __m256i test_mm256_maskz_popcnt_epi8(__mmask32 __U, __m256i __B) {
56   // CHECK-LABEL: @test_mm256_maskz_popcnt_epi8
57   // CHECK: @llvm.ctpop.v32i8
58   // CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{[0-9]+}}, <32 x i8> {{.*}}
59   return _mm256_maskz_popcnt_epi8(__U, __B);
60 }
61 
test_mm_popcnt_epi8(__m128i __A)62 __m128i test_mm_popcnt_epi8(__m128i __A) {
63   // CHECK-LABEL: @test_mm_popcnt_epi8
64   // CHECK: @llvm.ctpop.v16i8
65   return _mm_popcnt_epi8(__A);
66 }
67 
test_mm_mask_popcnt_epi8(__m128i __A,__mmask16 __U,__m128i __B)68 __m128i test_mm_mask_popcnt_epi8(__m128i __A, __mmask16 __U, __m128i __B) {
69   // CHECK-LABEL: @test_mm_mask_popcnt_epi8
70   // CHECK: @llvm.ctpop.v16i8
71   // CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{[0-9]+}}, <16 x i8> {{.*}}
72   return _mm_mask_popcnt_epi8(__A, __U, __B);
73 }
test_mm_maskz_popcnt_epi8(__mmask16 __U,__m128i __B)74 __m128i test_mm_maskz_popcnt_epi8(__mmask16 __U, __m128i __B) {
75   // CHECK-LABEL: @test_mm_maskz_popcnt_epi8
76   // CHECK: @llvm.ctpop.v16i8
77   // CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{[0-9]+}}, <16 x i8> {{.*}}
78   return _mm_maskz_popcnt_epi8(__U, __B);
79 }
80 
test_mm256_mask_bitshuffle_epi64_mask(__mmask32 __U,__m256i __A,__m256i __B)81 __mmask32 test_mm256_mask_bitshuffle_epi64_mask(__mmask32 __U, __m256i __A, __m256i __B) {
82   // CHECK-LABEL: @test_mm256_mask_bitshuffle_epi64_mask
83   // CHECK: @llvm.x86.avx512.vpshufbitqmb.256
84   // CHECK: and <32 x i1> %{{.*}}, %{{.*}}
85   return _mm256_mask_bitshuffle_epi64_mask(__U, __A, __B);
86 }
87 
test_mm256_bitshuffle_epi64_mask(__m256i __A,__m256i __B)88 __mmask32 test_mm256_bitshuffle_epi64_mask(__m256i __A, __m256i __B) {
89   // CHECK-LABEL: @test_mm256_bitshuffle_epi64_mask
90   // CHECK: @llvm.x86.avx512.vpshufbitqmb.256
91   return _mm256_bitshuffle_epi64_mask(__A, __B);
92 }
93 
test_mm_mask_bitshuffle_epi64_mask(__mmask16 __U,__m128i __A,__m128i __B)94 __mmask16 test_mm_mask_bitshuffle_epi64_mask(__mmask16 __U, __m128i __A, __m128i __B) {
95   // CHECK-LABEL: @test_mm_mask_bitshuffle_epi64_mask
96   // CHECK: @llvm.x86.avx512.vpshufbitqmb.128
97   // CHECK: and <16 x i1> %{{.*}}, %{{.*}}
98   return _mm_mask_bitshuffle_epi64_mask(__U, __A, __B);
99 }
100 
test_mm_bitshuffle_epi64_mask(__m128i __A,__m128i __B)101 __mmask16 test_mm_bitshuffle_epi64_mask(__m128i __A, __m128i __B) {
102   // CHECK-LABEL: @test_mm_bitshuffle_epi64_mask
103   // CHECK: @llvm.x86.avx512.vpshufbitqmb.128
104   return _mm_bitshuffle_epi64_mask(__A, __B);
105 }
106 
107