aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-16 01:24:48 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-16 01:24:48 +0800
commit9388ff494a554e1f5d529be3636f9e1596fbf035 (patch)
tree11091166469e71b10eb098171b0e7c1f97159f92 /backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
parent5a91301bb6f7ba5b3bd8d383f21831962a68e670 (diff)
downloadrcc-project-9388ff494a554e1f5d529be3636f9e1596fbf035.tar.gz
rcc-project-9388ff494a554e1f5d529be3636f9e1596fbf035.tar.xz
[RISCV][GlobalISel] Select word division pseudos
Diffstat (limited to 'backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp')
-rw-r--r--backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp b/backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
index 854b6a5..1d7aec2 100644
--- a/backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
+++ b/backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
@@ -185,7 +185,10 @@ public:
const TargetDescription &Target) const override {
if (Instruction.opcode() == instructionOpcode(InstructionOpcode::G_SLLW) ||
Instruction.opcode() == instructionOpcode(InstructionOpcode::G_SRAW) ||
- Instruction.opcode() == instructionOpcode(InstructionOpcode::G_SRLW)) {
+ Instruction.opcode() == instructionOpcode(InstructionOpcode::G_SRLW) ||
+ Instruction.opcode() == instructionOpcode(InstructionOpcode::G_DIVW) ||
+ Instruction.opcode() == instructionOpcode(InstructionOpcode::G_DIVUW) ||
+ Instruction.opcode() == instructionOpcode(InstructionOpcode::G_REMUW)) {
const std::optional<LowLevelType> Type = resultType(Function, Instruction);
const std::optional<LowLevelType> Left = operandType(Function, Instruction, 1);
const std::optional<LowLevelType> Right = operandType(Function, Instruction, 2);
@@ -349,6 +352,12 @@ public:
return Instruction.setOpcode(instructionOpcode(InstructionOpcode::SRAW));
if (Instruction.opcode() == instructionOpcode(InstructionOpcode::G_SRLW))
return Instruction.setOpcode(instructionOpcode(InstructionOpcode::SRLW));
+ if (Instruction.opcode() == instructionOpcode(InstructionOpcode::G_DIVW))
+ return Instruction.setOpcode(instructionOpcode(InstructionOpcode::DIVW));
+ if (Instruction.opcode() == instructionOpcode(InstructionOpcode::G_DIVUW))
+ return Instruction.setOpcode(instructionOpcode(InstructionOpcode::DIVUW));
+ if (Instruction.opcode() == instructionOpcode(InstructionOpcode::G_REMUW))
+ return Instruction.setOpcode(instructionOpcode(InstructionOpcode::REMUW));
const GenericOpcode Generic = static_cast<GenericOpcode>(Instruction.opcode().value());
const std::optional<LowLevelType> Type = resultType(Function, Instruction);