diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -13764,8 +13764,8 @@ return TailMBB; } -static MachineBasicBlock * -emitVFCVT_RM_MASK(MachineInstr &MI, MachineBasicBlock *BB, unsigned Opcode) { +static MachineBasicBlock *emitVFCVT_RM(MachineInstr &MI, MachineBasicBlock *BB, + unsigned Opcode) { DebugLoc DL = MI.getDebugLoc(); const TargetInstrInfo &TII = *BB->getParent()->getSubtarget().getInstrInfo(); @@ -13773,20 +13773,20 @@ MachineRegisterInfo &MRI = BB->getParent()->getRegInfo(); Register SavedFRM = MRI.createVirtualRegister(&RISCV::GPRRegClass); + assert(MI.getNumOperands() == 8 || MI.getNumOperands() == 7); + unsigned FRMIdx = MI.getNumOperands() == 8 ? 4 : 3; + // Update FRM and save the old value. BuildMI(*BB, MI, DL, TII.get(RISCV::SwapFRMImm), SavedFRM) - .addImm(MI.getOperand(4).getImm()); + .addImm(MI.getOperand(FRMIdx).getImm()); // Emit an VFCVT without the FRM operand. - assert(MI.getNumOperands() == 8); - auto MIB = BuildMI(*BB, MI, DL, TII.get(Opcode)) - .add(MI.getOperand(0)) - .add(MI.getOperand(1)) - .add(MI.getOperand(2)) - .add(MI.getOperand(3)) - .add(MI.getOperand(5)) - .add(MI.getOperand(6)) - .add(MI.getOperand(7)); + auto MIB = BuildMI(*BB, MI, DL, TII.get(Opcode)); + + for (unsigned I = 0; I < MI.getNumOperands(); I++) + if (I != FRMIdx) + MIB = MIB.add(MI.getOperand(I)); + if (MI.getFlag(MachineInstr::MIFlag::NoFPExcept)) MIB->setFlag(MachineInstr::MIFlag::NoFPExcept); @@ -14036,8 +14036,10 @@ Subtarget); #define PseudoVFCVT_RM_LMUL_CASE(RMOpc, Opc, LMUL) \ + case RISCV::RMOpc##_##LMUL: \ + return emitVFCVT_RM(MI, BB, RISCV::Opc##_##LMUL); \ case RISCV::RMOpc##_##LMUL##_MASK: \ - return emitVFCVT_RM_MASK(MI, BB, RISCV::Opc##_##LMUL##_MASK); + return emitVFCVT_RM(MI, BB, RISCV::Opc##_##LMUL##_MASK); #define PseudoVFCVT_RM_CASE(RMOpc, Opc) \ PseudoVFCVT_RM_LMUL_CASE(RMOpc, Opc, M1) \ 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 @@ -1054,6 +1054,20 @@ let usesCustomInserter = 1; } +class VPseudoUnaryNoMask_FRM : + Pseudo<(outs GetVRegNoV0.R:$rd), + (ins GetVRegNoV0.R:$merge, OpClass:$rs2, + ixlenimm:$frm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []> { + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; + let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let HasVLOp = 1; + let HasSEWOp = 1; + let HasVecPolicyOp = 1; + let usesCustomInserter = 1; +} + class VPseudoUnaryMask_FRM : Pseudo<(outs GetVRegNoV0.R:$rd), (ins GetVRegNoV0.R:$merge, OpClass:$rs2, @@ -3515,8 +3529,13 @@ LMULInfo MInfo, string Constraint = ""> { let VLMul = MInfo.value in { - def "_" # MInfo.MX # "_MASK" : VPseudoUnaryMask_FRM; + def "_" # MInfo.MX # "_MASK" : VPseudoUnaryMask_FRM, + RISCVMaskedPseudo; } } diff --git a/llvm/test/CodeGen/RISCV/rvv/ctlz-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/ctlz-sdnode.ll --- a/llvm/test/CodeGen/RISCV/rvv/ctlz-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/ctlz-sdnode.ll @@ -960,10 +960,9 @@ ; ; CHECK-F-LABEL: ctlz_nxv1i32: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 158 ; CHECK-F-NEXT: vrsub.vx v8, v8, a1 @@ -1066,10 +1065,9 @@ ; ; CHECK-F-LABEL: ctlz_nxv2i32: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m1, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m1, ta, ma +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 158 ; CHECK-F-NEXT: vrsub.vx v8, v8, a1 @@ -1172,10 +1170,9 @@ ; ; CHECK-F-LABEL: ctlz_nxv4i32: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 158 ; CHECK-F-NEXT: vrsub.vx v8, v8, a1 @@ -1278,10 +1275,9 @@ ; ; CHECK-F-LABEL: ctlz_nxv8i32: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m4, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 158 ; CHECK-F-NEXT: vrsub.vx v8, v8, a1 @@ -1384,10 +1380,9 @@ ; ; CHECK-F-LABEL: ctlz_nxv16i32: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m8, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m8, ta, ma +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 158 ; CHECK-F-NEXT: vrsub.vx v8, v8, a1 @@ -1398,10 +1393,9 @@ ; ; CHECK-D-LABEL: ctlz_nxv16i32: ; CHECK-D: # %bb.0: -; CHECK-D-NEXT: vsetvli a0, zero, e32, m8, ta, ma -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vsetvli a1, zero, e32, m8, ta, ma +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: vsrl.vi v8, v8, 23 ; CHECK-D-NEXT: li a1, 158 ; CHECK-D-NEXT: vrsub.vx v8, v8, a1 @@ -1524,10 +1518,9 @@ ; ; CHECK-F-LABEL: ctlz_nxv1i64: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfncvt.f.xu.w v9, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; CHECK-F-NEXT: vfncvt.f.xu.w v9, v8 ; CHECK-F-NEXT: vsrl.vi v8, v9, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m1, ta, ma ; CHECK-F-NEXT: vzext.vf2 v9, v8 @@ -1540,10 +1533,9 @@ ; ; CHECK-D-LABEL: ctlz_nxv1i64: ; CHECK-D: # %bb.0: -; CHECK-D-NEXT: vsetvli a0, zero, e64, m1, ta, ma -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vsetvli a1, zero, e64, m1, ta, ma +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1086 @@ -1667,10 +1659,9 @@ ; ; CHECK-F-LABEL: ctlz_nxv2i64: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m1, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfncvt.f.xu.w v10, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m1, ta, ma +; CHECK-F-NEXT: vfncvt.f.xu.w v10, v8 ; CHECK-F-NEXT: vsrl.vi v8, v10, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m2, ta, ma ; CHECK-F-NEXT: vzext.vf2 v10, v8 @@ -1683,10 +1674,9 @@ ; ; CHECK-D-LABEL: ctlz_nxv2i64: ; CHECK-D: # %bb.0: -; CHECK-D-NEXT: vsetvli a0, zero, e64, m2, ta, ma -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vsetvli a1, zero, e64, m2, ta, ma +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1086 @@ -1810,10 +1800,9 @@ ; ; CHECK-F-LABEL: ctlz_nxv4i64: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfncvt.f.xu.w v12, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; CHECK-F-NEXT: vfncvt.f.xu.w v12, v8 ; CHECK-F-NEXT: vsrl.vi v8, v12, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m4, ta, ma ; CHECK-F-NEXT: vzext.vf2 v12, v8 @@ -1826,10 +1815,9 @@ ; ; CHECK-D-LABEL: ctlz_nxv4i64: ; CHECK-D: # %bb.0: -; CHECK-D-NEXT: vsetvli a0, zero, e64, m4, ta, ma -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vsetvli a1, zero, e64, m4, ta, ma +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1086 @@ -1953,10 +1941,9 @@ ; ; CHECK-F-LABEL: ctlz_nxv8i64: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m4, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfncvt.f.xu.w v16, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-F-NEXT: vfncvt.f.xu.w v16, v8 ; CHECK-F-NEXT: vsrl.vi v8, v16, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m8, ta, ma ; CHECK-F-NEXT: vzext.vf2 v16, v8 @@ -1969,10 +1956,9 @@ ; ; CHECK-D-LABEL: ctlz_nxv8i64: ; CHECK-D: # %bb.0: -; CHECK-D-NEXT: vsetvli a0, zero, e64, m8, ta, ma -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vsetvli a1, zero, e64, m8, ta, ma +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1086 @@ -2887,10 +2873,9 @@ ; ; CHECK-F-LABEL: ctlz_zero_undef_nxv1i32: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 158 ; CHECK-F-NEXT: vrsub.vx v8, v8, a1 @@ -2988,10 +2973,9 @@ ; ; CHECK-F-LABEL: ctlz_zero_undef_nxv2i32: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m1, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m1, ta, ma +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 158 ; CHECK-F-NEXT: vrsub.vx v8, v8, a1 @@ -3089,10 +3073,9 @@ ; ; CHECK-F-LABEL: ctlz_zero_undef_nxv4i32: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 158 ; CHECK-F-NEXT: vrsub.vx v8, v8, a1 @@ -3190,10 +3173,9 @@ ; ; CHECK-F-LABEL: ctlz_zero_undef_nxv8i32: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m4, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 158 ; CHECK-F-NEXT: vrsub.vx v8, v8, a1 @@ -3291,10 +3273,9 @@ ; ; CHECK-F-LABEL: ctlz_zero_undef_nxv16i32: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m8, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m8, ta, ma +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 158 ; CHECK-F-NEXT: vrsub.vx v8, v8, a1 @@ -3303,10 +3284,9 @@ ; ; CHECK-D-LABEL: ctlz_zero_undef_nxv16i32: ; CHECK-D: # %bb.0: -; CHECK-D-NEXT: vsetvli a0, zero, e32, m8, ta, ma -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vsetvli a1, zero, e32, m8, ta, ma +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: vsrl.vi v8, v8, 23 ; CHECK-D-NEXT: li a1, 158 ; CHECK-D-NEXT: vrsub.vx v8, v8, a1 @@ -3426,10 +3406,9 @@ ; ; CHECK-F-LABEL: ctlz_zero_undef_nxv1i64: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfncvt.f.xu.w v9, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; CHECK-F-NEXT: vfncvt.f.xu.w v9, v8 ; CHECK-F-NEXT: vsrl.vi v8, v9, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m1, ta, ma ; CHECK-F-NEXT: vzext.vf2 v9, v8 @@ -3440,10 +3419,9 @@ ; ; CHECK-D-LABEL: ctlz_zero_undef_nxv1i64: ; CHECK-D: # %bb.0: -; CHECK-D-NEXT: vsetvli a0, zero, e64, m1, ta, ma -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vsetvli a1, zero, e64, m1, ta, ma +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1086 @@ -3564,10 +3542,9 @@ ; ; CHECK-F-LABEL: ctlz_zero_undef_nxv2i64: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m1, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfncvt.f.xu.w v10, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m1, ta, ma +; CHECK-F-NEXT: vfncvt.f.xu.w v10, v8 ; CHECK-F-NEXT: vsrl.vi v8, v10, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m2, ta, ma ; CHECK-F-NEXT: vzext.vf2 v10, v8 @@ -3578,10 +3555,9 @@ ; ; CHECK-D-LABEL: ctlz_zero_undef_nxv2i64: ; CHECK-D: # %bb.0: -; CHECK-D-NEXT: vsetvli a0, zero, e64, m2, ta, ma -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vsetvli a1, zero, e64, m2, ta, ma +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1086 @@ -3702,10 +3678,9 @@ ; ; CHECK-F-LABEL: ctlz_zero_undef_nxv4i64: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfncvt.f.xu.w v12, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; CHECK-F-NEXT: vfncvt.f.xu.w v12, v8 ; CHECK-F-NEXT: vsrl.vi v8, v12, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m4, ta, ma ; CHECK-F-NEXT: vzext.vf2 v12, v8 @@ -3716,10 +3691,9 @@ ; ; CHECK-D-LABEL: ctlz_zero_undef_nxv4i64: ; CHECK-D: # %bb.0: -; CHECK-D-NEXT: vsetvli a0, zero, e64, m4, ta, ma -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vsetvli a1, zero, e64, m4, ta, ma +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1086 @@ -3840,10 +3814,9 @@ ; ; CHECK-F-LABEL: ctlz_zero_undef_nxv8i64: ; CHECK-F: # %bb.0: -; CHECK-F-NEXT: vsetvli a0, zero, e32, m4, ta, ma -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfncvt.f.xu.w v16, v8, v0.t +; CHECK-F-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-F-NEXT: vfncvt.f.xu.w v16, v8 ; CHECK-F-NEXT: vsrl.vi v8, v16, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m8, ta, ma ; CHECK-F-NEXT: vzext.vf2 v16, v8 @@ -3854,10 +3827,9 @@ ; ; CHECK-D-LABEL: ctlz_zero_undef_nxv8i64: ; CHECK-D: # %bb.0: -; CHECK-D-NEXT: vsetvli a0, zero, e64, m8, ta, ma -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vsetvli a1, zero, e64, m8, ta, ma +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1086 diff --git a/llvm/test/CodeGen/RISCV/rvv/cttz-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/cttz-sdnode.ll --- a/llvm/test/CodeGen/RISCV/rvv/cttz-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/cttz-sdnode.ll @@ -928,9 +928,8 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e32, mf2, ta, ma ; CHECK-F-NEXT: vrsub.vi v9, v8, 0 ; CHECK-F-NEXT: vand.vv v9, v8, v9 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v9, v9, v0.t +; CHECK-F-NEXT: vfcvt.f.xu.v v9, v9 ; CHECK-F-NEXT: vsrl.vi v9, v9, 23 ; CHECK-F-NEXT: li a1, 127 ; CHECK-F-NEXT: vsub.vx v9, v9, a1 @@ -1026,9 +1025,8 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e32, m1, ta, ma ; CHECK-F-NEXT: vrsub.vi v9, v8, 0 ; CHECK-F-NEXT: vand.vv v9, v8, v9 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v9, v9, v0.t +; CHECK-F-NEXT: vfcvt.f.xu.v v9, v9 ; CHECK-F-NEXT: vsrl.vi v9, v9, 23 ; CHECK-F-NEXT: li a1, 127 ; CHECK-F-NEXT: vsub.vx v9, v9, a1 @@ -1124,9 +1122,8 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e32, m2, ta, ma ; CHECK-F-NEXT: vrsub.vi v10, v8, 0 ; CHECK-F-NEXT: vand.vv v10, v8, v10 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; CHECK-F-NEXT: vfcvt.f.xu.v v10, v10 ; CHECK-F-NEXT: vsrl.vi v10, v10, 23 ; CHECK-F-NEXT: li a1, 127 ; CHECK-F-NEXT: vsub.vx v10, v10, a1 @@ -1222,9 +1219,8 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e32, m4, ta, ma ; CHECK-F-NEXT: vrsub.vi v12, v8, 0 ; CHECK-F-NEXT: vand.vv v12, v8, v12 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v12, v12, v0.t +; CHECK-F-NEXT: vfcvt.f.xu.v v12, v12 ; CHECK-F-NEXT: vsrl.vi v12, v12, 23 ; CHECK-F-NEXT: li a1, 127 ; CHECK-F-NEXT: vsub.vx v12, v12, a1 @@ -1320,9 +1316,8 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e32, m8, ta, ma ; CHECK-F-NEXT: vrsub.vi v16, v8, 0 ; CHECK-F-NEXT: vand.vv v16, v8, v16 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v16, v16, v0.t +; CHECK-F-NEXT: vfcvt.f.xu.v v16, v16 ; CHECK-F-NEXT: vsrl.vi v16, v16, 23 ; CHECK-F-NEXT: li a1, 127 ; CHECK-F-NEXT: vsub.vx v16, v16, a1 @@ -1337,9 +1332,8 @@ ; CHECK-D-NEXT: vsetvli a0, zero, e32, m8, ta, ma ; CHECK-D-NEXT: vrsub.vi v16, v8, 0 ; CHECK-D-NEXT: vand.vv v16, v8, v16 -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v16, v16, v0.t +; CHECK-D-NEXT: vfcvt.f.xu.v v16, v16 ; CHECK-D-NEXT: vsrl.vi v16, v16, 23 ; CHECK-D-NEXT: li a1, 127 ; CHECK-D-NEXT: vsub.vx v16, v16, a1 @@ -1446,10 +1440,9 @@ ; RV32F-NEXT: vsetvli a0, zero, e64, m1, ta, ma ; RV32F-NEXT: vrsub.vi v9, v8, 0 ; RV32F-NEXT: vand.vv v9, v8, v9 -; RV32F-NEXT: vmset.m v0 ; RV32F-NEXT: fsrmi a0, 1 ; RV32F-NEXT: vsetvli zero, zero, e32, mf2, ta, ma -; RV32F-NEXT: vfncvt.f.xu.w v10, v9, v0.t +; RV32F-NEXT: vfncvt.f.xu.w v10, v9 ; RV32F-NEXT: vsrl.vi v9, v10, 23 ; RV32F-NEXT: vsetvli zero, zero, e64, m1, ta, ma ; RV32F-NEXT: vzext.vf2 v10, v9 @@ -1466,10 +1459,9 @@ ; RV64F-NEXT: vsetvli a0, zero, e64, m1, ta, ma ; RV64F-NEXT: vrsub.vi v9, v8, 0 ; RV64F-NEXT: vand.vv v9, v8, v9 -; RV64F-NEXT: vmset.m v0 ; RV64F-NEXT: fsrmi a0, 1 ; RV64F-NEXT: vsetvli zero, zero, e32, mf2, ta, ma -; RV64F-NEXT: vfncvt.f.xu.w v10, v9, v0.t +; RV64F-NEXT: vfncvt.f.xu.w v10, v9 ; RV64F-NEXT: vsrl.vi v9, v10, 23 ; RV64F-NEXT: vsetvli zero, zero, e64, m1, ta, ma ; RV64F-NEXT: vzext.vf2 v10, v9 @@ -1486,9 +1478,8 @@ ; RV32D-NEXT: vsetvli a0, zero, e64, m1, ta, ma ; RV32D-NEXT: vrsub.vi v9, v8, 0 ; RV32D-NEXT: vand.vv v9, v8, v9 -; RV32D-NEXT: vmset.m v0 ; RV32D-NEXT: fsrmi a0, 1 -; RV32D-NEXT: vfcvt.f.xu.v v9, v9, v0.t +; RV32D-NEXT: vfcvt.f.xu.v v9, v9 ; RV32D-NEXT: li a1, 52 ; RV32D-NEXT: vsrl.vx v9, v9, a1 ; RV32D-NEXT: li a1, 1023 @@ -1504,9 +1495,8 @@ ; RV64D-NEXT: vsetvli a0, zero, e64, m1, ta, ma ; RV64D-NEXT: vrsub.vi v9, v8, 0 ; RV64D-NEXT: vand.vv v9, v8, v9 -; RV64D-NEXT: vmset.m v0 ; RV64D-NEXT: fsrmi a0, 1 -; RV64D-NEXT: vfcvt.f.xu.v v9, v9, v0.t +; RV64D-NEXT: vfcvt.f.xu.v v9, v9 ; RV64D-NEXT: li a1, 52 ; RV64D-NEXT: vsrl.vx v9, v9, a1 ; RV64D-NEXT: li a1, 1023 @@ -1614,10 +1604,9 @@ ; RV32F-NEXT: vsetvli a0, zero, e64, m2, ta, ma ; RV32F-NEXT: vrsub.vi v10, v8, 0 ; RV32F-NEXT: vand.vv v10, v8, v10 -; RV32F-NEXT: vmset.m v0 ; RV32F-NEXT: fsrmi a0, 1 ; RV32F-NEXT: vsetvli zero, zero, e32, m1, ta, ma -; RV32F-NEXT: vfncvt.f.xu.w v12, v10, v0.t +; RV32F-NEXT: vfncvt.f.xu.w v12, v10 ; RV32F-NEXT: vsrl.vi v10, v12, 23 ; RV32F-NEXT: vsetvli zero, zero, e64, m2, ta, ma ; RV32F-NEXT: vzext.vf2 v12, v10 @@ -1634,10 +1623,9 @@ ; RV64F-NEXT: vsetvli a0, zero, e64, m2, ta, ma ; RV64F-NEXT: vrsub.vi v10, v8, 0 ; RV64F-NEXT: vand.vv v10, v8, v10 -; RV64F-NEXT: vmset.m v0 ; RV64F-NEXT: fsrmi a0, 1 ; RV64F-NEXT: vsetvli zero, zero, e32, m1, ta, ma -; RV64F-NEXT: vfncvt.f.xu.w v12, v10, v0.t +; RV64F-NEXT: vfncvt.f.xu.w v12, v10 ; RV64F-NEXT: vsrl.vi v10, v12, 23 ; RV64F-NEXT: vsetvli zero, zero, e64, m2, ta, ma ; RV64F-NEXT: vzext.vf2 v12, v10 @@ -1654,9 +1642,8 @@ ; RV32D-NEXT: vsetvli a0, zero, e64, m2, ta, ma ; RV32D-NEXT: vrsub.vi v10, v8, 0 ; RV32D-NEXT: vand.vv v10, v8, v10 -; RV32D-NEXT: vmset.m v0 ; RV32D-NEXT: fsrmi a0, 1 -; RV32D-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; RV32D-NEXT: vfcvt.f.xu.v v10, v10 ; RV32D-NEXT: li a1, 52 ; RV32D-NEXT: vsrl.vx v10, v10, a1 ; RV32D-NEXT: li a1, 1023 @@ -1672,9 +1659,8 @@ ; RV64D-NEXT: vsetvli a0, zero, e64, m2, ta, ma ; RV64D-NEXT: vrsub.vi v10, v8, 0 ; RV64D-NEXT: vand.vv v10, v8, v10 -; RV64D-NEXT: vmset.m v0 ; RV64D-NEXT: fsrmi a0, 1 -; RV64D-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; RV64D-NEXT: vfcvt.f.xu.v v10, v10 ; RV64D-NEXT: li a1, 52 ; RV64D-NEXT: vsrl.vx v10, v10, a1 ; RV64D-NEXT: li a1, 1023 @@ -1782,10 +1768,9 @@ ; RV32F-NEXT: vsetvli a0, zero, e64, m4, ta, ma ; RV32F-NEXT: vrsub.vi v12, v8, 0 ; RV32F-NEXT: vand.vv v12, v8, v12 -; RV32F-NEXT: vmset.m v0 ; RV32F-NEXT: fsrmi a0, 1 ; RV32F-NEXT: vsetvli zero, zero, e32, m2, ta, ma -; RV32F-NEXT: vfncvt.f.xu.w v16, v12, v0.t +; RV32F-NEXT: vfncvt.f.xu.w v16, v12 ; RV32F-NEXT: vsrl.vi v12, v16, 23 ; RV32F-NEXT: vsetvli zero, zero, e64, m4, ta, ma ; RV32F-NEXT: vzext.vf2 v16, v12 @@ -1802,10 +1787,9 @@ ; RV64F-NEXT: vsetvli a0, zero, e64, m4, ta, ma ; RV64F-NEXT: vrsub.vi v12, v8, 0 ; RV64F-NEXT: vand.vv v12, v8, v12 -; RV64F-NEXT: vmset.m v0 ; RV64F-NEXT: fsrmi a0, 1 ; RV64F-NEXT: vsetvli zero, zero, e32, m2, ta, ma -; RV64F-NEXT: vfncvt.f.xu.w v16, v12, v0.t +; RV64F-NEXT: vfncvt.f.xu.w v16, v12 ; RV64F-NEXT: vsrl.vi v12, v16, 23 ; RV64F-NEXT: vsetvli zero, zero, e64, m4, ta, ma ; RV64F-NEXT: vzext.vf2 v16, v12 @@ -1822,9 +1806,8 @@ ; RV32D-NEXT: vsetvli a0, zero, e64, m4, ta, ma ; RV32D-NEXT: vrsub.vi v12, v8, 0 ; RV32D-NEXT: vand.vv v12, v8, v12 -; RV32D-NEXT: vmset.m v0 ; RV32D-NEXT: fsrmi a0, 1 -; RV32D-NEXT: vfcvt.f.xu.v v12, v12, v0.t +; RV32D-NEXT: vfcvt.f.xu.v v12, v12 ; RV32D-NEXT: li a1, 52 ; RV32D-NEXT: vsrl.vx v12, v12, a1 ; RV32D-NEXT: li a1, 1023 @@ -1840,9 +1823,8 @@ ; RV64D-NEXT: vsetvli a0, zero, e64, m4, ta, ma ; RV64D-NEXT: vrsub.vi v12, v8, 0 ; RV64D-NEXT: vand.vv v12, v8, v12 -; RV64D-NEXT: vmset.m v0 ; RV64D-NEXT: fsrmi a0, 1 -; RV64D-NEXT: vfcvt.f.xu.v v12, v12, v0.t +; RV64D-NEXT: vfcvt.f.xu.v v12, v12 ; RV64D-NEXT: li a1, 52 ; RV64D-NEXT: vsrl.vx v12, v12, a1 ; RV64D-NEXT: li a1, 1023 @@ -1950,10 +1932,9 @@ ; RV32F-NEXT: vsetvli a0, zero, e64, m8, ta, ma ; RV32F-NEXT: vrsub.vi v16, v8, 0 ; RV32F-NEXT: vand.vv v16, v8, v16 -; RV32F-NEXT: vmset.m v0 ; RV32F-NEXT: fsrmi a0, 1 ; RV32F-NEXT: vsetvli zero, zero, e32, m4, ta, ma -; RV32F-NEXT: vfncvt.f.xu.w v24, v16, v0.t +; RV32F-NEXT: vfncvt.f.xu.w v24, v16 ; RV32F-NEXT: vsrl.vi v16, v24, 23 ; RV32F-NEXT: vsetvli zero, zero, e64, m8, ta, ma ; RV32F-NEXT: vzext.vf2 v24, v16 @@ -1970,10 +1951,9 @@ ; RV64F-NEXT: vsetvli a0, zero, e64, m8, ta, ma ; RV64F-NEXT: vrsub.vi v16, v8, 0 ; RV64F-NEXT: vand.vv v16, v8, v16 -; RV64F-NEXT: vmset.m v0 ; RV64F-NEXT: fsrmi a0, 1 ; RV64F-NEXT: vsetvli zero, zero, e32, m4, ta, ma -; RV64F-NEXT: vfncvt.f.xu.w v24, v16, v0.t +; RV64F-NEXT: vfncvt.f.xu.w v24, v16 ; RV64F-NEXT: vsrl.vi v16, v24, 23 ; RV64F-NEXT: vsetvli zero, zero, e64, m8, ta, ma ; RV64F-NEXT: vzext.vf2 v24, v16 @@ -1990,9 +1970,8 @@ ; RV32D-NEXT: vsetvli a0, zero, e64, m8, ta, ma ; RV32D-NEXT: vrsub.vi v16, v8, 0 ; RV32D-NEXT: vand.vv v16, v8, v16 -; RV32D-NEXT: vmset.m v0 ; RV32D-NEXT: fsrmi a0, 1 -; RV32D-NEXT: vfcvt.f.xu.v v16, v16, v0.t +; RV32D-NEXT: vfcvt.f.xu.v v16, v16 ; RV32D-NEXT: li a1, 52 ; RV32D-NEXT: vsrl.vx v16, v16, a1 ; RV32D-NEXT: li a1, 1023 @@ -2008,9 +1987,8 @@ ; RV64D-NEXT: vsetvli a0, zero, e64, m8, ta, ma ; RV64D-NEXT: vrsub.vi v16, v8, 0 ; RV64D-NEXT: vand.vv v16, v8, v16 -; RV64D-NEXT: vmset.m v0 ; RV64D-NEXT: fsrmi a0, 1 -; RV64D-NEXT: vfcvt.f.xu.v v16, v16, v0.t +; RV64D-NEXT: vfcvt.f.xu.v v16, v16 ; RV64D-NEXT: li a1, 52 ; RV64D-NEXT: vsrl.vx v16, v16, a1 ; RV64D-NEXT: li a1, 1023 @@ -2884,9 +2862,8 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e32, mf2, ta, ma ; CHECK-F-NEXT: vrsub.vi v9, v8, 0 ; CHECK-F-NEXT: vand.vv v8, v8, v9 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 127 ; CHECK-F-NEXT: vsub.vx v8, v8, a1 @@ -2975,9 +2952,8 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e32, m1, ta, ma ; CHECK-F-NEXT: vrsub.vi v9, v8, 0 ; CHECK-F-NEXT: vand.vv v8, v8, v9 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 127 ; CHECK-F-NEXT: vsub.vx v8, v8, a1 @@ -3066,9 +3042,8 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e32, m2, ta, ma ; CHECK-F-NEXT: vrsub.vi v10, v8, 0 ; CHECK-F-NEXT: vand.vv v8, v8, v10 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 127 ; CHECK-F-NEXT: vsub.vx v8, v8, a1 @@ -3157,9 +3132,8 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e32, m4, ta, ma ; CHECK-F-NEXT: vrsub.vi v12, v8, 0 ; CHECK-F-NEXT: vand.vv v8, v8, v12 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 127 ; CHECK-F-NEXT: vsub.vx v8, v8, a1 @@ -3248,9 +3222,8 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e32, m8, ta, ma ; CHECK-F-NEXT: vrsub.vi v16, v8, 0 ; CHECK-F-NEXT: vand.vv v8, v8, v16 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 -; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-F-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-F-NEXT: vsrl.vi v8, v8, 23 ; CHECK-F-NEXT: li a1, 127 ; CHECK-F-NEXT: vsub.vx v8, v8, a1 @@ -3262,9 +3235,8 @@ ; CHECK-D-NEXT: vsetvli a0, zero, e32, m8, ta, ma ; CHECK-D-NEXT: vrsub.vi v16, v8, 0 ; CHECK-D-NEXT: vand.vv v8, v8, v16 -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: vsrl.vi v8, v8, 23 ; CHECK-D-NEXT: li a1, 127 ; CHECK-D-NEXT: vsub.vx v8, v8, a1 @@ -3367,10 +3339,9 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e64, m1, ta, ma ; CHECK-F-NEXT: vrsub.vi v9, v8, 0 ; CHECK-F-NEXT: vand.vv v8, v8, v9 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 ; CHECK-F-NEXT: vsetvli zero, zero, e32, mf2, ta, ma -; CHECK-F-NEXT: vfncvt.f.xu.w v9, v8, v0.t +; CHECK-F-NEXT: vfncvt.f.xu.w v9, v8 ; CHECK-F-NEXT: vsrl.vi v8, v9, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m1, ta, ma ; CHECK-F-NEXT: vzext.vf2 v9, v8 @@ -3384,9 +3355,8 @@ ; CHECK-D-NEXT: vsetvli a0, zero, e64, m1, ta, ma ; CHECK-D-NEXT: vrsub.vi v9, v8, 0 ; CHECK-D-NEXT: vand.vv v8, v8, v9 -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1023 @@ -3490,10 +3460,9 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e64, m2, ta, ma ; CHECK-F-NEXT: vrsub.vi v10, v8, 0 ; CHECK-F-NEXT: vand.vv v8, v8, v10 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 ; CHECK-F-NEXT: vsetvli zero, zero, e32, m1, ta, ma -; CHECK-F-NEXT: vfncvt.f.xu.w v10, v8, v0.t +; CHECK-F-NEXT: vfncvt.f.xu.w v10, v8 ; CHECK-F-NEXT: vsrl.vi v8, v10, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m2, ta, ma ; CHECK-F-NEXT: vzext.vf2 v10, v8 @@ -3507,9 +3476,8 @@ ; CHECK-D-NEXT: vsetvli a0, zero, e64, m2, ta, ma ; CHECK-D-NEXT: vrsub.vi v10, v8, 0 ; CHECK-D-NEXT: vand.vv v8, v8, v10 -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1023 @@ -3613,10 +3581,9 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e64, m4, ta, ma ; CHECK-F-NEXT: vrsub.vi v12, v8, 0 ; CHECK-F-NEXT: vand.vv v8, v8, v12 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 ; CHECK-F-NEXT: vsetvli zero, zero, e32, m2, ta, ma -; CHECK-F-NEXT: vfncvt.f.xu.w v12, v8, v0.t +; CHECK-F-NEXT: vfncvt.f.xu.w v12, v8 ; CHECK-F-NEXT: vsrl.vi v8, v12, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m4, ta, ma ; CHECK-F-NEXT: vzext.vf2 v12, v8 @@ -3630,9 +3597,8 @@ ; CHECK-D-NEXT: vsetvli a0, zero, e64, m4, ta, ma ; CHECK-D-NEXT: vrsub.vi v12, v8, 0 ; CHECK-D-NEXT: vand.vv v8, v8, v12 -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1023 @@ -3736,10 +3702,9 @@ ; CHECK-F-NEXT: vsetvli a0, zero, e64, m8, ta, ma ; CHECK-F-NEXT: vrsub.vi v16, v8, 0 ; CHECK-F-NEXT: vand.vv v8, v8, v16 -; CHECK-F-NEXT: vmset.m v0 ; CHECK-F-NEXT: fsrmi a0, 1 ; CHECK-F-NEXT: vsetvli zero, zero, e32, m4, ta, ma -; CHECK-F-NEXT: vfncvt.f.xu.w v16, v8, v0.t +; CHECK-F-NEXT: vfncvt.f.xu.w v16, v8 ; CHECK-F-NEXT: vsrl.vi v8, v16, 23 ; CHECK-F-NEXT: vsetvli zero, zero, e64, m8, ta, ma ; CHECK-F-NEXT: vzext.vf2 v16, v8 @@ -3753,9 +3718,8 @@ ; CHECK-D-NEXT: vsetvli a0, zero, e64, m8, ta, ma ; CHECK-D-NEXT: vrsub.vi v16, v8, 0 ; CHECK-D-NEXT: vand.vv v8, v8, v16 -; CHECK-D-NEXT: vmset.m v0 ; CHECK-D-NEXT: fsrmi a0, 1 -; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; CHECK-D-NEXT: vfcvt.f.xu.v v8, v8 ; CHECK-D-NEXT: li a1, 52 ; CHECK-D-NEXT: vsrl.vx v8, v8, a1 ; CHECK-D-NEXT: li a1, 1023 diff --git a/llvm/test/CodeGen/RISCV/rvv/double-round-conv.ll b/llvm/test/CodeGen/RISCV/rvv/double-round-conv.ll --- a/llvm/test/CodeGen/RISCV/rvv/double-round-conv.ll +++ b/llvm/test/CodeGen/RISCV/rvv/double-round-conv.ll @@ -677,20 +677,18 @@ define @ceil_nxv1f64_to_si32( %x) { ; RV32-LABEL: ceil_nxv1f64_to_si32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.x.f.w v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV32-NEXT: vfncvt.x.f.w v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f64_to_si32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.x.f.w v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV64-NEXT: vfncvt.x.f.w v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -702,20 +700,18 @@ define @ceil_nxv1f64_to_ui32( %x) { ; RV32-LABEL: ceil_nxv1f64_to_ui32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.xu.f.w v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV32-NEXT: vfncvt.xu.f.w v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f64_to_ui32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.xu.f.w v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV64-NEXT: vfncvt.xu.f.w v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -727,19 +723,17 @@ define @ceil_nxv1f64_to_si64( %x) { ; RV32-LABEL: ceil_nxv1f64_to_si64: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e64, m1, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma +; RV32-NEXT: vfcvt.x.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f64_to_si64: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e64, m1, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma +; RV64-NEXT: vfcvt.x.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv1f64( %x) @@ -750,19 +744,17 @@ define @ceil_nxv1f64_to_ui64( %x) { ; RV32-LABEL: ceil_nxv1f64_to_ui64: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e64, m1, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma +; RV32-NEXT: vfcvt.xu.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f64_to_ui64: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e64, m1, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma +; RV64-NEXT: vfcvt.xu.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv1f64( %x) @@ -959,20 +951,18 @@ define @ceil_nxv4f64_to_si32( %x) { ; RV32-LABEL: ceil_nxv4f64_to_si32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.x.f.w v12, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV32-NEXT: vfncvt.x.f.w v12, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv.v.v v8, v12 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f64_to_si32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.x.f.w v12, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV64-NEXT: vfncvt.x.f.w v12, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv.v.v v8, v12 ; RV64-NEXT: ret @@ -984,20 +974,18 @@ define @ceil_nxv4f64_to_ui32( %x) { ; RV32-LABEL: ceil_nxv4f64_to_ui32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.xu.f.w v12, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV32-NEXT: vfncvt.xu.f.w v12, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv.v.v v8, v12 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f64_to_ui32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.xu.f.w v12, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV64-NEXT: vfncvt.xu.f.w v12, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv.v.v v8, v12 ; RV64-NEXT: ret @@ -1009,19 +997,17 @@ define @ceil_nxv4f64_to_si64( %x) { ; RV32-LABEL: ceil_nxv4f64_to_si64: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e64, m4, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma +; RV32-NEXT: vfcvt.x.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f64_to_si64: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e64, m4, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e64, m4, ta, ma +; RV64-NEXT: vfcvt.x.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv4f64( %x) @@ -1032,19 +1018,17 @@ define @ceil_nxv4f64_to_ui64( %x) { ; RV32-LABEL: ceil_nxv4f64_to_ui64: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e64, m4, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma +; RV32-NEXT: vfcvt.xu.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f64_to_ui64: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e64, m4, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e64, m4, ta, ma +; RV64-NEXT: vfcvt.xu.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv4f64( %x) diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll @@ -356,9 +356,8 @@ ; LMULMAX2-RV32F: # %bb.0: ; LMULMAX2-RV32F-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; LMULMAX2-RV32F-NEXT: vle32.v v8, (a0) -; LMULMAX2-RV32F-NEXT: vmset.m v0 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV32F-NEXT: fsrm a1 ; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v8, 23 ; LMULMAX2-RV32F-NEXT: li a1, 158 @@ -372,9 +371,8 @@ ; LMULMAX2-RV64F: # %bb.0: ; LMULMAX2-RV64F-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; LMULMAX2-RV64F-NEXT: vle32.v v8, (a0) -; LMULMAX2-RV64F-NEXT: vmset.m v0 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV64F-NEXT: fsrm a1 ; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v8, 23 ; LMULMAX2-RV64F-NEXT: li a1, 158 @@ -543,17 +541,15 @@ ; ; LMULMAX2-RV32F-LABEL: ctlz_v2i64: ; LMULMAX2-RV32F: # %bb.0: -; LMULMAX2-RV32F-NEXT: vsetivli zero, 2, e32, mf2, ta, ma +; LMULMAX2-RV32F-NEXT: vsetivli zero, 2, e64, m1, ta, ma ; LMULMAX2-RV32F-NEXT: vle64.v v8, (a0) -; LMULMAX2-RV32F-NEXT: vmset.m v0 -; LMULMAX2-RV32F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v9, v8, v0.t -; LMULMAX2-RV32F-NEXT: fsrm a1 -; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v9, 23 ; LMULMAX2-RV32F-NEXT: li a1, 190 -; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e64, m1, ta, ma ; LMULMAX2-RV32F-NEXT: vmv.v.x v9, a1 +; LMULMAX2-RV32F-NEXT: fsrmi a1, 1 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e32, mf2, ta, ma +; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v10, v8 +; LMULMAX2-RV32F-NEXT: fsrm a1 +; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v10, 23 ; LMULMAX2-RV32F-NEXT: vwsubu.wv v9, v9, v8 ; LMULMAX2-RV32F-NEXT: li a1, 64 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e64, m1, ta, ma @@ -565,13 +561,12 @@ ; LMULMAX2-RV64F: # %bb.0: ; LMULMAX2-RV64F-NEXT: vsetivli zero, 2, e32, mf2, ta, ma ; LMULMAX2-RV64F-NEXT: vle64.v v8, (a0) -; LMULMAX2-RV64F-NEXT: vmset.m v0 -; LMULMAX2-RV64F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v9, v8, v0.t -; LMULMAX2-RV64F-NEXT: fsrm a1 -; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v9, 23 ; LMULMAX2-RV64F-NEXT: li a1, 190 ; LMULMAX2-RV64F-NEXT: vmv.v.x v9, a1 +; LMULMAX2-RV64F-NEXT: fsrmi a1, 1 +; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v10, v8 +; LMULMAX2-RV64F-NEXT: fsrm a1 +; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v10, 23 ; LMULMAX2-RV64F-NEXT: vwsubu.vv v10, v9, v8 ; LMULMAX2-RV64F-NEXT: li a1, 64 ; LMULMAX2-RV64F-NEXT: vsetvli zero, zero, e64, m1, ta, ma @@ -583,9 +578,8 @@ ; LMULMAX2-RV32D: # %bb.0: ; LMULMAX2-RV32D-NEXT: vsetivli zero, 2, e64, m1, ta, ma ; LMULMAX2-RV32D-NEXT: vle64.v v8, (a0) -; LMULMAX2-RV32D-NEXT: vmset.m v0 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV32D-NEXT: fsrm a1 ; LMULMAX2-RV32D-NEXT: li a1, 52 ; LMULMAX2-RV32D-NEXT: vsrl.vx v8, v8, a1 @@ -600,9 +594,8 @@ ; LMULMAX2-RV64D: # %bb.0: ; LMULMAX2-RV64D-NEXT: vsetivli zero, 2, e64, m1, ta, ma ; LMULMAX2-RV64D-NEXT: vle64.v v8, (a0) -; LMULMAX2-RV64D-NEXT: vmset.m v0 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV64D-NEXT: fsrm a1 ; LMULMAX2-RV64D-NEXT: li a1, 52 ; LMULMAX2-RV64D-NEXT: vsrl.vx v8, v8, a1 @@ -617,9 +610,8 @@ ; LMULMAX8: # %bb.0: ; LMULMAX8-NEXT: vsetivli zero, 2, e64, m1, ta, ma ; LMULMAX8-NEXT: vle64.v v8, (a0) -; LMULMAX8-NEXT: vmset.m v0 ; LMULMAX8-NEXT: fsrmi a1, 1 -; LMULMAX8-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX8-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX8-NEXT: fsrm a1 ; LMULMAX8-NEXT: li a1, 52 ; LMULMAX8-NEXT: vsrl.vx v8, v8, a1 @@ -1025,9 +1017,8 @@ ; LMULMAX2-RV32F: # %bb.0: ; LMULMAX2-RV32F-NEXT: vsetivli zero, 8, e32, m2, ta, ma ; LMULMAX2-RV32F-NEXT: vle32.v v8, (a0) -; LMULMAX2-RV32F-NEXT: vmset.m v0 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV32F-NEXT: fsrm a1 ; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v8, 23 ; LMULMAX2-RV32F-NEXT: li a1, 158 @@ -1041,9 +1032,8 @@ ; LMULMAX2-RV64F: # %bb.0: ; LMULMAX2-RV64F-NEXT: vsetivli zero, 8, e32, m2, ta, ma ; LMULMAX2-RV64F-NEXT: vle32.v v8, (a0) -; LMULMAX2-RV64F-NEXT: vmset.m v0 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV64F-NEXT: fsrm a1 ; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v8, 23 ; LMULMAX2-RV64F-NEXT: li a1, 158 @@ -1057,9 +1047,8 @@ ; LMULMAX2-RV32D: # %bb.0: ; LMULMAX2-RV32D-NEXT: vsetivli zero, 8, e32, m2, ta, ma ; LMULMAX2-RV32D-NEXT: vle32.v v8, (a0) -; LMULMAX2-RV32D-NEXT: vmset.m v0 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV32D-NEXT: fsrm a1 ; LMULMAX2-RV32D-NEXT: vsrl.vi v8, v8, 23 ; LMULMAX2-RV32D-NEXT: li a1, 158 @@ -1073,9 +1062,8 @@ ; LMULMAX2-RV64D: # %bb.0: ; LMULMAX2-RV64D-NEXT: vsetivli zero, 8, e32, m2, ta, ma ; LMULMAX2-RV64D-NEXT: vle32.v v8, (a0) -; LMULMAX2-RV64D-NEXT: vmset.m v0 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV64D-NEXT: fsrm a1 ; LMULMAX2-RV64D-NEXT: vsrl.vi v8, v8, 23 ; LMULMAX2-RV64D-NEXT: li a1, 158 @@ -1216,17 +1204,15 @@ ; ; LMULMAX2-RV32F-LABEL: ctlz_v4i64: ; LMULMAX2-RV32F: # %bb.0: -; LMULMAX2-RV32F-NEXT: vsetivli zero, 4, e32, m1, ta, ma +; LMULMAX2-RV32F-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; LMULMAX2-RV32F-NEXT: vle64.v v8, (a0) -; LMULMAX2-RV32F-NEXT: vmset.m v0 -; LMULMAX2-RV32F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v10, v8, v0.t -; LMULMAX2-RV32F-NEXT: fsrm a1 -; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v10, 23 ; LMULMAX2-RV32F-NEXT: li a1, 190 -; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e64, m2, ta, ma ; LMULMAX2-RV32F-NEXT: vmv.v.x v10, a1 +; LMULMAX2-RV32F-NEXT: fsrmi a1, 1 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e32, m1, ta, ma +; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v12, v8 +; LMULMAX2-RV32F-NEXT: fsrm a1 +; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v12, 23 ; LMULMAX2-RV32F-NEXT: vwsubu.wv v10, v10, v8 ; LMULMAX2-RV32F-NEXT: li a1, 64 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e64, m2, ta, ma @@ -1238,17 +1224,16 @@ ; LMULMAX2-RV64F: # %bb.0: ; LMULMAX2-RV64F-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; LMULMAX2-RV64F-NEXT: vle64.v v8, (a0) -; LMULMAX2-RV64F-NEXT: vmset.m v0 +; LMULMAX2-RV64F-NEXT: li a1, 190 +; LMULMAX2-RV64F-NEXT: vmv.v.x v10, a1 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v10, v8, v0.t +; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v11, v8 ; LMULMAX2-RV64F-NEXT: fsrm a1 -; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v10, 23 -; LMULMAX2-RV64F-NEXT: li a1, 190 -; LMULMAX2-RV64F-NEXT: vmv.v.x v9, a1 -; LMULMAX2-RV64F-NEXT: vwsubu.vv v10, v9, v8 +; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v11, 23 +; LMULMAX2-RV64F-NEXT: vwsubu.vv v12, v10, v8 ; LMULMAX2-RV64F-NEXT: li a1, 64 ; LMULMAX2-RV64F-NEXT: vsetvli zero, zero, e64, m2, ta, ma -; LMULMAX2-RV64F-NEXT: vminu.vx v8, v10, a1 +; LMULMAX2-RV64F-NEXT: vminu.vx v8, v12, a1 ; LMULMAX2-RV64F-NEXT: vse64.v v8, (a0) ; LMULMAX2-RV64F-NEXT: ret ; @@ -1256,9 +1241,8 @@ ; LMULMAX2-RV32D: # %bb.0: ; LMULMAX2-RV32D-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; LMULMAX2-RV32D-NEXT: vle64.v v8, (a0) -; LMULMAX2-RV32D-NEXT: vmset.m v0 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV32D-NEXT: fsrm a1 ; LMULMAX2-RV32D-NEXT: li a1, 52 ; LMULMAX2-RV32D-NEXT: vsrl.vx v8, v8, a1 @@ -1273,9 +1257,8 @@ ; LMULMAX2-RV64D: # %bb.0: ; LMULMAX2-RV64D-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; LMULMAX2-RV64D-NEXT: vle64.v v8, (a0) -; LMULMAX2-RV64D-NEXT: vmset.m v0 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV64D-NEXT: fsrm a1 ; LMULMAX2-RV64D-NEXT: li a1, 52 ; LMULMAX2-RV64D-NEXT: vsrl.vx v8, v8, a1 @@ -1290,9 +1273,8 @@ ; LMULMAX8: # %bb.0: ; LMULMAX8-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; LMULMAX8-NEXT: vle64.v v8, (a0) -; LMULMAX8-NEXT: vmset.m v0 ; LMULMAX8-NEXT: fsrmi a1, 1 -; LMULMAX8-NEXT: vfcvt.f.xu.v v8, v8, v0.t +; LMULMAX8-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX8-NEXT: fsrm a1 ; LMULMAX8-NEXT: li a1, 52 ; LMULMAX8-NEXT: vsrl.vx v8, v8, a1 diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-cttz.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-cttz.ll --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-cttz.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-cttz.ll @@ -339,9 +339,8 @@ ; LMULMAX2-RV32F-NEXT: vle32.v v8, (a0) ; LMULMAX2-RV32F-NEXT: vrsub.vi v9, v8, 0 ; LMULMAX2-RV32F-NEXT: vand.vv v9, v8, v9 -; LMULMAX2-RV32F-NEXT: vmset.m v0 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v9, v9, v0.t +; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v9, v9 ; LMULMAX2-RV32F-NEXT: fsrm a1 ; LMULMAX2-RV32F-NEXT: vsrl.vi v9, v9, 23 ; LMULMAX2-RV32F-NEXT: li a1, 127 @@ -358,9 +357,8 @@ ; LMULMAX2-RV64F-NEXT: vle32.v v8, (a0) ; LMULMAX2-RV64F-NEXT: vrsub.vi v9, v8, 0 ; LMULMAX2-RV64F-NEXT: vand.vv v9, v8, v9 -; LMULMAX2-RV64F-NEXT: vmset.m v0 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v9, v9, v0.t +; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v9, v9 ; LMULMAX2-RV64F-NEXT: fsrm a1 ; LMULMAX2-RV64F-NEXT: vsrl.vi v9, v9, 23 ; LMULMAX2-RV64F-NEXT: li a1, 127 @@ -520,26 +518,24 @@ ; LMULMAX2-RV32F-LABEL: cttz_v2i64: ; LMULMAX2-RV32F: # %bb.0: ; LMULMAX2-RV32F-NEXT: vsetivli zero, 2, e64, m1, ta, ma -; LMULMAX2-RV32F-NEXT: vle64.v v9, (a0) +; LMULMAX2-RV32F-NEXT: vle64.v v8, (a0) ; LMULMAX2-RV32F-NEXT: vsetivli zero, 4, e32, m1, ta, ma -; LMULMAX2-RV32F-NEXT: vmv.v.i v10, 0 +; LMULMAX2-RV32F-NEXT: vmv.v.i v9, 0 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 2, e64, m1, ta, ma -; LMULMAX2-RV32F-NEXT: vmseq.vv v8, v9, v10 -; LMULMAX2-RV32F-NEXT: vsub.vv v10, v10, v9 -; LMULMAX2-RV32F-NEXT: vand.vv v9, v9, v10 -; LMULMAX2-RV32F-NEXT: vmset.m v0 +; LMULMAX2-RV32F-NEXT: vmseq.vv v0, v8, v9 +; LMULMAX2-RV32F-NEXT: vsub.vv v9, v9, v8 +; LMULMAX2-RV32F-NEXT: vand.vv v8, v8, v9 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e32, mf2, ta, ma -; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v10, v9, v0.t +; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v9, v8 ; LMULMAX2-RV32F-NEXT: fsrm a1 -; LMULMAX2-RV32F-NEXT: vsrl.vi v9, v10, 23 +; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v9, 23 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e64, m1, ta, ma -; LMULMAX2-RV32F-NEXT: vzext.vf2 v10, v9 +; LMULMAX2-RV32F-NEXT: vzext.vf2 v9, v8 ; LMULMAX2-RV32F-NEXT: li a1, 127 -; LMULMAX2-RV32F-NEXT: vsub.vx v9, v10, a1 +; LMULMAX2-RV32F-NEXT: vsub.vx v8, v9, a1 ; LMULMAX2-RV32F-NEXT: li a1, 64 -; LMULMAX2-RV32F-NEXT: vmv.v.v v0, v8 -; LMULMAX2-RV32F-NEXT: vmerge.vxm v8, v9, a1, v0 +; LMULMAX2-RV32F-NEXT: vmerge.vxm v8, v8, a1, v0 ; LMULMAX2-RV32F-NEXT: vse64.v v8, (a0) ; LMULMAX2-RV32F-NEXT: ret ; @@ -549,10 +545,9 @@ ; LMULMAX2-RV64F-NEXT: vle64.v v8, (a0) ; LMULMAX2-RV64F-NEXT: vrsub.vi v9, v8, 0 ; LMULMAX2-RV64F-NEXT: vand.vv v9, v8, v9 -; LMULMAX2-RV64F-NEXT: vmset.m v0 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1 ; LMULMAX2-RV64F-NEXT: vsetvli zero, zero, e32, mf2, ta, ma -; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v10, v9, v0.t +; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v10, v9 ; LMULMAX2-RV64F-NEXT: fsrm a1 ; LMULMAX2-RV64F-NEXT: vsrl.vi v9, v10, 23 ; LMULMAX2-RV64F-NEXT: li a1, 127 @@ -567,24 +562,22 @@ ; LMULMAX2-RV32D-LABEL: cttz_v2i64: ; LMULMAX2-RV32D: # %bb.0: ; LMULMAX2-RV32D-NEXT: vsetivli zero, 2, e64, m1, ta, ma -; LMULMAX2-RV32D-NEXT: vle64.v v9, (a0) +; LMULMAX2-RV32D-NEXT: vle64.v v8, (a0) ; LMULMAX2-RV32D-NEXT: vsetivli zero, 4, e32, m1, ta, ma -; LMULMAX2-RV32D-NEXT: vmv.v.i v10, 0 +; LMULMAX2-RV32D-NEXT: vmv.v.i v9, 0 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 2, e64, m1, ta, ma -; LMULMAX2-RV32D-NEXT: vmseq.vv v8, v9, v10 -; LMULMAX2-RV32D-NEXT: vsub.vv v10, v10, v9 -; LMULMAX2-RV32D-NEXT: vand.vv v9, v9, v10 -; LMULMAX2-RV32D-NEXT: vmset.m v0 +; LMULMAX2-RV32D-NEXT: vmseq.vv v0, v8, v9 +; LMULMAX2-RV32D-NEXT: vsub.vv v9, v9, v8 +; LMULMAX2-RV32D-NEXT: vand.vv v8, v8, v9 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v9, v9, v0.t +; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV32D-NEXT: fsrm a1 ; LMULMAX2-RV32D-NEXT: li a1, 52 -; LMULMAX2-RV32D-NEXT: vsrl.vx v9, v9, a1 +; LMULMAX2-RV32D-NEXT: vsrl.vx v8, v8, a1 ; LMULMAX2-RV32D-NEXT: li a1, 1023 -; LMULMAX2-RV32D-NEXT: vsub.vx v9, v9, a1 +; LMULMAX2-RV32D-NEXT: vsub.vx v8, v8, a1 ; LMULMAX2-RV32D-NEXT: li a1, 64 -; LMULMAX2-RV32D-NEXT: vmv.v.v v0, v8 -; LMULMAX2-RV32D-NEXT: vmerge.vxm v8, v9, a1, v0 +; LMULMAX2-RV32D-NEXT: vmerge.vxm v8, v8, a1, v0 ; LMULMAX2-RV32D-NEXT: vse64.v v8, (a0) ; LMULMAX2-RV32D-NEXT: ret ; @@ -594,9 +587,8 @@ ; LMULMAX2-RV64D-NEXT: vle64.v v8, (a0) ; LMULMAX2-RV64D-NEXT: vrsub.vi v9, v8, 0 ; LMULMAX2-RV64D-NEXT: vand.vv v9, v8, v9 -; LMULMAX2-RV64D-NEXT: vmset.m v0 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v9, v9, v0.t +; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v9, v9 ; LMULMAX2-RV64D-NEXT: fsrm a1 ; LMULMAX2-RV64D-NEXT: li a1, 52 ; LMULMAX2-RV64D-NEXT: vsrl.vx v9, v9, a1 @@ -611,24 +603,22 @@ ; LMULMAX8-RV32-LABEL: cttz_v2i64: ; LMULMAX8-RV32: # %bb.0: ; LMULMAX8-RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma -; LMULMAX8-RV32-NEXT: vle64.v v9, (a0) +; LMULMAX8-RV32-NEXT: vle64.v v8, (a0) ; LMULMAX8-RV32-NEXT: vsetivli zero, 4, e32, m1, ta, ma -; LMULMAX8-RV32-NEXT: vmv.v.i v10, 0 +; LMULMAX8-RV32-NEXT: vmv.v.i v9, 0 ; LMULMAX8-RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma -; LMULMAX8-RV32-NEXT: vmseq.vv v8, v9, v10 -; LMULMAX8-RV32-NEXT: vsub.vv v10, v10, v9 -; LMULMAX8-RV32-NEXT: vand.vv v9, v9, v10 -; LMULMAX8-RV32-NEXT: vmset.m v0 +; LMULMAX8-RV32-NEXT: vmseq.vv v0, v8, v9 +; LMULMAX8-RV32-NEXT: vsub.vv v9, v9, v8 +; LMULMAX8-RV32-NEXT: vand.vv v8, v8, v9 ; LMULMAX8-RV32-NEXT: fsrmi a1, 1 -; LMULMAX8-RV32-NEXT: vfcvt.f.xu.v v9, v9, v0.t +; LMULMAX8-RV32-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX8-RV32-NEXT: fsrm a1 ; LMULMAX8-RV32-NEXT: li a1, 52 -; LMULMAX8-RV32-NEXT: vsrl.vx v9, v9, a1 +; LMULMAX8-RV32-NEXT: vsrl.vx v8, v8, a1 ; LMULMAX8-RV32-NEXT: li a1, 1023 -; LMULMAX8-RV32-NEXT: vsub.vx v9, v9, a1 +; LMULMAX8-RV32-NEXT: vsub.vx v8, v8, a1 ; LMULMAX8-RV32-NEXT: li a1, 64 -; LMULMAX8-RV32-NEXT: vmv.v.v v0, v8 -; LMULMAX8-RV32-NEXT: vmerge.vxm v8, v9, a1, v0 +; LMULMAX8-RV32-NEXT: vmerge.vxm v8, v8, a1, v0 ; LMULMAX8-RV32-NEXT: vse64.v v8, (a0) ; LMULMAX8-RV32-NEXT: ret ; @@ -638,9 +628,8 @@ ; LMULMAX8-RV64-NEXT: vle64.v v8, (a0) ; LMULMAX8-RV64-NEXT: vrsub.vi v9, v8, 0 ; LMULMAX8-RV64-NEXT: vand.vv v9, v8, v9 -; LMULMAX8-RV64-NEXT: vmset.m v0 ; LMULMAX8-RV64-NEXT: fsrmi a1, 1 -; LMULMAX8-RV64-NEXT: vfcvt.f.xu.v v9, v9, v0.t +; LMULMAX8-RV64-NEXT: vfcvt.f.xu.v v9, v9 ; LMULMAX8-RV64-NEXT: fsrm a1 ; LMULMAX8-RV64-NEXT: li a1, 52 ; LMULMAX8-RV64-NEXT: vsrl.vx v9, v9, a1 @@ -999,9 +988,8 @@ ; LMULMAX2-RV32F-NEXT: vle32.v v8, (a0) ; LMULMAX2-RV32F-NEXT: vrsub.vi v10, v8, 0 ; LMULMAX2-RV32F-NEXT: vand.vv v10, v8, v10 -; LMULMAX2-RV32F-NEXT: vmset.m v0 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v10, v10 ; LMULMAX2-RV32F-NEXT: fsrm a1 ; LMULMAX2-RV32F-NEXT: vsrl.vi v10, v10, 23 ; LMULMAX2-RV32F-NEXT: li a1, 127 @@ -1018,9 +1006,8 @@ ; LMULMAX2-RV64F-NEXT: vle32.v v8, (a0) ; LMULMAX2-RV64F-NEXT: vrsub.vi v10, v8, 0 ; LMULMAX2-RV64F-NEXT: vand.vv v10, v8, v10 -; LMULMAX2-RV64F-NEXT: vmset.m v0 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v10, v10 ; LMULMAX2-RV64F-NEXT: fsrm a1 ; LMULMAX2-RV64F-NEXT: vsrl.vi v10, v10, 23 ; LMULMAX2-RV64F-NEXT: li a1, 127 @@ -1037,9 +1024,8 @@ ; LMULMAX2-RV32D-NEXT: vle32.v v8, (a0) ; LMULMAX2-RV32D-NEXT: vrsub.vi v10, v8, 0 ; LMULMAX2-RV32D-NEXT: vand.vv v10, v8, v10 -; LMULMAX2-RV32D-NEXT: vmset.m v0 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v10, v10 ; LMULMAX2-RV32D-NEXT: fsrm a1 ; LMULMAX2-RV32D-NEXT: vsrl.vi v10, v10, 23 ; LMULMAX2-RV32D-NEXT: li a1, 127 @@ -1056,9 +1042,8 @@ ; LMULMAX2-RV64D-NEXT: vle32.v v8, (a0) ; LMULMAX2-RV64D-NEXT: vrsub.vi v10, v8, 0 ; LMULMAX2-RV64D-NEXT: vand.vv v10, v8, v10 -; LMULMAX2-RV64D-NEXT: vmset.m v0 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v10, v10 ; LMULMAX2-RV64D-NEXT: fsrm a1 ; LMULMAX2-RV64D-NEXT: vsrl.vi v10, v10, 23 ; LMULMAX2-RV64D-NEXT: li a1, 127 @@ -1184,26 +1169,24 @@ ; LMULMAX2-RV32F-LABEL: cttz_v4i64: ; LMULMAX2-RV32F: # %bb.0: ; LMULMAX2-RV32F-NEXT: vsetivli zero, 4, e64, m2, ta, ma -; LMULMAX2-RV32F-NEXT: vle64.v v10, (a0) +; LMULMAX2-RV32F-NEXT: vle64.v v8, (a0) ; LMULMAX2-RV32F-NEXT: vsetivli zero, 8, e32, m2, ta, ma -; LMULMAX2-RV32F-NEXT: vmv.v.i v12, 0 +; LMULMAX2-RV32F-NEXT: vmv.v.i v10, 0 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 4, e64, m2, ta, ma -; LMULMAX2-RV32F-NEXT: vmseq.vv v8, v10, v12 -; LMULMAX2-RV32F-NEXT: vsub.vv v12, v12, v10 -; LMULMAX2-RV32F-NEXT: vand.vv v10, v10, v12 -; LMULMAX2-RV32F-NEXT: vmset.m v0 +; LMULMAX2-RV32F-NEXT: vmseq.vv v0, v8, v10 +; LMULMAX2-RV32F-NEXT: vsub.vv v10, v10, v8 +; LMULMAX2-RV32F-NEXT: vand.vv v8, v8, v10 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e32, m1, ta, ma -; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v9, v10, v0.t +; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v10, v8 ; LMULMAX2-RV32F-NEXT: fsrm a1 -; LMULMAX2-RV32F-NEXT: vsrl.vi v9, v9, 23 +; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v10, 23 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e64, m2, ta, ma -; LMULMAX2-RV32F-NEXT: vzext.vf2 v10, v9 +; LMULMAX2-RV32F-NEXT: vzext.vf2 v10, v8 ; LMULMAX2-RV32F-NEXT: li a1, 127 -; LMULMAX2-RV32F-NEXT: vsub.vx v10, v10, a1 +; LMULMAX2-RV32F-NEXT: vsub.vx v8, v10, a1 ; LMULMAX2-RV32F-NEXT: li a1, 64 -; LMULMAX2-RV32F-NEXT: vmv1r.v v0, v8 -; LMULMAX2-RV32F-NEXT: vmerge.vxm v8, v10, a1, v0 +; LMULMAX2-RV32F-NEXT: vmerge.vxm v8, v8, a1, v0 ; LMULMAX2-RV32F-NEXT: vse64.v v8, (a0) ; LMULMAX2-RV32F-NEXT: ret ; @@ -1213,10 +1196,9 @@ ; LMULMAX2-RV64F-NEXT: vle64.v v8, (a0) ; LMULMAX2-RV64F-NEXT: vrsub.vi v10, v8, 0 ; LMULMAX2-RV64F-NEXT: vand.vv v10, v8, v10 -; LMULMAX2-RV64F-NEXT: vmset.m v0 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1 ; LMULMAX2-RV64F-NEXT: vsetvli zero, zero, e32, m1, ta, ma -; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v12, v10, v0.t +; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v12, v10 ; LMULMAX2-RV64F-NEXT: fsrm a1 ; LMULMAX2-RV64F-NEXT: vsrl.vi v10, v12, 23 ; LMULMAX2-RV64F-NEXT: li a1, 127 @@ -1231,24 +1213,22 @@ ; LMULMAX2-RV32D-LABEL: cttz_v4i64: ; LMULMAX2-RV32D: # %bb.0: ; LMULMAX2-RV32D-NEXT: vsetivli zero, 4, e64, m2, ta, ma -; LMULMAX2-RV32D-NEXT: vle64.v v10, (a0) +; LMULMAX2-RV32D-NEXT: vle64.v v8, (a0) ; LMULMAX2-RV32D-NEXT: vsetivli zero, 8, e32, m2, ta, ma -; LMULMAX2-RV32D-NEXT: vmv.v.i v12, 0 +; LMULMAX2-RV32D-NEXT: vmv.v.i v10, 0 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 4, e64, m2, ta, ma -; LMULMAX2-RV32D-NEXT: vmseq.vv v8, v10, v12 -; LMULMAX2-RV32D-NEXT: vsub.vv v12, v12, v10 -; LMULMAX2-RV32D-NEXT: vand.vv v10, v10, v12 -; LMULMAX2-RV32D-NEXT: vmset.m v0 +; LMULMAX2-RV32D-NEXT: vmseq.vv v0, v8, v10 +; LMULMAX2-RV32D-NEXT: vsub.vv v10, v10, v8 +; LMULMAX2-RV32D-NEXT: vand.vv v8, v8, v10 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX2-RV32D-NEXT: fsrm a1 ; LMULMAX2-RV32D-NEXT: li a1, 52 -; LMULMAX2-RV32D-NEXT: vsrl.vx v10, v10, a1 +; LMULMAX2-RV32D-NEXT: vsrl.vx v8, v8, a1 ; LMULMAX2-RV32D-NEXT: li a1, 1023 -; LMULMAX2-RV32D-NEXT: vsub.vx v10, v10, a1 +; LMULMAX2-RV32D-NEXT: vsub.vx v8, v8, a1 ; LMULMAX2-RV32D-NEXT: li a1, 64 -; LMULMAX2-RV32D-NEXT: vmv1r.v v0, v8 -; LMULMAX2-RV32D-NEXT: vmerge.vxm v8, v10, a1, v0 +; LMULMAX2-RV32D-NEXT: vmerge.vxm v8, v8, a1, v0 ; LMULMAX2-RV32D-NEXT: vse64.v v8, (a0) ; LMULMAX2-RV32D-NEXT: ret ; @@ -1258,9 +1238,8 @@ ; LMULMAX2-RV64D-NEXT: vle64.v v8, (a0) ; LMULMAX2-RV64D-NEXT: vrsub.vi v10, v8, 0 ; LMULMAX2-RV64D-NEXT: vand.vv v10, v8, v10 -; LMULMAX2-RV64D-NEXT: vmset.m v0 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1 -; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v10, v10 ; LMULMAX2-RV64D-NEXT: fsrm a1 ; LMULMAX2-RV64D-NEXT: li a1, 52 ; LMULMAX2-RV64D-NEXT: vsrl.vx v10, v10, a1 @@ -1275,24 +1254,22 @@ ; LMULMAX8-RV32-LABEL: cttz_v4i64: ; LMULMAX8-RV32: # %bb.0: ; LMULMAX8-RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma -; LMULMAX8-RV32-NEXT: vle64.v v10, (a0) +; LMULMAX8-RV32-NEXT: vle64.v v8, (a0) ; LMULMAX8-RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma -; LMULMAX8-RV32-NEXT: vmv.v.i v12, 0 +; LMULMAX8-RV32-NEXT: vmv.v.i v10, 0 ; LMULMAX8-RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma -; LMULMAX8-RV32-NEXT: vmseq.vv v8, v10, v12 -; LMULMAX8-RV32-NEXT: vsub.vv v12, v12, v10 -; LMULMAX8-RV32-NEXT: vand.vv v10, v10, v12 -; LMULMAX8-RV32-NEXT: vmset.m v0 +; LMULMAX8-RV32-NEXT: vmseq.vv v0, v8, v10 +; LMULMAX8-RV32-NEXT: vsub.vv v10, v10, v8 +; LMULMAX8-RV32-NEXT: vand.vv v8, v8, v10 ; LMULMAX8-RV32-NEXT: fsrmi a1, 1 -; LMULMAX8-RV32-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; LMULMAX8-RV32-NEXT: vfcvt.f.xu.v v8, v8 ; LMULMAX8-RV32-NEXT: fsrm a1 ; LMULMAX8-RV32-NEXT: li a1, 52 -; LMULMAX8-RV32-NEXT: vsrl.vx v10, v10, a1 +; LMULMAX8-RV32-NEXT: vsrl.vx v8, v8, a1 ; LMULMAX8-RV32-NEXT: li a1, 1023 -; LMULMAX8-RV32-NEXT: vsub.vx v10, v10, a1 +; LMULMAX8-RV32-NEXT: vsub.vx v8, v8, a1 ; LMULMAX8-RV32-NEXT: li a1, 64 -; LMULMAX8-RV32-NEXT: vmv1r.v v0, v8 -; LMULMAX8-RV32-NEXT: vmerge.vxm v8, v10, a1, v0 +; LMULMAX8-RV32-NEXT: vmerge.vxm v8, v8, a1, v0 ; LMULMAX8-RV32-NEXT: vse64.v v8, (a0) ; LMULMAX8-RV32-NEXT: ret ; @@ -1302,9 +1279,8 @@ ; LMULMAX8-RV64-NEXT: vle64.v v8, (a0) ; LMULMAX8-RV64-NEXT: vrsub.vi v10, v8, 0 ; LMULMAX8-RV64-NEXT: vand.vv v10, v8, v10 -; LMULMAX8-RV64-NEXT: vmset.m v0 ; LMULMAX8-RV64-NEXT: fsrmi a1, 1 -; LMULMAX8-RV64-NEXT: vfcvt.f.xu.v v10, v10, v0.t +; LMULMAX8-RV64-NEXT: vfcvt.f.xu.v v10, v10 ; LMULMAX8-RV64-NEXT: fsrm a1 ; LMULMAX8-RV64-NEXT: li a1, 52 ; LMULMAX8-RV64-NEXT: vsrl.vx v10, v10, a1 diff --git a/llvm/test/CodeGen/RISCV/rvv/float-round-conv.ll b/llvm/test/CodeGen/RISCV/rvv/float-round-conv.ll --- a/llvm/test/CodeGen/RISCV/rvv/float-round-conv.ll +++ b/llvm/test/CodeGen/RISCV/rvv/float-round-conv.ll @@ -487,20 +487,18 @@ define @ceil_nxv1f32_to_si16( %x) { ; RV32-LABEL: ceil_nxv1f32_to_si16: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.x.f.w v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV32-NEXT: vfncvt.x.f.w v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f32_to_si16: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.x.f.w v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV64-NEXT: vfncvt.x.f.w v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -512,20 +510,18 @@ define @ceil_nxv1f32_to_ui16( %x) { ; RV32-LABEL: ceil_nxv1f32_to_ui16: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.xu.f.w v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV32-NEXT: vfncvt.xu.f.w v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f32_to_ui16: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.xu.f.w v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV64-NEXT: vfncvt.xu.f.w v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -537,19 +533,17 @@ define @ceil_nxv1f32_to_si32( %x) { ; RV32-LABEL: ceil_nxv1f32_to_si32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV32-NEXT: vfcvt.x.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f32_to_si32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV64-NEXT: vfcvt.x.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv1f32( %x) @@ -560,19 +554,17 @@ define @ceil_nxv1f32_to_ui32( %x) { ; RV32-LABEL: ceil_nxv1f32_to_ui32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV32-NEXT: vfcvt.xu.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f32_to_ui32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV64-NEXT: vfcvt.xu.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv1f32( %x) @@ -583,20 +575,18 @@ define @ceil_nxv1f32_to_si64( %x) { ; RV32-LABEL: ceil_nxv1f32_to_si64: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfwcvt.x.f.v v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV32-NEXT: vfwcvt.x.f.v v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f32_to_si64: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfwcvt.x.f.v v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV64-NEXT: vfwcvt.x.f.v v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -608,20 +598,18 @@ define @ceil_nxv1f32_to_ui64( %x) { ; RV32-LABEL: ceil_nxv1f32_to_ui64: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfwcvt.xu.f.v v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV32-NEXT: vfwcvt.xu.f.v v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f32_to_ui64: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfwcvt.xu.f.v v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; RV64-NEXT: vfwcvt.xu.f.v v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -725,20 +713,18 @@ define @ceil_nxv4f32_to_si16( %x) { ; RV32-LABEL: ceil_nxv4f32_to_si16: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.x.f.w v10, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV32-NEXT: vfncvt.x.f.w v10, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv.v.v v8, v10 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f32_to_si16: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.x.f.w v10, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV64-NEXT: vfncvt.x.f.w v10, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv.v.v v8, v10 ; RV64-NEXT: ret @@ -750,20 +736,18 @@ define @ceil_nxv4f32_to_ui16( %x) { ; RV32-LABEL: ceil_nxv4f32_to_ui16: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.xu.f.w v10, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV32-NEXT: vfncvt.xu.f.w v10, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv.v.v v8, v10 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f32_to_ui16: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.xu.f.w v10, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV64-NEXT: vfncvt.xu.f.w v10, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv.v.v v8, v10 ; RV64-NEXT: ret @@ -775,19 +759,17 @@ define @ceil_nxv4f32_to_si32( %x) { ; RV32-LABEL: ceil_nxv4f32_to_si32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV32-NEXT: vfcvt.x.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f32_to_si32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV64-NEXT: vfcvt.x.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv4f32( %x) @@ -798,19 +780,17 @@ define @ceil_nxv4f32_to_ui32( %x) { ; RV32-LABEL: ceil_nxv4f32_to_ui32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV32-NEXT: vfcvt.xu.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f32_to_ui32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV64-NEXT: vfcvt.xu.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv4f32( %x) @@ -821,20 +801,18 @@ define @ceil_nxv4f32_to_si64( %x) { ; RV32-LABEL: ceil_nxv4f32_to_si64: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfwcvt.x.f.v v12, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV32-NEXT: vfwcvt.x.f.v v12, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv4r.v v8, v12 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f32_to_si64: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfwcvt.x.f.v v12, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV64-NEXT: vfwcvt.x.f.v v12, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv4r.v v8, v12 ; RV64-NEXT: ret @@ -846,20 +824,18 @@ define @ceil_nxv4f32_to_ui64( %x) { ; RV32-LABEL: ceil_nxv4f32_to_ui64: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfwcvt.xu.f.v v12, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV32-NEXT: vfwcvt.xu.f.v v12, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv4r.v v8, v12 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f32_to_ui64: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfwcvt.xu.f.v v12, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e32, m2, ta, ma +; RV64-NEXT: vfwcvt.xu.f.v v12, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv4r.v v8, v12 ; RV64-NEXT: ret diff --git a/llvm/test/CodeGen/RISCV/rvv/half-round-conv.ll b/llvm/test/CodeGen/RISCV/rvv/half-round-conv.ll --- a/llvm/test/CodeGen/RISCV/rvv/half-round-conv.ll +++ b/llvm/test/CodeGen/RISCV/rvv/half-round-conv.ll @@ -393,20 +393,18 @@ define @ceil_nxv1f16_to_si8( %x) { ; RV32-LABEL: ceil_nxv1f16_to_si8: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e8, mf8, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.x.f.w v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e8, mf8, ta, ma +; RV32-NEXT: vfncvt.x.f.w v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f16_to_si8: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e8, mf8, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.x.f.w v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e8, mf8, ta, ma +; RV64-NEXT: vfncvt.x.f.w v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -418,20 +416,18 @@ define @ceil_nxv1f16_to_ui8( %x) { ; RV32-LABEL: ceil_nxv1f16_to_ui8: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e8, mf8, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.xu.f.w v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e8, mf8, ta, ma +; RV32-NEXT: vfncvt.xu.f.w v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f16_to_ui8: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e8, mf8, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.xu.f.w v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e8, mf8, ta, ma +; RV64-NEXT: vfncvt.xu.f.w v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -443,19 +439,17 @@ define @ceil_nxv1f16_to_si16( %x) { ; RV32-LABEL: ceil_nxv1f16_to_si16: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV32-NEXT: vfcvt.x.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f16_to_si16: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV64-NEXT: vfcvt.x.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv1f16( %x) @@ -466,19 +460,17 @@ define @ceil_nxv1f16_to_ui16( %x) { ; RV32-LABEL: ceil_nxv1f16_to_ui16: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV32-NEXT: vfcvt.xu.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f16_to_ui16: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV64-NEXT: vfcvt.xu.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv1f16( %x) @@ -489,20 +481,18 @@ define @ceil_nxv1f16_to_si32( %x) { ; RV32-LABEL: ceil_nxv1f16_to_si32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfwcvt.x.f.v v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV32-NEXT: vfwcvt.x.f.v v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f16_to_si32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfwcvt.x.f.v v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV64-NEXT: vfwcvt.x.f.v v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -514,20 +504,18 @@ define @ceil_nxv1f16_to_ui32( %x) { ; RV32-LABEL: ceil_nxv1f16_to_ui32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfwcvt.xu.f.v v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV32-NEXT: vfwcvt.xu.f.v v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv1f16_to_ui32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfwcvt.xu.f.v v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, mf4, ta, ma +; RV64-NEXT: vfwcvt.xu.f.v v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -627,20 +615,18 @@ define @ceil_nxv4f16_to_si8( %x) { ; RV32-LABEL: ceil_nxv4f16_to_si8: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e8, mf2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.x.f.w v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e8, mf2, ta, ma +; RV32-NEXT: vfncvt.x.f.w v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f16_to_si8: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e8, mf2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.x.f.w v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e8, mf2, ta, ma +; RV64-NEXT: vfncvt.x.f.w v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -652,20 +638,18 @@ define @ceil_nxv4f16_to_ui8( %x) { ; RV32-LABEL: ceil_nxv4f16_to_ui8: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e8, mf2, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfncvt.xu.f.w v9, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e8, mf2, ta, ma +; RV32-NEXT: vfncvt.xu.f.w v9, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv1r.v v8, v9 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f16_to_ui8: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e8, mf2, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfncvt.xu.f.w v9, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e8, mf2, ta, ma +; RV64-NEXT: vfncvt.xu.f.w v9, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv1r.v v8, v9 ; RV64-NEXT: ret @@ -677,19 +661,17 @@ define @ceil_nxv4f16_to_si16( %x) { ; RV32-LABEL: ceil_nxv4f16_to_si16: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV32-NEXT: vfcvt.x.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f16_to_si16: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.x.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV64-NEXT: vfcvt.x.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv4f16( %x) @@ -700,19 +682,17 @@ define @ceil_nxv4f16_to_ui16( %x) { ; RV32-LABEL: ceil_nxv4f16_to_ui16: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV32-NEXT: vfcvt.xu.f.v v8, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f16_to_ui16: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfcvt.xu.f.v v8, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV64-NEXT: vfcvt.xu.f.v v8, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: ret %a = call @llvm.ceil.nxv4f16( %x) @@ -723,20 +703,18 @@ define @ceil_nxv4f16_to_si32( %x) { ; RV32-LABEL: ceil_nxv4f16_to_si32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfwcvt.x.f.v v10, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV32-NEXT: vfwcvt.x.f.v v10, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv2r.v v8, v10 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f16_to_si32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfwcvt.x.f.v v10, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV64-NEXT: vfwcvt.x.f.v v10, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv2r.v v8, v10 ; RV64-NEXT: ret @@ -748,20 +726,18 @@ define @ceil_nxv4f16_to_ui32( %x) { ; RV32-LABEL: ceil_nxv4f16_to_ui32: ; RV32: # %bb.0: -; RV32-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV32-NEXT: vmset.m v0 ; RV32-NEXT: fsrmi a0, 3 -; RV32-NEXT: vfwcvt.xu.f.v v10, v8, v0.t +; RV32-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV32-NEXT: vfwcvt.xu.f.v v10, v8 ; RV32-NEXT: fsrm a0 ; RV32-NEXT: vmv2r.v v8, v10 ; RV32-NEXT: ret ; ; RV64-LABEL: ceil_nxv4f16_to_ui32: ; RV64: # %bb.0: -; RV64-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; RV64-NEXT: vmset.m v0 ; RV64-NEXT: fsrmi a0, 3 -; RV64-NEXT: vfwcvt.xu.f.v v10, v8, v0.t +; RV64-NEXT: vsetvli a1, zero, e16, m1, ta, ma +; RV64-NEXT: vfwcvt.xu.f.v v10, v8 ; RV64-NEXT: fsrm a0 ; RV64-NEXT: vmv2r.v v8, v10 ; RV64-NEXT: ret