https://github.com/Thibault-Monnier updated https://github.com/llvm/llvm-project/pull/173726
>From ee1715f3d0661e1f3c15712a99c268432bc35a9b Mon Sep 17 00:00:00 2001 From: Thibault-Monnier <[email protected]> Date: Sat, 27 Dec 2025 17:06:34 +0100 Subject: [PATCH] Add removed tests --- .../CodeGenBuiltins/X86/avx512dq-builtins.c | 55 +++++++++++++++++-- .../CodeGenBuiltins/X86/avx512vldq-builtins.c | 44 +++++++++++---- 2 files changed, 85 insertions(+), 14 deletions(-) diff --git a/clang/test/CIR/CodeGenBuiltins/X86/avx512dq-builtins.c b/clang/test/CIR/CodeGenBuiltins/X86/avx512dq-builtins.c index e49a4bd04956e..49b3e7e642405 100644 --- a/clang/test/CIR/CodeGenBuiltins/X86/avx512dq-builtins.c +++ b/clang/test/CIR/CodeGenBuiltins/X86/avx512dq-builtins.c @@ -25,10 +25,9 @@ __m512i test_mm512_movm_epi64(__mmask8 __A) { // OGCG-LABEL: {{.*}}test_mm512_movm_epi64{{.*}}( // OGCG: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1> // OGCG: %{{.*}} = sext <8 x i1> %{{.*}} to <8 x i64> - return _mm512_movm_epi64(__A); + return _mm512_movm_epi64(__A); } - __mmask8 test_kadd_mask8(__mmask8 A, __mmask8 B) { // CIR-LABEL: _kadd_mask8 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>> @@ -353,7 +352,7 @@ __mmask16 test_mm512_movepi32_mask(__m512i __A) { // OGCG-LABEL: {{.*}}test_mm512_movepi32_mask{{.*}}( // OGCG: [[CMP:%.*]] = icmp slt <16 x i32> %{{.*}}, zeroinitializer // OGCG: bitcast <16 x i1> [[CMP]] to i16 - return _mm512_movepi32_mask(__A); + return _mm512_movepi32_mask(__A); } __mmask8 test_mm512_movepi64_mask(__m512i __A) { @@ -369,4 +368,52 @@ __mmask8 test_mm512_movepi64_mask(__m512i __A) { // OGCG: [[CMP:%.*]] = icmp slt <8 x i64> %{{.*}}, zeroinitializer // OGCG: bitcast <8 x i1> [[CMP]] to i8 return _mm512_movepi64_mask(__A); -} \ No newline at end of file +} + +__m512 test_mm512_insertf32x8(__m512 __A, __m256 __B) { + // CIR-LABEL: test_mm512_insertf32x8 + // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<16 x !cir.float>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i, #cir.int<16> : !s32i, #cir.int<17> : !s32i, #cir.int<18> : !s32i, #cir.int<19> : !s32i, #cir.int<20> : !s32i, #cir.int<21> : !s32i, #cir.int<22> : !s32i, #cir.int<23> : !s32i] : !cir.vector<16 x !cir.float> + + // LLVM-LABEL: test_mm512_insertf32x8 + // LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23> + + // OGCG-LABEL: test_mm512_insertf32x8 + // OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23> + return _mm512_insertf32x8(__A, __B, 1); +} + +__m512i test_mm512_inserti32x8(__m512i __A, __m256i __B) { + // CIR-LABEL: test_mm512_inserti32x8 + // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<16 x !s32i>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i, #cir.int<16> : !s32i, #cir.int<17> : !s32i, #cir.int<18> : !s32i, #cir.int<19> : !s32i, #cir.int<20> : !s32i, #cir.int<21> : !s32i, #cir.int<22> : !s32i, #cir.int<23> : !s32i] : !cir.vector<16 x !s32i> + + // LLVM-LABEL: test_mm512_inserti32x8 + // LLVM: shufflevector <16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23> + + // OGCG-LABEL: test_mm512_inserti32x8 + // OGCG: shufflevector <16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23> + return _mm512_inserti32x8(__A, __B, 1); +} + +__m512d test_mm512_insertf64x2(__m512d __A, __m128d __B) { + // CIR-LABEL: test_mm512_insertf64x2 + // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<8 x !cir.double>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i] : !cir.vector<8 x !cir.double> + + // LLVM-LABEL: test_mm512_insertf64x2 + // LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 8, i32 9> + + // OGCG-LABEL: test_mm512_insertf64x2 + // OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 8, i32 9> + return _mm512_insertf64x2(__A, __B, 3); +} + +__m512i test_mm512_inserti64x2(__m512i __A, __m128i __B) { + // CIR-LABEL: test_mm512_inserti64x2 + // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<8 x !s64i>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<8 x !s64i> + + // LLVM-LABEL: test_mm512_inserti64x2 + // LLVM: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 8, i32 9, i32 4, i32 5, i32 6, i32 7> + + // OGCG-LABEL: test_mm512_inserti64x2 + // OGCG: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 8, i32 9, i32 4, i32 5, i32 6, i32 7> + return _mm512_inserti64x2(__A, __B, 1); +} diff --git a/clang/test/CIR/CodeGenBuiltins/X86/avx512vldq-builtins.c b/clang/test/CIR/CodeGenBuiltins/X86/avx512vldq-builtins.c index 9461dde257799..2e3ec00558bf7 100644 --- a/clang/test/CIR/CodeGenBuiltins/X86/avx512vldq-builtins.c +++ b/clang/test/CIR/CodeGenBuiltins/X86/avx512vldq-builtins.c @@ -1,4 +1,4 @@ -// 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 +// 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 // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s // 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 // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s @@ -22,7 +22,7 @@ __m128i test_mm_movm_epi32(__mmask8 __A) { // OGCG: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1> // OGCG: %{{.*}} = shufflevector <8 x i1> %{{.*}}, <8 x i1> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3> // OGCG: %{{.*}} = sext <4 x i1> %{{.*}} to <4 x i32> - return _mm_movm_epi32(__A); + return _mm_movm_epi32(__A); } __m256i test_mm256_movm_epi32(__mmask8 __A) { @@ -37,7 +37,7 @@ __m256i test_mm256_movm_epi32(__mmask8 __A) { // OGCG-LABEL: @test_mm256_movm_epi32 // OGCG: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1> // OGCG: %{{.*}} = sext <8 x i1> %{{.*}} to <8 x i32> - return _mm256_movm_epi32(__A); + return _mm256_movm_epi32(__A); } __m512i test_mm512_movm_epi32(__mmask16 __A) { @@ -52,7 +52,7 @@ __m512i test_mm512_movm_epi32(__mmask16 __A) { // OGCG-LABEL: @test_mm512_movm_epi32 // OGCG: %{{.*}} = bitcast i16 %{{.*}} to <16 x i1> // OGCG: %{{.*}} = sext <16 x i1> %{{.*}} to <16 x i32> - return _mm512_movm_epi32(__A); + return _mm512_movm_epi32(__A); } __m128i test_mm_movm_epi64(__mmask8 __A) { @@ -70,7 +70,7 @@ __m128i test_mm_movm_epi64(__mmask8 __A) { // OGCG: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1> // OGCG: %{{.*}} = shufflevector <8 x i1> %{{.*}}, <8 x i1> %{{.*}}, <2 x i32> <i32 0, i32 1> // OGCG: %{{.*}} = sext <2 x i1> %{{.*}} to <2 x i64> - return _mm_movm_epi64(__A); + return _mm_movm_epi64(__A); } __m256i test_mm256_movm_epi64(__mmask8 __A) { @@ -88,7 +88,7 @@ __m256i test_mm256_movm_epi64(__mmask8 __A) { // OGCG: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1> // OGCG: %{{.*}} = shufflevector <8 x i1> %{{.*}}, <8 x i1> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3> // OGCG: %{{.*}} = sext <4 x i1> %{{.*}} to <4 x i64> - return _mm256_movm_epi64(__A); + return _mm256_movm_epi64(__A); } __mmask8 test_mm256_movepi32_mask(__m256i __A) { @@ -103,7 +103,7 @@ __mmask8 test_mm256_movepi32_mask(__m256i __A) { // OGCG-LABEL: @test_mm256_movepi32_mask // OGCG: [[CMP:%.*]] = icmp slt <8 x i32> %{{.*}}, zeroinitializer // OGCG: bitcast <8 x i1> [[CMP]] to i8 - return _mm256_movepi32_mask(__A); + return _mm256_movepi32_mask(__A); } __mmask8 test_mm_movepi64_mask(__m128i __A) { @@ -121,7 +121,7 @@ __mmask8 test_mm_movepi64_mask(__m128i __A) { // OGCG: [[CMP:%.*]] = icmp slt <2 x i64> %{{.*}}, zeroinitializer // OGCG: [[SHUF:%.*]] = shufflevector <2 x i1> [[CMP]], <2 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3> // OGCG: bitcast <8 x i1> [[SHUF]] to i8 - return _mm_movepi64_mask(__A); + return _mm_movepi64_mask(__A); } __mmask8 test_mm256_movepi64_mask(__m256i __A) { @@ -139,5 +139,29 @@ __mmask8 test_mm256_movepi64_mask(__m256i __A) { // OGCG: [[CMP:%.*]] = icmp slt <4 x i64> %{{.*}}, zeroinitializer // OGCG: [[SHUF:%.*]] = shufflevector <4 x i1> [[CMP]], <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> // OGCG: bitcast <8 x i1> [[SHUF]] to i8 - return _mm256_movepi64_mask(__A); -} \ No newline at end of file + return _mm256_movepi64_mask(__A); +} + +__m256d test_mm256_insertf64x2(__m256d __A, __m128d __B) { + // CIR-LABEL: test_mm256_insertf64x2 + // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<4 x !cir.double>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i] : !cir.vector<4 x !cir.double> + + // LLVM-LABEL: @test_mm256_insertf64x2 + // LLVM: shufflevector <4 x double> %{{.*}}, <4 x double> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 4, i32 5> + + // OGCG-LABEL: @test_mm256_insertf64x2 + // OGCG: shufflevector <4 x double> %{{.*}}, <4 x double> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 4, i32 5> + return _mm256_insertf64x2(__A, __B, 1); +} + +__m256i test_mm256_inserti64x2(__m256i __A, __m128i __B) { + // CIR-LABEL: test_mm256_inserti64x2 + // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<4 x !s64i>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i] : !cir.vector<4 x !s64i> + + // LLVM-LABEL: @test_mm256_inserti64x2 + // LLVM: shufflevector <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 4, i32 5> + + // OGCG-LABEL: @test_mm256_inserti64x2 + // OGCG: shufflevector <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 4, i32 5> + return _mm256_inserti64x2(__A, __B, 1); +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
