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
2 
3 #include <immintrin.h>
4 
test_mm512_popcnt_epi16(__m512i __A)5 __m512i test_mm512_popcnt_epi16(__m512i __A) {
6   // CHECK-LABEL: @test_mm512_popcnt_epi16
7   // CHECK: @llvm.ctpop.v32i16
8   return _mm512_popcnt_epi16(__A);
9 }
10 
test_mm512_mask_popcnt_epi16(__m512i __A,__mmask32 __U,__m512i __B)11 __m512i test_mm512_mask_popcnt_epi16(__m512i __A, __mmask32 __U, __m512i __B) {
12   // CHECK-LABEL: @test_mm512_mask_popcnt_epi16
13   // CHECK: @llvm.ctpop.v32i16
14   // CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i16> %{{[0-9]+}}, <32 x i16> {{.*}}
15   return _mm512_mask_popcnt_epi16(__A, __U, __B);
16 }
test_mm512_maskz_popcnt_epi16(__mmask32 __U,__m512i __B)17 __m512i test_mm512_maskz_popcnt_epi16(__mmask32 __U, __m512i __B) {
18   // CHECK-LABEL: @test_mm512_maskz_popcnt_epi16
19   // CHECK: @llvm.ctpop.v32i16
20   // CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i16> %{{[0-9]+}}, <32 x i16> {{.*}}
21   return _mm512_maskz_popcnt_epi16(__U, __B);
22 }
23 
test_mm512_popcnt_epi8(__m512i __A)24 __m512i test_mm512_popcnt_epi8(__m512i __A) {
25   // CHECK-LABEL: @test_mm512_popcnt_epi8
26   // CHECK: @llvm.ctpop.v64i8
27   return _mm512_popcnt_epi8(__A);
28 }
29 
test_mm512_mask_popcnt_epi8(__m512i __A,__mmask64 __U,__m512i __B)30 __m512i test_mm512_mask_popcnt_epi8(__m512i __A, __mmask64 __U, __m512i __B) {
31   // CHECK-LABEL: @test_mm512_mask_popcnt_epi8
32   // CHECK: @llvm.ctpop.v64i8
33   // CHECK: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{[0-9]+}}, <64 x i8> {{.*}}
34   return _mm512_mask_popcnt_epi8(__A, __U, __B);
35 }
test_mm512_maskz_popcnt_epi8(__mmask64 __U,__m512i __B)36 __m512i test_mm512_maskz_popcnt_epi8(__mmask64 __U, __m512i __B) {
37   // CHECK-LABEL: @test_mm512_maskz_popcnt_epi8
38   // CHECK: @llvm.ctpop.v64i8
39   // CHECK: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{[0-9]+}}, <64 x i8> {{.*}}
40   return _mm512_maskz_popcnt_epi8(__U, __B);
41 }
42 
test_mm512_mask_bitshuffle_epi64_mask(__mmask64 __U,__m512i __A,__m512i __B)43 __mmask64 test_mm512_mask_bitshuffle_epi64_mask(__mmask64 __U, __m512i __A, __m512i __B) {
44   // CHECK-LABEL: @test_mm512_mask_bitshuffle_epi64_mask
45   // CHECK: @llvm.x86.avx512.vpshufbitqmb.512
46   // CHECK: and <64 x i1> %{{.*}}, %{{.*}}
47   return _mm512_mask_bitshuffle_epi64_mask(__U, __A, __B);
48 }
49 
test_mm512_bitshuffle_epi64_mask(__m512i __A,__m512i __B)50 __mmask64 test_mm512_bitshuffle_epi64_mask(__m512i __A, __m512i __B) {
51   // CHECK-LABEL: @test_mm512_bitshuffle_epi64_mask
52   // CHECK: @llvm.x86.avx512.vpshufbitqmb.512
53   return _mm512_bitshuffle_epi64_mask(__A, __B);
54 }
55 
56