|
| 1 | +// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fclangir -emit-cir -o %t.cir -Wall -Werror |
| 2 | +// RUN: FileCheck --check-prefixes=CIR-CHECK,CIR-X64 --input-file=%t.cir %s |
| 3 | +// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fno-signed-char -fclangir -emit-cir -o %t.cir -Wall -Werror |
| 4 | +// RUN: FileCheck --check-prefixes=CIR-CHECK,CIR-X64 --input-file=%t.cir %s |
| 5 | + |
| 6 | +// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fclangir -emit-llvm -o %t.ll -Wall -Werror |
| 7 | +// RUN: FileCheck --check-prefixes=LLVM-CHECK,LLVM-X64 --input-file=%t.ll %s |
| 8 | +// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fno-signed-char -fclangir -emit-llvm -o %t.ll -Wall -Werror |
| 9 | +// RUN: FileCheck --check-prefixes=LLVM-CHECK,LLVM-X64 --input-file=%t.ll %s |
| 10 | + |
| 11 | +// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fclangir -emit-cir -o %t.cir -Wall -Werror |
| 12 | +// RUN: FileCheck --check-prefixes=CIR-CHECK,CIR-X64 --input-file=%t.cir %s |
| 13 | +// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fno-signed-char -fclangir -emit-cir -o %t.cir -Wall -Werror |
| 14 | +// RUN: FileCheck --check-prefixes=CIR-CHECK,CIR-X64 --input-file=%t.cir %s |
| 15 | + |
| 16 | +// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fclangir -emit-llvm -o %t.ll -Wall -Werror |
| 17 | +// RUN: FileCheck --check-prefixes=LLVM-CHECK,LLVM-X64 --input-file=%t.ll %s |
| 18 | +// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx -fno-signed-char -fclangir -emit-llvm -o %t.ll -Wall -Werror |
| 19 | +// RUN: FileCheck --check-prefixes=LLVM-CHECK,LLVM-X64 --input-file=%t.ll %s |
| 20 | + |
| 21 | +#include <immintrin.h> |
| 22 | + |
| 23 | +int test_mm256_extract_epi8(__m256i A) { |
| 24 | + // CIR-CHECK-LABEL: test_mm256_extract_epi8 |
| 25 | + // CIR-CHECK %{{.*}} = cir.vec.extract %{{.*}}[%{{.*}} : {{!u32i|!u64i}}] : !cir.vector<!s8i x 32> |
| 26 | + // CIR-CHECK %{{.*}} = cir.cast(integral, %{{.*}} : !u8i), !s32i |
| 27 | + |
| 28 | + // LLVM-CHECK-LABEL: test_mm256_extract_epi8 |
| 29 | + // LLVM-CHECK: extractelement <32 x i8> %{{.*}}, {{i32|i64}} 31 |
| 30 | + // LLVM-CHECK: zext i8 %{{.*}} to i32 |
| 31 | + return _mm256_extract_epi8(A, 31); |
| 32 | +} |
| 33 | + |
| 34 | +int test_mm256_extract_epi16(__m256i A) { |
| 35 | + // CIR-CHECK-LABEL: test_mm256_extract_epi16 |
| 36 | + // CIR-CHECK %{{.*}} = cir.vec.extract %{{.*}}[%{{.*}} : {{!u32i|!u64i}}] : !cir.vector<!s16i x 16> |
| 37 | + // CIR-CHECK %{{.*}} = cir.cast(integral, %{{.*}} : !u16i), !s32i |
| 38 | + |
| 39 | + // LLVM-CHECK-LABEL: test_mm256_extract_epi16 |
| 40 | + // LLVM-CHECK: extractelement <16 x i16> %{{.*}}, {{i32|i64}} 15 |
| 41 | + // LLVM-CHECK: zext i16 %{{.*}} to i32 |
| 42 | + return _mm256_extract_epi16(A, 15); |
| 43 | +} |
| 44 | + |
| 45 | +int test_mm256_extract_epi32(__m256i A) { |
| 46 | + // CIR-CHECK-LABEL: test_mm256_extract_epi32 |
| 47 | + // CIR-CHECK %{{.*}} = cir.vec.extract %{{.*}}[%{{.*}} : {{!u32i|!u64i}}] : !cir.vector<!s32i x 8> |
| 48 | + |
| 49 | + // LLVM-CHECK-LABEL: test_mm256_extract_epi32 |
| 50 | + // LLVM-CHECK: extractelement <8 x i32> %{{.*}}, {{i32|i64}} 7 |
| 51 | + return _mm256_extract_epi32(A, 7); |
| 52 | +} |
| 53 | + |
| 54 | +#if __x86_64__ |
| 55 | +long long test_mm256_extract_epi64(__m256i A) { |
| 56 | + // CIR-X64-LABEL: test_mm256_extract_epi64 |
| 57 | + // LLVM-X64-LABEL: test_mm256_extract_epi64 |
| 58 | + return _mm256_extract_epi64(A, 3); |
| 59 | +} |
| 60 | +#endif |
0 commit comments