diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -3367,6 +3367,14 @@ defm "" : VPatBinaryV_XM<"int_riscv_vfmerge", "PseudoVFMERGE", /*CarryOut = */0, /*vtilist=*/AllFloatVectors>; +foreach fvti = AllFloatVectors in { + defvar instr = !cast("PseudoVMERGE_VIM_"#fvti.LMul.MX); + def : Pat<(fvti.Vector (int_riscv_vfmerge (fvti.Vector fvti.RegClass:$rs2), + (fvti.Scalar (fpimm0)), + (fvti.Mask V0), (XLenVT GPR:$vl))), + (instr fvti.RegClass:$rs2, 0, (fvti.Mask V0), (NoX0 GPR:$vl), fvti.SEW)>; +} + //===----------------------------------------------------------------------===// // 14.16. Vector Floating-Point Move Instruction //===----------------------------------------------------------------------===// diff --git a/llvm/test/CodeGen/RISCV/rvv/vfmerge-rv32.ll b/llvm/test/CodeGen/RISCV/rvv/vfmerge-rv32.ll --- a/llvm/test/CodeGen/RISCV/rvv/vfmerge-rv32.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vfmerge-rv32.ll @@ -439,3 +439,157 @@ ret %a } + +define @intrinsic_vfmerge_vzm_nxv1f16_nxv1f16_f16( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv1f16_nxv1f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,mf4,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv1f16.f16( + %0, + half zeroinitializer, + %1, + i32 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv2f16_nxv2f16_f16( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv2f16_nxv2f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,mf2,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv2f16.f16( + %0, + half zeroinitializer, + %1, + i32 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv4f16_nxv4f16_f16( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv4f16_nxv4f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,m1,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv4f16.f16( + %0, + half zeroinitializer, + %1, + i32 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv8f16_nxv8f16_f16( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv8f16_nxv8f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,m2,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv8f16.f16( + %0, + half zeroinitializer, + %1, + i32 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv16f16_nxv16f16_f16( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv16f16_nxv16f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,m4,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv16f16.f16( + %0, + half zeroinitializer, + %1, + i32 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv32f16_nxv32f16_f16( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv32f16_nxv32f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,m8,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv32f16.f16( + %0, + half zeroinitializer, + %1, + i32 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv1f32_nxv1f32_f32( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv1f32_nxv1f32_f32 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e32,mf2,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv1f32.f32( + %0, + float zeroinitializer, + %1, + i32 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv2f32_nxv2f32_f32( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv2f32_nxv2f32_f32 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e32,m1,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv2f32.f32( + %0, + float zeroinitializer, + %1, + i32 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv4f32_nxv4f32_f32( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv4f32_nxv4f32_f32 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e32,m2,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv4f32.f32( + %0, + float zeroinitializer, + %1, + i32 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv8f32_nxv8f32_f32( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv8f32_nxv8f32_f32 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e32,m4,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv8f32.f32( + %0, + float zeroinitializer, + %1, + i32 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv16f32_nxv16f32_f32( %0, %1, i32 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv16f32_nxv16f32_f32 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e32,m8,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv16f32.f32( + %0, + float zeroinitializer, + %1, + i32 %2) + + ret %a +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vfmerge-rv64.ll b/llvm/test/CodeGen/RISCV/rvv/vfmerge-rv64.ll --- a/llvm/test/CodeGen/RISCV/rvv/vfmerge-rv64.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vfmerge-rv64.ll @@ -599,3 +599,213 @@ ret %a } + +define @intrinsic_vfmerge_vzm_nxv1f16_nxv1f16_f16( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv1f16_nxv1f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,mf4,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv1f16.f16( + %0, + half zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv2f16_nxv2f16_f16( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv2f16_nxv2f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,mf2,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv2f16.f16( + %0, + half zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv4f16_nxv4f16_f16( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv4f16_nxv4f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,m1,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv4f16.f16( + %0, + half zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv8f16_nxv8f16_f16( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv8f16_nxv8f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,m2,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv8f16.f16( + %0, + half zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv16f16_nxv16f16_f16( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv16f16_nxv16f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,m4,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv16f16.f16( + %0, + half zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv32f16_nxv32f16_f16( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv32f16_nxv32f16_f16 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e16,m8,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv32f16.f16( + %0, + half zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv1f32_nxv1f32_f32( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv1f32_nxv1f32_f32 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e32,mf2,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv1f32.f32( + %0, + float zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv2f32_nxv2f32_f32( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv2f32_nxv2f32_f32 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e32,m1,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv2f32.f32( + %0, + float zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv4f32_nxv4f32_f32( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv4f32_nxv4f32_f32 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e32,m2,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv4f32.f32( + %0, + float zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv8f32_nxv8f32_f32( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv8f32_nxv8f32_f32 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e32,m4,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv8f32.f32( + %0, + float zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv16f32_nxv16f32_f32( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv16f32_nxv16f32_f32 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e32,m8,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv16f32.f32( + %0, + float zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv1f64_nxv1f64_f64( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv1f64_nxv1f64_f64 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e64,m1,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv1f64.f64( + %0, + double zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv2f64_nxv2f64_f64( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv2f64_nxv2f64_f64 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e64,m2,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv2f64.f64( + %0, + double zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv4f64_nxv4f64_f64( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv4f64_nxv4f64_f64 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e64,m4,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv4f64.f64( + %0, + double zeroinitializer, + %1, + i64 %2) + + ret %a +} + +define @intrinsic_vfmerge_vzm_nxv8f64_nxv8f64_f64( %0, %1, i64 %2) nounwind { +entry: +; CHECK-LABEL: intrinsic_vfmerge_vzm_nxv8f64_nxv8f64_f64 +; CHECK: vsetvli {{.*}}, {{a[0-9]+}}, e64,m8,ta,mu +; CHECK: vmerge.vim {{v[0-9]+}}, {{v[0-9]+}}, 0, v0 + %a = call @llvm.riscv.vfmerge.nxv8f64.f64( + %0, + double zeroinitializer, + %1, + i64 %2) + + ret %a +}