1 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vpopcntdq -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
2 
3 #include <immintrin.h>
4 
test_mm_popcnt_epi64(__m128i __A)5 __m128i test_mm_popcnt_epi64(__m128i __A) {
6   // CHECK-LABEL: @test_mm_popcnt_epi64
7   // CHECK: @llvm.ctpop.v2i64
8   return _mm_popcnt_epi64(__A);
9 }
test_mm_mask_popcnt_epi64(__m128i __W,__mmask8 __U,__m128i __A)10 __m128i test_mm_mask_popcnt_epi64(__m128i __W, __mmask8 __U, __m128i __A) {
11   // CHECK-LABEL: @test_mm_mask_popcnt_epi64
12   // CHECK: @llvm.ctpop.v2i64
13   // CHECK: select <2 x i1> %{{.+}}, <2 x i64> %{{[0-9]+}}, <2 x i64> {{.*}}
14   return _mm_mask_popcnt_epi64(__W, __U, __A);
15 }
test_mm_maskz_popcnt_epi64(__mmask8 __U,__m128i __A)16 __m128i test_mm_maskz_popcnt_epi64(__mmask8 __U, __m128i __A) {
17   // CHECK-LABEL: @test_mm_maskz_popcnt_epi64
18   // CHECK: @llvm.ctpop.v2i64
19   // CHECK: select <2 x i1> %{{.+}}, <2 x i64> %{{[0-9]+}}, <2 x i64> {{.*}}
20   return _mm_maskz_popcnt_epi64(__U, __A);
21 }
test_mm_popcnt_epi32(__m128i __A)22 __m128i test_mm_popcnt_epi32(__m128i __A) {
23   // CHECK-LABEL: @test_mm_popcnt_epi32
24   // CHECK: @llvm.ctpop.v4i32
25   return _mm_popcnt_epi32(__A);
26 }
test_mm_mask_popcnt_epi32(__m128i __W,__mmask8 __U,__m128i __A)27 __m128i test_mm_mask_popcnt_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
28   // CHECK-LABEL: @test_mm_mask_popcnt_epi32
29   // CHECK: @llvm.ctpop.v4i32
30   // CHECK: select <4 x i1> %{{.+}}, <4 x i32> %{{[0-9]+}}, <4 x i32> {{.*}}
31   return _mm_mask_popcnt_epi32(__W, __U, __A);
32 }
test_mm_maskz_popcnt_epi32(__mmask8 __U,__m128i __A)33 __m128i test_mm_maskz_popcnt_epi32(__mmask8 __U, __m128i __A) {
34   // CHECK-LABEL: @test_mm_maskz_popcnt_epi32
35   // CHECK: @llvm.ctpop.v4i32
36   // CHECK: select <4 x i1> %{{.+}}, <4 x i32> %{{[0-9]+}}, <4 x i32> {{.*}}
37   return _mm_maskz_popcnt_epi32(__U, __A);
38 }
39 
test_mm256_popcnt_epi64(__m256i __A)40 __m256i test_mm256_popcnt_epi64(__m256i __A) {
41   // CHECK-LABEL: @test_mm256_popcnt_epi64
42   // CHECK: @llvm.ctpop.v4i64
43   return _mm256_popcnt_epi64(__A);
44 }
test_mm256_mask_popcnt_epi64(__m256i __W,__mmask8 __U,__m256i __A)45 __m256i test_mm256_mask_popcnt_epi64(__m256i __W, __mmask8 __U, __m256i __A) {
46   // CHECK-LABEL: @test_mm256_mask_popcnt_epi64
47   // CHECK: @llvm.ctpop.v4i64
48   // CHECK: select <4 x i1> %{{.+}}, <4 x i64> %{{[0-9]+}}, <4 x i64> {{.*}}
49   return _mm256_mask_popcnt_epi64(__W, __U, __A);
50 }
test_mm256_maskz_popcnt_epi64(__mmask8 __U,__m256i __A)51 __m256i test_mm256_maskz_popcnt_epi64(__mmask8 __U, __m256i __A) {
52   // CHECK-LABEL: @test_mm256_maskz_popcnt_epi64
53   // CHECK: @llvm.ctpop.v4i64
54   // CHECK: select <4 x i1> %{{.+}}, <4 x i64> %{{[0-9]+}}, <4 x i64> {{.*}}
55   return _mm256_maskz_popcnt_epi64(__U, __A);
56 }
test_mm256_popcnt_epi32(__m256i __A)57 __m256i test_mm256_popcnt_epi32(__m256i __A) {
58   // CHECK-LABEL: @test_mm256_popcnt_epi32
59   // CHECK: @llvm.ctpop.v8i32
60   return _mm256_popcnt_epi32(__A);
61 }
test_mm256_mask_popcnt_epi32(__m256i __W,__mmask8 __U,__m256i __A)62 __m256i test_mm256_mask_popcnt_epi32(__m256i __W, __mmask8 __U, __m256i __A) {
63   // CHECK-LABEL: @test_mm256_mask_popcnt_epi32
64   // CHECK: @llvm.ctpop.v8i32
65   // CHECK: select <8 x i1> %{{.+}}, <8 x i32> %{{[0-9]+}}, <8 x i32> {{.*}}
66   return _mm256_mask_popcnt_epi32(__W, __U, __A);
67 }
test_mm256_maskz_popcnt_epi32(__mmask8 __U,__m256i __A)68 __m256i test_mm256_maskz_popcnt_epi32(__mmask8 __U, __m256i __A) {
69   // CHECK-LABEL: @test_mm256_maskz_popcnt_epi32
70   // CHECK: @llvm.ctpop.v8i32
71   // CHECK: select <8 x i1> %{{.+}}, <8 x i32> %{{[0-9]+}}, <8 x i32> {{.*}}
72   return _mm256_maskz_popcnt_epi32(__U, __A);
73 }
74