|
| 1 | +// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512dq -target-feature +avx512vl -fclangir -emit-cir -o %t.cir -Wall -Werror |
| 2 | +// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s |
| 3 | +// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512dq -target-feature +avx512vl -fclangir -emit-llvm -o %t.ll -Wall -Werror |
| 4 | +// RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s |
| 5 | + |
| 6 | +#include <immintrin.h> |
| 7 | + |
| 8 | +__m128i test_mm_movm_epi32(__mmask8 __A) { |
| 9 | + // CIR-LABEL: _mm_movm_epi32 |
| 10 | + // CIR: %{{.*}} = cir.cast(bitcast, %{{.*}} : !u8i), !cir.vector<!cir.int<s, 1> x 8> |
| 11 | + // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<!cir.int<s, 1> x 8>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<!cir.int<s, 1> x 4> |
| 12 | + // CIR: %{{.*}} = cir.cast(integral, %{{.*}} : !cir.vector<!cir.int<s, 1> x 4>), !cir.vector<!s32i x 4> |
| 13 | + |
| 14 | + // LLVM-LABEL: @test_mm_movm_epi32 |
| 15 | + // LLVM: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1> |
| 16 | + // LLVM: %{{.*}} = shufflevector <8 x i1> %{{.*}}, <8 x i1> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 17 | + // LLVM: %{{.*}} = sext <4 x i1> %{{.*}} to <4 x i32> |
| 18 | + return _mm_movm_epi32(__A); |
| 19 | +} |
| 20 | + |
| 21 | +__m256i test_mm256_movm_epi32(__mmask8 __A) { |
| 22 | + // CIR-LABEL: _mm256_movm_epi32 |
| 23 | + // CIR: %{{.*}} = cir.cast(bitcast, %{{.*}} : !u8i), !cir.vector<!cir.int<s, 1> x 8> |
| 24 | + // CIR: %{{.*}} = cir.cast(integral, %{{.*}} : !cir.vector<!cir.int<s, 1> x 8>), !cir.vector<!s32i x 8> |
| 25 | + |
| 26 | + // LLVM-LABEL: @test_mm256_movm_epi32 |
| 27 | + // LLVM: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1> |
| 28 | + // LLVM: %{{.*}} = sext <8 x i1> %{{.*}} to <8 x i32> |
| 29 | + return _mm256_movm_epi32(__A); |
| 30 | +} |
| 31 | + |
| 32 | +__m512i test_mm512_movm_epi32(__mmask16 __A) { |
| 33 | + // CIR-LABEL: _mm512_movm_epi32 |
| 34 | + // CIR: %{{.*}} = cir.cast(bitcast, %{{.*}} : !u16i), !cir.vector<!cir.int<s, 1> x 16> |
| 35 | + // CIR: %{{.*}} = cir.cast(integral, %{{.*}} : !cir.vector<!cir.int<s, 1> x 16>), !cir.vector<!s32i x 16> |
| 36 | + |
| 37 | + // LLVM-LABEL: @test_mm512_movm_epi32 |
| 38 | + // LLVM: %{{.*}} = bitcast i16 %{{.*}} to <16 x i1> |
| 39 | + // LLVM: %{{.*}} = sext <16 x i1> %{{.*}} to <16 x i32> |
| 40 | + return _mm512_movm_epi32(__A); |
| 41 | +} |
| 42 | + |
| 43 | +__m128i test_mm_movm_epi64(__mmask8 __A) { |
| 44 | + // CIR-LABEL: _mm_movm_epi64 |
| 45 | + // CIR: %{{.*}} = cir.cast(bitcast, %{{.*}} : !u8i), !cir.vector<!cir.int<s, 1> x 8> |
| 46 | + // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<!cir.int<s, 1> x 8>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i] : !cir.vector<!cir.int<s, 1> x 2> |
| 47 | + // CIR: %{{.*}} = cir.cast(integral, %{{.*}} : !cir.vector<!cir.int<s, 1> x 2>), !cir.vector<!s64i x 2> |
| 48 | + |
| 49 | + // LLVM-LABEL: @test_mm_movm_epi64 |
| 50 | + // LLVM: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1> |
| 51 | + // LLVM: %{{.*}} = shufflevector <8 x i1> %{{.*}}, <8 x i1> %{{.*}}, <2 x i32> <i32 0, i32 1> |
| 52 | + // LLVM: %{{.*}} = sext <2 x i1> %{{.*}} to <2 x i64> |
| 53 | + return _mm_movm_epi64(__A); |
| 54 | +} |
| 55 | + |
| 56 | +__m256i test_mm256_movm_epi64(__mmask8 __A) { |
| 57 | + // CIR-LABEL: _mm256_movm_epi64 |
| 58 | + // CIR: %{{.*}} = cir.cast(bitcast, %{{.*}} : !u8i), !cir.vector<!cir.int<s, 1> x 8> |
| 59 | + // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<!cir.int<s, 1> x 8>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<!cir.int<s, 1> x 4> |
| 60 | + // CIR: %{{.*}} = cir.cast(integral, %{{.*}} : !cir.vector<!cir.int<s, 1> x 4>), !cir.vector<!s64i x 4> |
| 61 | + |
| 62 | + // LLVM-LABEL: @test_mm256_movm_epi64 |
| 63 | + // LLVM: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1> |
| 64 | + // LLVM: %{{.*}} = shufflevector <8 x i1> %{{.*}}, <8 x i1> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 65 | + // LLVM: %{{.*}} = sext <4 x i1> %{{.*}} to <4 x i64> |
| 66 | + return _mm256_movm_epi64(__A); |
| 67 | +} |
0 commit comments