[llvm] [X86][FixupSetCC] Substitute setcc + zext pair with setzucc if possible (PR #96594)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 00:25:48 PDT 2024
================
@@ -110,17 +117,23 @@ bool X86FixupSetCCPass::runOnMachineFunction(MachineFunction &MF) {
++NumSubstZexts;
Changed = true;
- // Initialize a register with 0. This must go before the eflags def
+ // X86 setcc/setzucc only takes an output GR8, so fake a GR32 input by
+ // inserting the setcc/setzucc result into the low byte of the zeroed
+ // register.
Register ZeroReg = MRI->createVirtualRegister(RC);
- BuildMI(MBB, FlagsDefMI, MI.getDebugLoc(), TII->get(X86::MOV32r0),
- ZeroReg);
+ if (ST->hasZU()) {
+ MI.setDesc(TII->get(X86::SETZUCCr));
+ BuildMI(*ZExt->getParent(), ZExt, ZExt->getDebugLoc(),
+ TII->get(TargetOpcode::IMPLICIT_DEF), ZeroReg);
+ } else
+ // Initialize a register with 0. This must go before the eflags def
+ BuildMI(MBB, FlagsDefMI, MI.getDebugLoc(), TII->get(X86::MOV32r0),
----------------
goldsteinn wrote:
Was MBB incorrect here?
https://github.com/llvm/llvm-project/pull/96594
More information about the llvm-commits
mailing list