Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Plz update llvm/docs/RISCVUsage.rst to update the support status from Assembly Support to Support :)
Do we need any changes for GPRF32 in RISCVInstrInfo::storeRegToStackSlot and RISCVInstrInfo::loadRegFromStackSlot?
- I tried to add a diff, but the test file didn't change at all.
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp index b41f7afc1aa5..8ea0b5d4bce4 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -524,6 +524,9 @@ void RISCVInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB, } else if (RISCV::FPR32RegClass.hasSubClassEq(RC)) { Opcode = RISCV::FSW; IsScalableVector = false; + } else if (RISCV::GPRF32RegClass.hasSubClassEq(RC)) { + Opcode = RISCV::SW; + IsScalableVector = false; } else if (RISCV::FPR64RegClass.hasSubClassEq(RC)) { Opcode = RISCV::FSD; IsScalableVector = false; @@ -608,6 +611,9 @@ void RISCVInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB, } else if (RISCV::FPR32RegClass.hasSubClassEq(RC)) { Opcode = RISCV::FLW; IsScalableVector = false; + } else if (RISCV::GPRF32RegClass.hasSubClassEq(RC)) { + Opcode = RISCV::LW; + IsScalableVector = false; } else if (RISCV::FPR64RegClass.hasSubClassEq(RC)) { Opcode = RISCV::FLD; IsScalableVector = false;
- RISCV::GPRF32RegClass uses the same registers as RISCV::GPRRegClass in practice. In RISCVInstrInfo::storeRegToStackSlot and RISCVInstrInfo::loadRegFromStackSlot, the corresponding load/store will be selected.
if (RISCV::GPRRegClass.hasSubClassEq(RC)) { Opcode = TRI->getRegSizeInBits(RISCV::GPRRegClass) == 32 ? RISCV::SW : RISCV::SD; IsScalableVector = false; }
- So is it possible that RISCVInstrInfo::storeRegToStackSlot and RISCVInstrInfo::loadRegFromStackSlot don't need to be modified?
llvm/lib/Target/RISCV/RISCVInstrInfoF.td | ||
---|---|---|
742 | This pattern doesn't look right. A copy would not guarantee sign extension. |
llvm/lib/Target/RISCV/RISCVInstrInfoF.td | ||
---|---|---|
586–587 | def : Pat<(sext_inreg (riscv_fmv_x_anyextw_rv64 FPR32:$src), i32), (FMV_X_W FPR32:$src)>; | |
742 | def : Pat<(sext_inreg (riscv_fmv_x_anyextw_rv64 GPRF32:$src), i32), (COPY GPRF32:$src)>; After deletion, it will generate the sext.w a0, a0 instruction in the bcvt_f32_to_sext_i32 test. |
llvm/lib/Target/RISCV/RISCVInstrInfoF.td | ||
---|---|---|
644 | def : Pat<(f32 (load (AddrRegImm GPR:$rs1, simm12:$imm12))), (COPY_TO_REGCLASS (LW GPR:$rs1, simm12:$imm12), GPRF32)>; | |
647 | def : Pat<(store (f32 FPR32INX:$rs2), (AddrRegImm GPR:$rs1, simm12:$imm12)), (SW (COPY_TO_REGCLASS FPR32INX:$rs2, GPR), GPR:$rs1, simm12:$imm12)>; | |
660 | (COPY_TO_REGCLASS GPR:$rs1, GPRF32) | |
661 | (COPY_TO_REGCLASS FPR32INX:$rs1, GPR) | |
740 | (COPY_TO_REGCLASS GPR:$src, GPRF32) | |
741 | (COPY_TO_REGCLASS GPRF32:$src, GPR) |
Is FMV_W_X_RV64 correct for Zfinx?