106 lines · c
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 %s2// 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 %s3// 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 %s4// 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 %s5 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 %s7// 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 %s8// 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 %s9// 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 %s10 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_epi6417 // CHECK: @llvm.ctpop.v2i6418 return _mm_popcnt_epi64(__A);19}20TEST_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_epi6424 // CHECK: @llvm.ctpop.v2i6425 // CHECK: select <2 x i1> %{{.+}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}26 return _mm_mask_popcnt_epi64(__W, __U, __A);27}28TEST_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_epi6432 // CHECK: @llvm.ctpop.v2i6433 // CHECK: select <2 x i1> %{{.+}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}34 return _mm_maskz_popcnt_epi64(__U, __A);35}36TEST_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_epi3240 // CHECK: @llvm.ctpop.v4i3241 return _mm_popcnt_epi32(__A);42}43TEST_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_epi3247 // CHECK: @llvm.ctpop.v4i3248 // CHECK: select <4 x i1> %{{.+}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}49 return _mm_mask_popcnt_epi32(__W, __U, __A);50}51TEST_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_epi3255 // CHECK: @llvm.ctpop.v4i3256 // CHECK: select <4 x i1> %{{.+}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}57 return _mm_maskz_popcnt_epi32(__U, __A);58}59TEST_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_epi6463 // CHECK: @llvm.ctpop.v4i6464 return _mm256_popcnt_epi64(__A);65}66TEST_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_epi6470 // CHECK: @llvm.ctpop.v4i6471 // CHECK: select <4 x i1> %{{.+}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}72 return _mm256_mask_popcnt_epi64(__W, __U, __A);73}74TEST_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_epi6478 // CHECK: @llvm.ctpop.v4i6479 // CHECK: select <4 x i1> %{{.+}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}80 return _mm256_maskz_popcnt_epi64(__U, __A);81}82TEST_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_epi3286 // CHECK: @llvm.ctpop.v8i3287 return _mm256_popcnt_epi32(__A);88}89TEST_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_epi3293 // CHECK: @llvm.ctpop.v8i3294 // CHECK: select <8 x i1> %{{.+}}, <8 x i32> %{{.*}}, <8 x i32> %{{.*}}95 return _mm256_mask_popcnt_epi32(__W, __U, __A);96}97TEST_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_epi32101 // CHECK: @llvm.ctpop.v8i32102 // CHECK: select <8 x i1> %{{.+}}, <8 x i32> %{{.*}}, <8 x i32> %{{.*}}103 return _mm256_maskz_popcnt_epi32(__U, __A);104}105TEST_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));106