[llvm] [RISCV] Use C.ADD when OR is not compressible due to register restriction (PR #156044)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 30 18:50:45 PDT 2025
================
@@ -1178,7 +1178,21 @@ bool RISCVAsmPrinter::lowerToMCInst(const MachineInstr *MI, MCInst &OutMI) {
if (lowerRISCVVMachineInstrToMCInst(MI, OutMI, STI))
return false;
- OutMI.setOpcode(MI->getOpcode());
+ unsigned Opcode = MI->getOpcode();
+ // If we have a disjoint OR which isn't compressible as an c.or, we can
+ // convert it to a c.add which doesn't have the gprc register restriction.
+ if (STI->hasStdExtZca() && Opcode == RISCV::OR &&
+ MI->getFlag(MachineInstr::Disjoint)) {
----------------
preames wrote:
See https://github.com/llvm/llvm-project/pull/156218
https://github.com/llvm/llvm-project/pull/156044
More information about the llvm-commits
mailing list