| 1 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vpopcntdq -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 +avx512vpopcntdq -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 +avx512vpopcntdq -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 +avx512vpopcntdq -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s |
| 5 |
|
| 6 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vpopcntdq -target-feature +avx512vl -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s |
| 7 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +avx512vpopcntdq -target-feature +avx512vl -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s |
| 8 |
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vpopcntdq -target-feature +avx512vl -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s |
| 9 |
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +avx512vpopcntdq -target-feature +avx512vl -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s |
| 10 |
|
| 11 |
|
| 12 |
#include <immintrin.h> |
| 13 |
#include "builtin_test_helpers.h" |
| 14 |
|
| 15 |
__m128i test_mm_popcnt_epi64(__m128i __A) { |
| 16 |
// CHECK-LABEL: test_mm_popcnt_epi64 |
| 17 |
// CHECK: @llvm.ctpop.v2i64 |
| 18 |
return _mm_popcnt_epi64(__A); |
| 19 |
} |
| 20 |
TEST_CONSTEXPR(match_v2di(_mm_popcnt_epi64((__m128i)(__v2di){+5, -3}), 2, 63)); |
| 21 |
|
| 22 |
__m128i test_mm_mask_popcnt_epi64(__m128i __W, __mmask8 __U, __m128i __A) { |
| 23 |
// CHECK-LABEL: test_mm_mask_popcnt_epi64 |
| 24 |
// CHECK: @llvm.ctpop.v2i64 |
| 25 |
// CHECK: select <2 x i1> %{{.+}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}} |
| 26 |
return _mm_mask_popcnt_epi64(__W, __U, __A); |
| 27 |
} |
| 28 |
TEST_CONSTEXPR(match_v2di(_mm_mask_popcnt_epi64(_mm_set1_epi64x(-1), 0x2, (__m128i)(__v2di){+5, -3}), -1, 63)); |
| 29 |
|
| 30 |
__m128i test_mm_maskz_popcnt_epi64(__mmask8 __U, __m128i __A) { |
| 31 |
// CHECK-LABEL: test_mm_maskz_popcnt_epi64 |
| 32 |
// CHECK: @llvm.ctpop.v2i64 |
| 33 |
// CHECK: select <2 x i1> %{{.+}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}} |
| 34 |
return _mm_maskz_popcnt_epi64(__U, __A); |
| 35 |
} |
| 36 |
TEST_CONSTEXPR(match_v2di(_mm_maskz_popcnt_epi64(0x1, (__m128i)(__v2di){+5, -3}), 2, 0)); |
| 37 |
|
| 38 |
__m128i test_mm_popcnt_epi32(__m128i __A) { |
| 39 |
// CHECK-LABEL: test_mm_popcnt_epi32 |
| 40 |
// CHECK: @llvm.ctpop.v4i32 |
| 41 |
return _mm_popcnt_epi32(__A); |
| 42 |
} |
| 43 |
TEST_CONSTEXPR(match_v4si(_mm_popcnt_epi32((__m128i)(__v4si){+5, -3, -10, +8}), 2, 31, 30, 1)); |
| 44 |
|
| 45 |
__m128i test_mm_mask_popcnt_epi32(__m128i __W, __mmask8 __U, __m128i __A) { |
| 46 |
// CHECK-LABEL: test_mm_mask_popcnt_epi32 |
| 47 |
// CHECK: @llvm.ctpop.v4i32 |
| 48 |
// CHECK: select <4 x i1> %{{.+}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}} |
| 49 |
return _mm_mask_popcnt_epi32(__W, __U, __A); |
| 50 |
} |
| 51 |
TEST_CONSTEXPR(match_v4si(_mm_mask_popcnt_epi32(_mm_set1_epi32(-1), 0x3, (__m128i)(__v4si){+5, -3, -10, +8}), 2, 31, -1, -1)); |
| 52 |
|
| 53 |
__m128i test_mm_maskz_popcnt_epi32(__mmask8 __U, __m128i __A) { |
| 54 |
// CHECK-LABEL: test_mm_maskz_popcnt_epi32 |
| 55 |
// CHECK: @llvm.ctpop.v4i32 |
| 56 |
// CHECK: select <4 x i1> %{{.+}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}} |
| 57 |
return _mm_maskz_popcnt_epi32(__U, __A); |
| 58 |
} |
| 59 |
TEST_CONSTEXPR(match_v4si(_mm_maskz_popcnt_epi32(0x5, (__m128i)(__v4si){+5, -3, -10, +8}), 2, 0, 30, 0)); |
| 60 |
|
| 61 |
__m256i test_mm256_popcnt_epi64(__m256i __A) { |
| 62 |
// CHECK-LABEL: test_mm256_popcnt_epi64 |
| 63 |
// CHECK: @llvm.ctpop.v4i64 |
| 64 |
return _mm256_popcnt_epi64(__A); |
| 65 |
} |
| 66 |
TEST_CONSTEXPR(match_v4di(_mm256_popcnt_epi64((__m256i)(__v4di){+5, -3, -10, +8}), 2, 63, 62, 1)); |
| 67 |
|
| 68 |
__m256i test_mm256_mask_popcnt_epi64(__m256i __W, __mmask8 __U, __m256i __A) { |
| 69 |
// CHECK-LABEL: test_mm256_mask_popcnt_epi64 |
| 70 |
// CHECK: @llvm.ctpop.v4i64 |
| 71 |
// CHECK: select <4 x i1> %{{.+}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}} |
| 72 |
return _mm256_mask_popcnt_epi64(__W, __U, __A); |
| 73 |
} |
| 74 |
TEST_CONSTEXPR(match_v4di(_mm256_mask_popcnt_epi64(_mm256_set1_epi64x(-1), 0x3, (__m256i)(__v4di){+5, -3, -10, +8}), 2, 63, -1, -1)); |
| 75 |
|
| 76 |
__m256i test_mm256_maskz_popcnt_epi64(__mmask8 __U, __m256i __A) { |
| 77 |
// CHECK-LABEL: test_mm256_maskz_popcnt_epi64 |
| 78 |
// CHECK: @llvm.ctpop.v4i64 |
| 79 |
// CHECK: select <4 x i1> %{{.+}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}} |
| 80 |
return _mm256_maskz_popcnt_epi64(__U, __A); |
| 81 |
} |
| 82 |
TEST_CONSTEXPR(match_v4di(_mm256_maskz_popcnt_epi64(0x5, (__m256i)(__v4di){+5, -3, -10, +8}), 2, 0, 62, 0)); |
| 83 |
|
| 84 |
__m256i test_mm256_popcnt_epi32(__m256i __A) { |
| 85 |
// CHECK-LABEL: test_mm256_popcnt_epi32 |
| 86 |
// CHECK: @llvm.ctpop.v8i32 |
| 87 |
return _mm256_popcnt_epi32(__A); |
| 88 |
} |
| 89 |
TEST_CONSTEXPR(match_v8si(_mm256_popcnt_epi32((__m256i)(__v8si){+5, -3, -10, +8, 0, -256, +256, -128}), 2, 31, 30, 1, 0, 24, 1, 25)); |
| 90 |
|
| 91 |
__m256i test_mm256_mask_popcnt_epi32(__m256i __W, __mmask8 __U, __m256i __A) { |
| 92 |
// CHECK-LABEL: test_mm256_mask_popcnt_epi32 |
| 93 |
// CHECK: @llvm.ctpop.v8i32 |
| 94 |
// CHECK: select <8 x i1> %{{.+}}, <8 x i32> %{{.*}}, <8 x i32> %{{.*}} |
| 95 |
return _mm256_mask_popcnt_epi32(__W, __U, __A); |
| 96 |
} |
| 97 |
TEST_CONSTEXPR(match_v8si(_mm256_mask_popcnt_epi32(_mm256_set1_epi32(-1), 0x37, (__m256i)(__v8si){+5, -3, -10, +8, 0, -256, +256, -128}), 2, 31, 30, -1, 0, 24, -1, -1)); |
| 98 |
|
| 99 |
__m256i test_mm256_maskz_popcnt_epi32(__mmask8 __U, __m256i __A) { |
| 100 |
// CHECK-LABEL: test_mm256_maskz_popcnt_epi32 |
| 101 |
// CHECK: @llvm.ctpop.v8i32 |
| 102 |
// CHECK: select <8 x i1> %{{.+}}, <8 x i32> %{{.*}}, <8 x i32> %{{.*}} |
| 103 |
return _mm256_maskz_popcnt_epi32(__U, __A); |
| 104 |
} |
| 105 |
TEST_CONSTEXPR(match_v8si(_mm256_maskz_popcnt_epi32(0x8C, (__m256i)(__v8si){+5, -3, -10, +8, 0, -256, +256, -128}), 0, 0, 30, 1, 0, 0, 0, 25)); |