[clang] [CIR][X86] Add support for vpshl/vpshr builtins (PR #179538)
Priyanshu Kumar via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 7 07:29:48 PST 2026
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/179538
>From 8704d692db00621dd46cd55914b6ba8d12c71f74 Mon Sep 17 00:00:00 2001
From: Priyanshu Kumar <10b.priyanshu at gmail.com>
Date: Wed, 4 Feb 2026 16:47:58 +0000
Subject: [PATCH 1/5] Add support for vpshl/vpshr builtins
---
clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp | 19 +-
clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp | 13 +-
.../X86/avx512vbmi2-builtins.c | 418 ++++++++++++++++++
3 files changed, 444 insertions(+), 6 deletions(-)
create mode 100644 clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
index 580ada8901cbb..c7d6cd8ae240e 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
@@ -1246,8 +1246,23 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
case Builtin::BI__builtin_elementwise_canonicalize:
case Builtin::BI__builtin_elementwise_copysign:
case Builtin::BI__builtin_elementwise_fma:
- case Builtin::BI__builtin_elementwise_fshl:
- case Builtin::BI__builtin_elementwise_fshr:
+ return errorBuiltinNYI(*this, e, builtinID);
+ case Builtin::BI__builtin_elementwise_fshl: {
+ mlir::Location loc = getLoc(e->getExprLoc());
+ mlir::Value a = emitScalarExpr(e->getArg(0));
+ mlir::Value b = emitScalarExpr(e->getArg(1));
+ mlir::Value c = emitScalarExpr(e->getArg(2));
+ return RValue::get(builder.emitIntrinsicCallOp(loc, "fshl", a.getType(),
+ mlir::ValueRange{a, b, c}));
+ }
+ case Builtin::BI__builtin_elementwise_fshr: {
+ mlir::Location loc = getLoc(e->getExprLoc());
+ mlir::Value a = emitScalarExpr(e->getArg(0));
+ mlir::Value b = emitScalarExpr(e->getArg(1));
+ mlir::Value c = emitScalarExpr(e->getArg(2));
+ return RValue::get(builder.emitIntrinsicCallOp(loc, "fshr", a.getType(),
+ mlir::ValueRange{a, b, c}));
+ }
case Builtin::BI__builtin_elementwise_add_sat:
case Builtin::BI__builtin_elementwise_sub_sat:
case Builtin::BI__builtin_elementwise_max:
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
index 80022998448ad..4e190ab4de3fb 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
@@ -2032,6 +2032,10 @@ CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID, const CallExpr *expr) {
case X86::BI__builtin_ia32_pternlogd256_maskz:
case X86::BI__builtin_ia32_pternlogq128_maskz:
case X86::BI__builtin_ia32_pternlogq256_maskz:
+ cgm.errorNYI(expr->getSourceRange(),
+ std::string("unimplemented X86 builtin call: ") +
+ getContext().BuiltinInfo.getName(builtinID));
+ return mlir::Value{};
case X86::BI__builtin_ia32_vpshldd128:
case X86::BI__builtin_ia32_vpshldd256:
case X86::BI__builtin_ia32_vpshldd512:
@@ -2041,6 +2045,8 @@ CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID, const CallExpr *expr) {
case X86::BI__builtin_ia32_vpshldw128:
case X86::BI__builtin_ia32_vpshldw256:
case X86::BI__builtin_ia32_vpshldw512:
+ return emitX86FunnelShift(builder, getLoc(expr->getExprLoc()), ops[0],
+ ops[1], ops[2], false);
case X86::BI__builtin_ia32_vpshrdd128:
case X86::BI__builtin_ia32_vpshrdd256:
case X86::BI__builtin_ia32_vpshrdd512:
@@ -2050,10 +2056,9 @@ CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID, const CallExpr *expr) {
case X86::BI__builtin_ia32_vpshrdw128:
case X86::BI__builtin_ia32_vpshrdw256:
case X86::BI__builtin_ia32_vpshrdw512:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented X86 builtin call: ") +
- getContext().BuiltinInfo.getName(builtinID));
- return mlir::Value{};
+ // Ops 0 and 1 are swapped.
+ return emitX86FunnelShift(builder, getLoc(expr->getExprLoc()), ops[1],
+ ops[0], ops[2], true);
case X86::BI__builtin_ia32_reduce_fadd_pd512:
case X86::BI__builtin_ia32_reduce_fadd_ps512:
case X86::BI__builtin_ia32_reduce_fadd_ph512:
diff --git a/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c b/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
new file mode 100644
index 0000000000000..ae0cdf09f3f77
--- /dev/null
+++ b/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
@@ -0,0 +1,418 @@
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding -triple x86_64-unknown-linux-gnu -fclangir -target-feature +avx512vbmi2 -emit-cir %s -o %t.cir
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding -triple x86_64-unknown-linux-gnu -fclangir -target-feature +avx512vbmi2 -emit-llvm %s -o %t.ll
+// RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512vbmi2 -emit-llvm -o %t.ll -Wall -Werror -Wsign-conversion
+// RUN: FileCheck --check-prefixes=OGCG --input-file=%t.ll %s
+
+
+#include <immintrin.h>
+
+__m512i test_mm512_mask_shldi_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shldi_epi64
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_mask_shldi_epi64
+ // LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64> splat (i64 47))
+ // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // OGCG-LABEL: @test_mm512_mask_shldi_epi64
+ // OGCG: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> splat (i64 47))
+ // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
+ return _mm512_mask_shldi_epi64(s, u, a, b, 47);
+}
+
+__m512i test_mm512_maskz_shldi_epi64(__mmask8 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shldi_epi64
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_maskz_shldi_epi64
+ // LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64> splat (i64 63))
+ // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // OGCG-LABEL: @test_mm512_maskz_shldi_epi64
+ // OGCG: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> splat (i64 63))
+ // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
+ return _mm512_maskz_shldi_epi64(u, a, b, 63);
+}
+
+__m512i test_mm512_shldi_epi64(__m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shldi_epi64
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_shldi_epi64
+ // LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64> splat (i64 31))
+ // OGCG-LABEL: @test_mm512_shldi_epi64
+ // OGCG: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> splat (i64 31))
+ return _mm512_shldi_epi64(a, b, 31);
+}
+
+__m512i test_mm512_mask_shldi_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shldi_epi32
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_mask_shldi_epi32
+ // LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 7))
+ // LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // OGCG-LABEL: @test_mm512_mask_shldi_epi32
+ // OGCG: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> splat (i32 7))
+ // OGCG: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
+ return _mm512_mask_shldi_epi32(s, u, a, b, 7);
+}
+
+__m512i test_mm512_maskz_shldi_epi32(__mmask16 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shldi_epi32
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_maskz_shldi_epi32
+ // LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 15))
+ // LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // OGCG-LABEL: @test_mm512_maskz_shldi_epi32
+ // OGCG: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> splat (i32 15))
+ // OGCG: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
+ return _mm512_maskz_shldi_epi32(u, a, b, 15);
+}
+
+__m512i test_mm512_shldi_epi32(__m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shldi_epi32
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_shldi_epi32
+ // LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 31))
+ // OGCG-LABEL: @test_mm512_shldi_epi32
+ // OGCG: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> splat (i32 31))
+ return _mm512_shldi_epi32(a, b, 31);
+}
+
+__m512i test_mm512_mask_shldi_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shldi_epi16
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_mask_shldi_epi16
+ // LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 3))
+ // LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // OGCG-LABEL: @test_mm512_mask_shldi_epi16
+ // OGCG: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> splat (i16 3))
+ // OGCG: select <32 x i1> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
+ return _mm512_mask_shldi_epi16(s, u, a, b, 3);
+}
+
+__m512i test_mm512_maskz_shldi_epi16(__mmask32 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shldi_epi16
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_maskz_shldi_epi16
+ // LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 15))
+ // LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // OGCG-LABEL: @test_mm512_maskz_shldi_epi16
+ // OGCG: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> splat (i16 15))
+ // OGCG: select <32 x i1> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
+ return _mm512_maskz_shldi_epi16(u, a, b, 15);
+}
+
+__m512i test_mm512_shldi_epi16(__m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shldi_epi16
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_shldi_epi16
+ // LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 31))
+ // OGCG-LABEL: @test_mm512_shldi_epi16
+ // OGCG: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> splat (i16 31))
+ return _mm512_shldi_epi16(a, b, 31);
+}
+
+__m512i test_mm512_mask_shldv_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shldv_epi64
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_mask_shldv_epi64
+ // LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // OGCG-LABEL: @test_mm512_mask_shldv_epi64
+ // OGCG: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64>
+ // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
+ return _mm512_mask_shldv_epi64(s, u, a, b);
+}
+
+__m512i test_mm512_maskz_shldv_epi64(__mmask8 u, __m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shldv_epi64
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_maskz_shldv_epi64
+ // LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // OGCG-LABEL: @test_mm512_maskz_shldv_epi64
+ // OGCG: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64>
+ // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
+ return _mm512_maskz_shldv_epi64(u, s, a, b);
+}
+
+__m512i test_mm512_shldv_epi64(__m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shldv_epi64
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_shldv_epi64
+ // LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // OGCG-LABEL: @test_mm512_shldv_epi64
+ // OGCG: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64>
+ return _mm512_shldv_epi64(s, a, b);
+}
+
+__m512i test_mm512_shldv_epi32(__m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shldv_epi32
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_shldv_epi32
+ // LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // OGCG-LABEL: @test_mm512_shldv_epi32
+ // OGCG: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32>
+ return _mm512_shldv_epi32(s, a, b);
+}
+
+__m512i test_mm512_mask_shldv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shldv_epi16
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_mask_shldv_epi16
+ // LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // OGCG-LABEL: @test_mm512_mask_shldv_epi16
+ // OGCG: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16>
+ // OGCG: select <32 x i1> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
+ return _mm512_mask_shldv_epi16(s, u, a, b);
+}
+
+__m512i test_mm512_maskz_shldv_epi16(__mmask32 u, __m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shldv_epi16
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_maskz_shldv_epi16
+ // LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // OGCG-LABEL: @test_mm512_maskz_shldv_epi16
+ // OGCG: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16>
+ // OGCG: select <32 x i1> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
+ return _mm512_maskz_shldv_epi16(u, s, a, b);
+}
+
+__m512i test_mm512_shldv_epi16(__m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shldv_epi16
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_shldv_epi16
+ // LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // OGCG-LABEL: @test_mm512_shldv_epi16
+ // OGCG: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16>
+ return _mm512_shldv_epi16(s, a, b);
+}
+
+__m512i test_mm512_mask_shrdi_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shrdi_epi64
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_mask_shrdi_epi64
+ // LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64> splat (i64 47))
+ // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // OGCG-LABEL: @test_mm512_mask_shrdi_epi64
+ // OGCG: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> splat (i64 47))
+ // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
+ return _mm512_mask_shrdi_epi64(s, u, a, b, 47);
+}
+
+__m512i test_mm512_maskz_shrdi_epi64(__mmask8 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shrdi_epi64
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_maskz_shrdi_epi64
+ // LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64> splat (i64 63))
+ // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // OGCG-LABEL: @test_mm512_maskz_shrdi_epi64
+ // OGCG: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> splat (i64 63))
+ // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
+ return _mm512_maskz_shrdi_epi64(u, a, b, 63);
+}
+
+__m512i test_mm512_shrdi_epi64(__m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shrdi_epi64
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_shrdi_epi64
+ // LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64> splat (i64 31))
+ // OGCG-LABEL: @test_mm512_shrdi_epi64
+ // OGCG: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> splat (i64 31))
+ return _mm512_shrdi_epi64(a, b, 31);
+}
+
+__m512i test_mm512_mask_shrdi_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shrdi_epi32
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_mask_shrdi_epi32
+ // LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 7))
+ // LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // OGCG-LABEL: @test_mm512_mask_shrdi_epi32
+ // OGCG: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> splat (i32 7))
+ // OGCG: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
+ return _mm512_mask_shrdi_epi32(s, u, a, b, 7);
+}
+
+__m512i test_mm512_maskz_shrdi_epi32(__mmask16 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shrdi_epi32
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_maskz_shrdi_epi32
+ // LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 15))
+ // LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // OGCG-LABEL: @test_mm512_maskz_shrdi_epi32
+ // OGCG: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> splat (i32 15))
+ // OGCG: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
+ return _mm512_maskz_shrdi_epi32(u, a, b, 15);
+}
+
+__m512i test_mm512_shrdi_epi32(__m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shrdi_epi32
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_shrdi_epi32
+ // LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 31))
+ // OGCG-LABEL: @test_mm512_shrdi_epi32
+ // OGCG: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> splat (i32 31))
+ return _mm512_shrdi_epi32(a, b, 31);
+}
+
+__m512i test_mm512_mask_shrdi_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shrdi_epi16
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_mask_shrdi_epi16
+ // LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 3))
+ // LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // OGCG-LABEL: @test_mm512_mask_shrdi_epi16
+ // OGCG: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> splat (i16 3))
+ // OGCG: select <32 x i1> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
+ return _mm512_mask_shrdi_epi16(s, u, a, b, 3);
+}
+
+__m512i test_mm512_maskz_shrdi_epi16(__mmask32 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shrdi_epi16
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_maskz_shrdi_epi16
+ // LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 15))
+ // LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // OGCG-LABEL: @test_mm512_maskz_shrdi_epi16
+ // OGCG: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> splat (i16 15))
+ // OGCG: select <32 x i1> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
+ return _mm512_maskz_shrdi_epi16(u, a, b, 15);
+}
+
+__m512i test_mm512_shrdi_epi16(__m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shrdi_epi16
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_shrdi_epi16
+ // LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 31))
+ // OGCG-LABEL: @test_mm512_shrdi_epi16
+ // OGCG: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> splat (i16 31))
+ return _mm512_shrdi_epi16(a, b, 31);
+}
+
+__m512i test_mm512_mask_shldv_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shldv_epi32
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_mask_shldv_epi32
+ // LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // OGCG-LABEL: @test_mm512_mask_shldv_epi32
+ // OGCG: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32>
+ // OGCG: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
+ return _mm512_mask_shldv_epi32(s, u, a, b);
+}
+
+__m512i test_mm512_maskz_shldv_epi32(__mmask16 u, __m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shldv_epi32
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_maskz_shldv_epi32
+ // LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // OGCG-LABEL: @test_mm512_maskz_shldv_epi32
+ // OGCG: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32>
+ // OGCG: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
+ return _mm512_maskz_shldv_epi32(u, s, a, b);
+}
+
+__m512i test_mm512_mask_shrdv_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shrdv_epi64
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_mask_shrdv_epi64
+ // LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // OGCG-LABEL: @test_mm512_mask_shrdv_epi64
+ // OGCG: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64>
+ // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
+ return _mm512_mask_shrdv_epi64(s, u, a, b);
+}
+
+__m512i test_mm512_maskz_shrdv_epi64(__mmask8 u, __m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shrdv_epi64
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_maskz_shrdv_epi64
+ // LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // OGCG-LABEL: @test_mm512_maskz_shrdv_epi64
+ // OGCG: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64>
+ // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
+ return _mm512_maskz_shrdv_epi64(u, s, a, b);
+}
+
+__m512i test_mm512_mask_shrdv_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shrdv_epi32
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_mask_shrdv_epi32
+ // LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // OGCG-LABEL: @test_mm512_mask_shrdv_epi32
+ // OGCG: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32>
+ // OGCG: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
+ return _mm512_mask_shrdv_epi32(s, u, a, b);
+}
+
+__m512i test_mm512_maskz_shrdv_epi32(__mmask16 u, __m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_maskz_shrdv_epi32
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_maskz_shrdv_epi32
+ // LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // OGCG-LABEL: @test_mm512_maskz_shrdv_epi32
+ // OGCG: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32>
+ // OGCG: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
+ return _mm512_maskz_shrdv_epi32(u, s, a, b);
+}
+
+__m512i test_mm512_shrdv_epi32(__m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shrdv_epi32
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // LLVM-LABEL: @test_mm512_shrdv_epi32
+ // LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
+ // OGCG-LABEL: @test_mm512_shrdv_epi32
+ // OGCG: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32>
+ return _mm512_shrdv_epi32(s, a, b);
+}
+
+__m512i test_mm512_mask_shrdv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_mask_shrdv_epi16
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_mask_shrdv_epi16
+ // LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // OGCG-LABEL: @test_mm512_mask_shrdv_epi16
+ // OGCG: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16>
+ // OGCG: select <32 x i1> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
+ return _mm512_mask_shrdv_epi16(s, u, a, b);
+}
+
+__m512i test_mm512_shrdv_epi16(__m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @test_mm512_shrdv_epi16
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // LLVM-LABEL: @test_mm512_shrdv_epi16
+ // LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
+ // OGCG-LABEL: @test_mm512_shrdv_epi16
+ // OGCG: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16>
+ return _mm512_shrdv_epi16(s, a, b);
+}
>From 46e5a2be41111ee5a621d6a2365d6ea02dfe480b Mon Sep 17 00:00:00 2001
From: Priyanshu Kumar <10b.priyanshu at gmail.com>
Date: Thu, 5 Feb 2026 08:02:57 +0000
Subject: [PATCH 2/5] Add tests for fshl/fshr intrinsics
---
.../CodeGenBuiltins/builtins-elementwise.c | 87 +++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/clang/test/CIR/CodeGenBuiltins/builtins-elementwise.c b/clang/test/CIR/CodeGenBuiltins/builtins-elementwise.c
index f64080b829bdf..80fc0682f8126 100644
--- a/clang/test/CIR/CodeGenBuiltins/builtins-elementwise.c
+++ b/clang/test/CIR/CodeGenBuiltins/builtins-elementwise.c
@@ -6,6 +6,7 @@
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
typedef int vint4 __attribute__((ext_vector_type(4)));
+typedef short vshort8 __attribute__((ext_vector_type(8)));
typedef float vfloat4 __attribute__((ext_vector_type(4)));
typedef double vdouble4 __attribute__((ext_vector_type(4)));
@@ -116,3 +117,89 @@ void test_builtin_elementwise_cos(float f, double d, vfloat4 vf4,
// OGCG: {{%.*}} = call <4 x double> @llvm.cos.v4f64(<4 x double> {{%.*}})
vd4 = __builtin_elementwise_cos(vd4);
}
+
+void test_builtin_elementwise_fshl(long long int i1, long long int i2,
+ long long int i3, unsigned short us1,
+ unsigned short us2, unsigned short us3,
+ char c1, char c2, char c3,
+ unsigned char uc1, unsigned char uc2,
+ unsigned char uc3, vshort8 vi1,
+ vshort8 vi2, vshort8 vi3, vint4 vu1,
+ vint4 vu2, vint4 vu3) {
+ // CIR-LABEL: test_builtin_elementwise_fshl
+ // LLVM-LABEL: test_builtin_elementwise_fshl
+ // OGCG-LABEL: test_builtin_elementwise_fshl
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!s64i, !s64i, !s64i) -> !s64i
+ // LLVM: %{{.*}} = call i64 @llvm.fshl.i64(i64 %{{.*}}, i64 %{{.*}}, i64 %{{.*}})
+ // OGCG: %{{.*}} = call i64 @llvm.fshl.i64(i64 %{{.*}}, i64 %{{.*}}, i64 %{{.*}})
+ i1 = __builtin_elementwise_fshl(i1, i2, i3);
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!u16i, !u16i, !u16i) -> !u16i
+ // LLVM: %{{.*}} = call i16 @llvm.fshl.i16(i16 %{{.*}}, i16 %{{.*}}, i16 %{{.*}})
+ // OGCG: %{{.*}} = call i16 @llvm.fshl.i16(i16 %{{.*}}, i16 %{{.*}}, i16 %{{.*}})
+ us1 = __builtin_elementwise_fshl(us1, us2, us3);
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!s8i, !s8i, !s8i) -> !s8i
+ // LLVM: %{{.*}} = call i8 @llvm.fshl.i8(i8 %{{.*}}, i8 %{{.*}}, i8 %{{.*}})
+ // OGCG: %{{.*}} = call i8 @llvm.fshl.i8(i8 %{{.*}}, i8 %{{.*}}, i8 %{{.*}})
+ c1 = __builtin_elementwise_fshl(c1, c2, c3);
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!u8i, !u8i, !u8i) -> !u8i
+ // LLVM: %{{.*}} = call i8 @llvm.fshl.i8(i8 %{{.*}}, i8 %{{.*}}, i8 %{{.*}})
+ // OGCG: %{{.*}} = call i8 @llvm.fshl.i8(i8 %{{.*}}, i8 %{{.*}}, i8 %{{.*}})
+ uc1 = __builtin_elementwise_fshl(uc1, uc2, uc3);
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s16i>, !cir.vector<8 x !s16i>, !cir.vector<8 x !s16i>) -> !cir.vector<8 x !s16i>
+ // LLVM: %{{.*}} = call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}})
+ // OGCG: %{{.*}} = call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}})
+ vi1 = __builtin_elementwise_fshl(vi1, vi2, vi3);
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>) -> !cir.vector<4 x !s32i>
+ // LLVM: %{{.*}} = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}})
+ // OGCG: %{{.*}} = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}})
+ vu1 = __builtin_elementwise_fshl(vu1, vu2, vu3);
+}
+
+void test_builtin_elementwise_fshr(long long int i1, long long int i2,
+ long long int i3, unsigned short us1,
+ unsigned short us2, unsigned short us3,
+ char c1, char c2, char c3,
+ unsigned char uc1, unsigned char uc2,
+ unsigned char uc3, vshort8 vi1,
+ vshort8 vi2, vshort8 vi3, vint4 vu1,
+ vint4 vu2, vint4 vu3) {
+ // CIR-LABEL: test_builtin_elementwise_fshr
+ // LLVM-LABEL: test_builtin_elementwise_fshr
+ // OGCG-LABEL: test_builtin_elementwise_fshr
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!s64i, !s64i, !s64i) -> !s64i
+ // LLVM: %{{.*}} = call i64 @llvm.fshr.i64(i64 %{{.*}}, i64 %{{.*}}, i64 %{{.*}})
+ // OGCG: %{{.*}} = call i64 @llvm.fshr.i64(i64 %{{.*}}, i64 %{{.*}}, i64 %{{.*}})
+ i1 = __builtin_elementwise_fshr(i1, i2, i3);
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!u16i, !u16i, !u16i) -> !u16i
+ // LLVM: %{{.*}} = call i16 @llvm.fshr.i16(i16 %{{.*}}, i16 %{{.*}}, i16 %{{.*}})
+ // OGCG: %{{.*}} = call i16 @llvm.fshr.i16(i16 %{{.*}}, i16 %{{.*}}, i16 %{{.*}})
+ us1 = __builtin_elementwise_fshr(us1, us2, us3);
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!s8i, !s8i, !s8i) -> !s8i
+ // LLVM: %{{.*}} = call i8 @llvm.fshr.i8(i8 %{{.*}}, i8 %{{.*}}, i8 %{{.*}})
+ // OGCG: %{{.*}} = call i8 @llvm.fshr.i8(i8 %{{.*}}, i8 %{{.*}}, i8 %{{.*}})
+ c1 = __builtin_elementwise_fshr(c1, c2, c3);
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!u8i, !u8i, !u8i) -> !u8i
+ // LLVM: %{{.*}} = call i8 @llvm.fshr.i8(i8 %{{.*}}, i8 %{{.*}}, i8 %{{.*}})
+ // OGCG: %{{.*}} = call i8 @llvm.fshr.i8(i8 %{{.*}}, i8 %{{.*}}, i8 %{{.*}})
+ uc1 = __builtin_elementwise_fshr(uc1, uc2, uc3);
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s16i>, !cir.vector<8 x !s16i>, !cir.vector<8 x !s16i>) -> !cir.vector<8 x !s16i>
+ // LLVM: %{{.*}} = call <8 x i16> @llvm.fshr.v8i16(<8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}})
+ // OGCG: %{{.*}} = call <8 x i16> @llvm.fshr.v8i16(<8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}})
+ vi1 = __builtin_elementwise_fshr(vi1, vi2, vi3);
+
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>) -> !cir.vector<4 x !s32i>
+ // LLVM: %{{.*}} = call <4 x i32> @llvm.fshr.v4i32(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}})
+ // OGCG: %{{.*}} = call <4 x i32> @llvm.fshr.v4i32(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}})
+ vu1 = __builtin_elementwise_fshr(vu1, vu2, vu3);
+}
>From aab9d627a3faec71bfe4ccec679f8d4c3db2ece7 Mon Sep 17 00:00:00 2001
From: Priyanshu Kumar <10b.priyanshu at gmail.com>
Date: Fri, 6 Feb 2026 05:10:07 +0000
Subject: [PATCH 3/5] Update test
---
.../X86/avx512vbmi2-builtins.c | 38 ++++++++-----------
1 file changed, 16 insertions(+), 22 deletions(-)
diff --git a/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c b/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
index ae0cdf09f3f77..d2a95f47d345d 100644
--- a/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
+++ b/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
@@ -118,7 +118,7 @@ __m512i test_mm512_shldi_epi16(__m512i a, __m512i b) {
__m512i test_mm512_mask_shldv_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_mask_shldv_epi64
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.call @_mm512_mask_shldv_epi64(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u8i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_mask_shldv_epi64
// LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
@@ -131,8 +131,7 @@ __m512i test_mm512_mask_shldv_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b)
__m512i test_mm512_maskz_shldv_epi64(__mmask8 u, __m512i s, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_maskz_shldv_epi64
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // CIR: cir.call @_mm512_maskz_shldv_epi64(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u8i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shldv_epi64
// LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
// LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
@@ -144,7 +143,7 @@ __m512i test_mm512_maskz_shldv_epi64(__mmask8 u, __m512i s, __m512i a, __m512i b
__m512i test_mm512_shldv_epi64(__m512i s, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_shldv_epi64
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.call @_mm512_shldv_epi64(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shldv_epi64
// LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
// OGCG-LABEL: @test_mm512_shldv_epi64
@@ -154,7 +153,7 @@ __m512i test_mm512_shldv_epi64(__m512i s, __m512i a, __m512i b) {
__m512i test_mm512_shldv_epi32(__m512i s, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_shldv_epi32
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.call @_mm512_shldv_epi32(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shldv_epi32
// LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
// OGCG-LABEL: @test_mm512_shldv_epi32
@@ -164,7 +163,7 @@ __m512i test_mm512_shldv_epi32(__m512i s, __m512i a, __m512i b) {
__m512i test_mm512_mask_shldv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_mask_shldv_epi16
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.call @_mm512_mask_shldv_epi16(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u32i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
// LLVM-LABEL: @test_mm512_mask_shldv_epi16
// LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
@@ -177,8 +176,7 @@ __m512i test_mm512_mask_shldv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b
__m512i test_mm512_maskz_shldv_epi16(__mmask32 u, __m512i s, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_maskz_shldv_epi16
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // CIR: cir.call @_mm512_maskz_shldv_epi16(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u32i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shldv_epi16
// LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
// LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
@@ -190,7 +188,7 @@ __m512i test_mm512_maskz_shldv_epi16(__mmask32 u, __m512i s, __m512i a, __m512i
__m512i test_mm512_shldv_epi16(__m512i s, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_shldv_epi16
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.call @_mm512_shldv_epi16(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shldv_epi16
// LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
// OGCG-LABEL: @test_mm512_shldv_epi16
@@ -308,7 +306,7 @@ __m512i test_mm512_shrdi_epi16(__m512i a, __m512i b) {
__m512i test_mm512_mask_shldv_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_mask_shldv_epi32
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.call @_mm512_mask_shldv_epi32(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u16i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
// LLVM-LABEL: @test_mm512_mask_shldv_epi32
// LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -321,8 +319,7 @@ __m512i test_mm512_mask_shldv_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b
__m512i test_mm512_maskz_shldv_epi32(__mmask16 u, __m512i s, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_maskz_shldv_epi32
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // CIR: cir.call @_mm512_maskz_shldv_epi32(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u16i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shldv_epi32
// LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
// LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -334,7 +331,7 @@ __m512i test_mm512_maskz_shldv_epi32(__mmask16 u, __m512i s, __m512i a, __m512i
__m512i test_mm512_mask_shrdv_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_mask_shrdv_epi64
- // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.call @_mm512_mask_shrdv_epi64(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u8i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_mask_shrdv_epi64
// LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
@@ -347,8 +344,7 @@ __m512i test_mm512_mask_shrdv_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b)
__m512i test_mm512_maskz_shrdv_epi64(__mmask8 u, __m512i s, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_maskz_shrdv_epi64
- // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // CIR: cir.call @_mm512_maskz_shrdv_epi64(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u8i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shrdv_epi64
// LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
// LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
@@ -360,7 +356,7 @@ __m512i test_mm512_maskz_shrdv_epi64(__mmask8 u, __m512i s, __m512i a, __m512i b
__m512i test_mm512_mask_shrdv_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_mask_shrdv_epi32
- // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.call @_mm512_mask_shrdv_epi32(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u16i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
// LLVM-LABEL: @test_mm512_mask_shrdv_epi32
// LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -373,8 +369,7 @@ __m512i test_mm512_mask_shrdv_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b
__m512i test_mm512_maskz_shrdv_epi32(__mmask16 u, __m512i s, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_maskz_shrdv_epi32
- // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // CIR: cir.call @_mm512_maskz_shrdv_epi32(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u16i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shrdv_epi32
// LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
// LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -386,7 +381,7 @@ __m512i test_mm512_maskz_shrdv_epi32(__mmask16 u, __m512i s, __m512i a, __m512i
__m512i test_mm512_shrdv_epi32(__m512i s, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_shrdv_epi32
- // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.call @_mm512_shrdv_epi32(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shrdv_epi32
// LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
// OGCG-LABEL: @test_mm512_shrdv_epi32
@@ -396,8 +391,7 @@ __m512i test_mm512_shrdv_epi32(__m512i s, __m512i a, __m512i b) {
__m512i test_mm512_mask_shrdv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_mask_shrdv_epi16
- // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // CIR: cir.call @_mm512_mask_shrdv_epi16(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u32i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_mask_shrdv_epi16
// LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
// LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
@@ -409,7 +403,7 @@ __m512i test_mm512_mask_shrdv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b
__m512i test_mm512_shrdv_epi16(__m512i s, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_shrdv_epi16
- // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.call @_mm512_shrdv_epi16(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shrdv_epi16
// LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
// OGCG-LABEL: @test_mm512_shrdv_epi16
>From cd630a21180731a5c7bbbf67f9c60e3b8f71f036 Mon Sep 17 00:00:00 2001
From: Priyanshu Kumar <10b.priyanshu at gmail.com>
Date: Sat, 7 Feb 2026 14:21:03 +0000
Subject: [PATCH 4/5] Update test
---
.../X86/avx512vbmi2-builtins.c | 178 +++++++++---------
1 file changed, 89 insertions(+), 89 deletions(-)
diff --git a/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c b/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
index d2a95f47d345d..e95fcf7b7f606 100644
--- a/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
+++ b/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
@@ -8,10 +8,23 @@
#include <immintrin.h>
+__m512i test_mm512_shldv_epi64(__m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: @_mm512_shldv_epi64
+ // CIR: %{{.*}} = cir.cast bitcast %{{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<8 x !u64i>
+ // CIR: %{{.*}} = cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !u64i>, !cir.vector<8 x !u64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !u64i>
+ // CIR: %{{.*}} = cir.cast bitcast %{{.*}} : !cir.vector<8 x !u64i> -> !cir.vector<8 x !s64i>
+ // CIR-LABEL: @test_mm512_shldv_epi64
+ // CIR: %{{.*}} = cir.call @_mm512_shldv_epi64(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // LLVM-LABEL: @test_mm512_shldv_epi64
+ // LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
+ // OGCG-LABEL: @test_mm512_shldv_epi64
+ // OGCG: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64>
+ return _mm512_shldv_epi64(s, a, b);
+}
+
__m512i test_mm512_mask_shldi_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_mask_shldi_epi64
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // CIR-LABEL: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}}
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}})
// LLVM-LABEL: @test_mm512_mask_shldi_epi64
// LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64> splat (i64 47))
// LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
@@ -22,8 +35,7 @@ __m512i test_mm512_mask_shldi_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b)
}
__m512i test_mm512_maskz_shldi_epi64(__mmask8 u, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_maskz_shldi_epi64
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR-LABEL: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shldi_epi64
// LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64> splat (i64 63))
@@ -45,9 +57,9 @@ __m512i test_mm512_shldi_epi64(__m512i a, __m512i b) {
}
__m512i test_mm512_mask_shldi_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_mask_shldi_epi32
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // CIR-LABEL: test_mm512_mask_shldi_epi32
+ // CIR: cir.call_llvm_intrinsic "fshl" %7, %9, %11 : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<16 x !s32i> -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_mask_shldi_epi32
// LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 7))
// LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -58,9 +70,8 @@ __m512i test_mm512_mask_shldi_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b
}
__m512i test_mm512_maskz_shldi_epi32(__mmask16 u, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_maskz_shldi_epi32
- // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // CIR-LABEL: test_mm512_maskz_shldi_epi32
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %1{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
// LLVM-LABEL: @test_mm512_maskz_shldi_epi32
// LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 15))
// LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -71,8 +82,9 @@ __m512i test_mm512_maskz_shldi_epi32(__mmask16 u, __m512i a, __m512i b) {
}
__m512i test_mm512_shldi_epi32(__m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_shldi_epi32
+ // CIR-LABEL: test_mm512_shldi_epi32
// CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<16 x !s32i> -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shldi_epi32
// LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 31))
// OGCG-LABEL: @test_mm512_shldi_epi32
@@ -81,9 +93,9 @@ __m512i test_mm512_shldi_epi32(__m512i a, __m512i b) {
}
__m512i test_mm512_mask_shldi_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_mask_shldi_epi16
+ // CIR-LABEL: test_mm512_mask_shldi_epi16
// CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<32 x !s16i> -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_mask_shldi_epi16
// LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 3))
// LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
@@ -94,9 +106,9 @@ __m512i test_mm512_mask_shldi_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b
}
__m512i test_mm512_maskz_shldi_epi16(__mmask32 u, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_maskz_shldi_epi16
+ // CIR: test_mm512_maskz_shldi_epi16
// CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<32 x !s16i> -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shldi_epi16
// LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 15))
// LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
@@ -107,8 +119,9 @@ __m512i test_mm512_maskz_shldi_epi16(__mmask32 u, __m512i a, __m512i b) {
}
__m512i test_mm512_shldi_epi16(__m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_shldi_epi16
+ // CIR: test_mm512_shldi_epi16
// CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<32 x !s16i> -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shldi_epi16
// LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 31))
// OGCG-LABEL: @test_mm512_shldi_epi16
@@ -117,9 +130,12 @@ __m512i test_mm512_shldi_epi16(__m512i a, __m512i b) {
}
__m512i test_mm512_mask_shldv_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_mask_shldv_epi64
- // CIR: cir.call @_mm512_mask_shldv_epi64(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u8i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR-LABEL: _mm512_mask_shldv_epi64
+ // CIR: cir.call @_mm512_shldv_epi64(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.cast bitcast %{{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
+ // CIR-LABEL: test_mm512_mask_shldv_epi64
+ // CIR: cir.call @_mm512_mask_shldv_epi64(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u8i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_mask_shldv_epi64
// LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
// LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
@@ -129,30 +145,11 @@ __m512i test_mm512_mask_shldv_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b)
return _mm512_mask_shldv_epi64(s, u, a, b);
}
-__m512i test_mm512_maskz_shldv_epi64(__mmask8 u, __m512i s, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_maskz_shldv_epi64
- // CIR: cir.call @_mm512_maskz_shldv_epi64(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u8i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
- // LLVM-LABEL: @test_mm512_maskz_shldv_epi64
- // LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
- // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
- // OGCG-LABEL: @test_mm512_maskz_shldv_epi64
- // OGCG: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64>
- // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
- return _mm512_maskz_shldv_epi64(u, s, a, b);
-}
-
-__m512i test_mm512_shldv_epi64(__m512i s, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_shldv_epi64
- // CIR: cir.call @_mm512_shldv_epi64(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
- // LLVM-LABEL: @test_mm512_shldv_epi64
- // LLVM: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
- // OGCG-LABEL: @test_mm512_shldv_epi64
- // OGCG: call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64>
- return _mm512_shldv_epi64(s, a, b);
-}
-
__m512i test_mm512_shldv_epi32(__m512i s, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_shldv_epi32
+ // CIR-LABEL: _mm512_shldv_epi32
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !u32i>, !cir.vector<16 x !u32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !u32i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<16 x !u32i> -> !cir.vector<8 x !s64i>
+ // CIR-LABEL: test_mm512_shldv_epi32
// CIR: cir.call @_mm512_shldv_epi32(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shldv_epi32
// LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -162,9 +159,11 @@ __m512i test_mm512_shldv_epi32(__m512i s, __m512i a, __m512i b) {
}
__m512i test_mm512_mask_shldv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @_mm512_mask_shldv_epi16
+ // CIR: cir.call @_mm512_shldv_epi16(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<32 x !s16i>
// CIR-LABEL: @test_mm512_mask_shldv_epi16
// CIR: cir.call @_mm512_mask_shldv_epi16(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u32i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
// LLVM-LABEL: @test_mm512_mask_shldv_epi16
// LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
// LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
@@ -175,8 +174,11 @@ __m512i test_mm512_mask_shldv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b
}
__m512i test_mm512_maskz_shldv_epi16(__mmask32 u, __m512i s, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_maskz_shldv_epi16
- // CIR: cir.call @_mm512_maskz_shldv_epi16(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u32i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR-LABEL: _mm512_maskz_shldv_epi16(%arg0: !u32i {{.*}}, %arg1: !cir.vector<8 x !s64i> {{.*}}, %arg2: !cir.vector<8 x !s64i> {{.*}}, %arg3: !cir.vector<8 x !s64i> {{.*}}) -> !cir.vector<8 x !s64i>
+ // CIR: cir.call @_mm512_shldv_epi16(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<32 x !s16i>
+ // CIR-LABEL: @test_mm512_maskz_shldv_epi16(%arg0: !u32i {{.*}}, %arg1: !cir.vector<8 x !s64i> {{.*}}, %arg2: !cir.vector<8 x !s64i> {{.*}}, %arg3: !cir.vector<8 x !s64i> {{.*}}) -> !cir.vector<8 x !s64i>
+ // CIR: cir.call @_mm512_maskz_shldv_epi16(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u32i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shldv_epi16
// LLVM: call <32 x i16> @llvm.fshl.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
// LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
@@ -187,6 +189,9 @@ __m512i test_mm512_maskz_shldv_epi16(__mmask32 u, __m512i s, __m512i a, __m512i
}
__m512i test_mm512_shldv_epi16(__m512i s, __m512i a, __m512i b) {
+ // CIR-LABEL: _mm512_shldv_epi16
+ // CIR: cir.call_llvm_intrinsic "fshl" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !u16i>, !cir.vector<32 x !u16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !u16i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<32 x !u16i> -> !cir.vector<8 x !s64i>
// CIR-LABEL: @test_mm512_shldv_epi16
// CIR: cir.call @_mm512_shldv_epi16(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shldv_epi16
@@ -212,6 +217,8 @@ __m512i test_mm512_mask_shrdi_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b)
__m512i test_mm512_maskz_shrdi_epi64(__mmask8 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_maskz_shrdi_epi64
// CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.call @_mm512_setzero_si512() : () -> !cir.vector<8 x !s64i>
+ // CIR: cir.cast bitcast %{{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shrdi_epi64
// LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64> splat (i64 63))
@@ -235,6 +242,7 @@ __m512i test_mm512_shrdi_epi64(__m512i a, __m512i b) {
__m512i test_mm512_mask_shrdi_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_mask_shrdi_epi32
// CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<16 x !s32i> -> !cir.vector<8 x !s64i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
// LLVM-LABEL: @test_mm512_mask_shrdi_epi32
// LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 7))
@@ -248,6 +256,7 @@ __m512i test_mm512_mask_shrdi_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b
__m512i test_mm512_maskz_shrdi_epi32(__mmask16 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_maskz_shrdi_epi32
// CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<16 x !s32i> -> !cir.vector<8 x !s64i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
// LLVM-LABEL: @test_mm512_maskz_shrdi_epi32
// LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 15))
@@ -261,6 +270,7 @@ __m512i test_mm512_maskz_shrdi_epi32(__mmask16 u, __m512i a, __m512i b) {
__m512i test_mm512_shrdi_epi32(__m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_shrdi_epi32
// CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<16 x !s32i> -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shrdi_epi32
// LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32> splat (i32 31))
// OGCG-LABEL: @test_mm512_shrdi_epi32
@@ -271,6 +281,7 @@ __m512i test_mm512_shrdi_epi32(__m512i a, __m512i b) {
__m512i test_mm512_mask_shrdi_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_mask_shrdi_epi16
// CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<32 x !s16i> -> !cir.vector<8 x !s64i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
// LLVM-LABEL: @test_mm512_mask_shrdi_epi16
// LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 3))
@@ -284,6 +295,7 @@ __m512i test_mm512_mask_shrdi_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b
__m512i test_mm512_maskz_shrdi_epi16(__mmask32 u, __m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_maskz_shrdi_epi16
// CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<32 x !s16i> -> !cir.vector<8 x !s64i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
// LLVM-LABEL: @test_mm512_maskz_shrdi_epi16
// LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 15))
@@ -297,6 +309,7 @@ __m512i test_mm512_maskz_shrdi_epi16(__mmask32 u, __m512i a, __m512i b) {
__m512i test_mm512_shrdi_epi16(__m512i a, __m512i b) {
// CIR-LABEL: @test_mm512_shrdi_epi16
// CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !s16i>, !cir.vector<32 x !s16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !s16i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<32 x !s16i> -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shrdi_epi16
// LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16> splat (i16 31))
// OGCG-LABEL: @test_mm512_shrdi_epi16
@@ -305,9 +318,12 @@ __m512i test_mm512_shrdi_epi16(__m512i a, __m512i b) {
}
__m512i test_mm512_mask_shldv_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_mask_shldv_epi32
- // CIR: cir.call @_mm512_mask_shldv_epi32(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u16i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR-LABEL: _mm512_mask_shldv_epi32
+ // CIR: cir.call @_mm512_shldv_epi32(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<16 x !s32i>
// CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // CIR-LABEL: test_mm512_mask_shldv_epi32
+ // CIR: cir.call @_mm512_mask_shldv_epi32(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u16i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_mask_shldv_epi32
// LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
// LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -318,7 +334,12 @@ __m512i test_mm512_mask_shldv_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b
}
__m512i test_mm512_maskz_shldv_epi32(__mmask16 u, __m512i s, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_maskz_shldv_epi32
+ // CIR-LABEL: _mm512_maskz_shldv_epi32
+ // CIR: cir.call @_mm512_shldv_epi32(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<16 x !s32i>
+ // CIR: cir.call @_mm512_setzero_si512() : () -> !cir.vector<8 x !s64i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // CIR-LABEL: test_mm512_maskz_shldv_epi32
// CIR: cir.call @_mm512_maskz_shldv_epi32(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u16i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shldv_epi32
// LLVM: call <16 x i32> @llvm.fshl.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -329,35 +350,13 @@ __m512i test_mm512_maskz_shldv_epi32(__mmask16 u, __m512i s, __m512i a, __m512i
return _mm512_maskz_shldv_epi32(u, s, a, b);
}
-__m512i test_mm512_mask_shrdv_epi64(__m512i s, __mmask8 u, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_mask_shrdv_epi64
- // CIR: cir.call @_mm512_mask_shrdv_epi64(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u8i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s64i>
- // LLVM-LABEL: @test_mm512_mask_shrdv_epi64
- // LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
- // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
- // OGCG-LABEL: @test_mm512_mask_shrdv_epi64
- // OGCG: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64>
- // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
- return _mm512_mask_shrdv_epi64(s, u, a, b);
-}
-
-__m512i test_mm512_maskz_shrdv_epi64(__mmask8 u, __m512i s, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_maskz_shrdv_epi64
- // CIR: cir.call @_mm512_maskz_shrdv_epi64(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u8i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
- // LLVM-LABEL: @test_mm512_maskz_shrdv_epi64
- // LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
- // LLVM: select <8 x i1> {{.*}}, <8 x i64> {{.*}}, <8 x i64>
- // OGCG-LABEL: @test_mm512_maskz_shrdv_epi64
- // OGCG: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64>
- // OGCG: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
- return _mm512_maskz_shrdv_epi64(u, s, a, b);
-}
-
__m512i test_mm512_mask_shrdv_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b) {
+ // CIR-LABEL: @_mm512_shrdv_epi32
+ // CIR: cir.call @_mm512_shrdv_epi32(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<16 x !s32i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
// CIR-LABEL: @test_mm512_mask_shrdv_epi32
// CIR: cir.call @_mm512_mask_shrdv_epi32(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u16i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
- // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
// LLVM-LABEL: @test_mm512_mask_shrdv_epi32
// LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
// LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -368,8 +367,13 @@ __m512i test_mm512_mask_shrdv_epi32(__m512i s, __mmask16 u, __m512i a, __m512i b
}
__m512i test_mm512_maskz_shrdv_epi32(__mmask16 u, __m512i s, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_maskz_shrdv_epi32
- // CIR: cir.call @_mm512_maskz_shrdv_epi32(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!u16i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR-LABEL: _mm512_maskz_shrdv_epi32
+ // CIR: cir.call @_mm512_shrdv_epi32(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<16 x !s32i>
+ // CIR: cir.call @_mm512_setzero_si512() : () -> !cir.vector<8 x !s64i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<16 x !cir.int<s, 1>>, !cir.vector<16 x !s32i>
+ // CIR-LABEL: test_mm512_maskz_shrdv_epi32
+ // CIR: cir.call @_mm512_maskz_shrdv_epi32(%5, %6, %7, %8) : (!u16i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_maskz_shrdv_epi32
// LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
// LLVM: select <16 x i1> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
@@ -379,20 +383,13 @@ __m512i test_mm512_maskz_shrdv_epi32(__mmask16 u, __m512i s, __m512i a, __m512i
return _mm512_maskz_shrdv_epi32(u, s, a, b);
}
-__m512i test_mm512_shrdv_epi32(__m512i s, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_shrdv_epi32
- // CIR: cir.call @_mm512_shrdv_epi32(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
- // LLVM-LABEL: @test_mm512_shrdv_epi32
- // LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> {{.*}}, <16 x i32> {{.*}}, <16 x i32>
- // OGCG-LABEL: @test_mm512_shrdv_epi32
- // OGCG: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32>
- return _mm512_shrdv_epi32(s, a, b);
-}
-
__m512i test_mm512_mask_shrdv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_mask_shrdv_epi16
+ // CIR-LABEL: _mm512_mask_shrdv_epi16
+ // CIR: cir.call @_mm512_shrdv_epi16(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<32 x !s16i>
+ // CIR: cir.vec.ternary(%{{.*}}, %{{.*}}, %{{.*}}) : !cir.vector<32 x !cir.int<s, 1>>, !cir.vector<32 x !s16i>
+ // CIR-LABEL: test_mm512_mask_shrdv_epi16
// CIR: cir.call @_mm512_mask_shrdv_epi16(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !u32i, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
- // LLVM-LABEL: @test_mm512_mask_shrdv_epi16
// LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
// LLVM: select <32 x i1> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
// OGCG-LABEL: @test_mm512_mask_shrdv_epi16
@@ -402,7 +399,10 @@ __m512i test_mm512_mask_shrdv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b
}
__m512i test_mm512_shrdv_epi16(__m512i s, __m512i a, __m512i b) {
- // CIR-LABEL: @test_mm512_shrdv_epi16
+ // CIR-LABEL: _mm512_shrdv_epi16
+ // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !u16i>, !cir.vector<32 x !u16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !u16i>
+ // CIR: cir.cast bitcast %{{.*}} : !cir.vector<32 x !u16i> -> !cir.vector<8 x !s64i>
+ // CIR-LABEL: test_mm512_shrdv_epi16
// CIR: cir.call @_mm512_shrdv_epi16(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
// LLVM-LABEL: @test_mm512_shrdv_epi16
// LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
>From 98bf8889ea04bd771eb4b8ed1234533fdcb84b9d Mon Sep 17 00:00:00 2001
From: Priyanshu Kumar <10b.priyanshu at gmail.com>
Date: Sat, 7 Feb 2026 20:59:36 +0530
Subject: [PATCH 5/5] Update test
Removed the test function for the _mm512_shrdv_epi16 intrinsic.
---
.../CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c b/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
index e95fcf7b7f606..5a934a9d87f89 100644
--- a/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
+++ b/clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c
@@ -398,15 +398,3 @@ __m512i test_mm512_mask_shrdv_epi16(__m512i s, __mmask32 u, __m512i a, __m512i b
return _mm512_mask_shrdv_epi16(s, u, a, b);
}
-__m512i test_mm512_shrdv_epi16(__m512i s, __m512i a, __m512i b) {
- // CIR-LABEL: _mm512_shrdv_epi16
- // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}, %{{.*}}, %{{.*}} : (!cir.vector<32 x !u16i>, !cir.vector<32 x !u16i>, !cir.vector<32 x !u16i>) -> !cir.vector<32 x !u16i>
- // CIR: cir.cast bitcast %{{.*}} : !cir.vector<32 x !u16i> -> !cir.vector<8 x !s64i>
- // CIR-LABEL: test_mm512_shrdv_epi16
- // CIR: cir.call @_mm512_shrdv_epi16(%{{.*}}, %{{.*}}, %{{.*}}) : (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>) -> !cir.vector<8 x !s64i>
- // LLVM-LABEL: @test_mm512_shrdv_epi16
- // LLVM: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> {{.*}}, <32 x i16> {{.*}}, <32 x i16>
- // OGCG-LABEL: @test_mm512_shrdv_epi16
- // OGCG: call <32 x i16> @llvm.fshr.v32i16(<32 x i16> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16>
- return _mm512_shrdv_epi16(s, a, b);
-}
More information about the cfe-commits
mailing list