-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[X86][APX] Exclusively emit setzucc to avoid false dependency #142092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
30b8975
46c148b
85e4617
92f4fdd
608f957
17bd924
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,10 +79,11 @@ bool X86FixupSetCCPass::runOnMachineFunction(MachineFunction &MF) { | |
| if (MI.definesRegister(X86::EFLAGS, /*TRI=*/nullptr)) | ||
| FlagsDefMI = &MI; | ||
|
|
||
| // Find a setcc that is used by a zext. | ||
| // Find a setcc/setzucc (if ZU is enabled) that is used by a zext. | ||
| // This doesn't have to be the only use, the transformation is safe | ||
| // regardless. | ||
| if (MI.getOpcode() != X86::SETCCr) | ||
| if (MI.getOpcode() != X86::SETCCr && | ||
| (!ST->hasZU() || MI.getOpcode() != X86::SETZUCCr)) | ||
|
||
| continue; | ||
|
|
||
| MachineInstr *ZExt = nullptr; | ||
|
|
@@ -122,7 +123,8 @@ bool X86FixupSetCCPass::runOnMachineFunction(MachineFunction &MF) { | |
| // register. | ||
| Register ZeroReg = MRI->createVirtualRegister(RC); | ||
| if (ST->hasZU()) { | ||
| MI.setDesc(TII->get(X86::SETZUCCr)); | ||
| if (MI.getOpcode() != X86::SETZUCCr) | ||
| MI.setDesc(TII->get(X86::SETZUCCr)); | ||
|
||
| BuildMI(*ZExt->getParent(), ZExt, ZExt->getDebugLoc(), | ||
| TII->get(TargetOpcode::IMPLICIT_DEF), ZeroReg); | ||
| } else { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,11 +137,14 @@ let Predicates = [HasCMOV, HasCF] in { | |
| } | ||
|
|
||
| // SetCC instructions. | ||
| let Uses = [EFLAGS], isCodeGenOnly = 1, ForceDisassemble = 1 in { | ||
| let Uses = [EFLAGS], isCodeGenOnly = 1, ForceDisassemble = 1, Predicates = [NoNDD] in { | ||
|
||
| def SETCCr : I<0x90, MRMXrCC, (outs GR8:$dst), (ins ccode:$cond), | ||
| "set${cond}\t$dst", | ||
| [(set GR8:$dst, (X86setcc timm:$cond, EFLAGS))]>, | ||
| TB, Sched<[WriteSETCC]>; | ||
| } | ||
|
|
||
| let Uses = [EFLAGS], isCodeGenOnly = 1, ForceDisassemble = 1 in { | ||
| def SETCCm : I<0x90, MRMXmCC, (outs), (ins i8mem:$dst, ccode:$cond), | ||
| "set${cond}\t$dst", | ||
| [(store (X86setcc timm:$cond, EFLAGS), addr:$dst)]>, | ||
|
|
@@ -152,7 +155,8 @@ let Uses = [EFLAGS], isCodeGenOnly = 1, ForceDisassemble = 1 in { | |
| let Uses = [EFLAGS], isCodeGenOnly = 1, ForceDisassemble = 1, | ||
| hasSideEffects = 0, Predicates = [In64BitMode], Predicates = [HasNDD] in { | ||
| def SETZUCCr : I<0x40, MRMXrCC, (outs GR8:$dst), (ins ccode:$cond), | ||
| "setzu${cond}\t$dst", []>, | ||
| "setzu${cond}\t$dst", | ||
| [(set GR8:$dst, (X86setcc timm:$cond, EFLAGS))]>, | ||
| XD, ZU, NoCD8, Sched<[WriteSETCC]>; | ||
| def SETCCr_EVEX : I<0x40, MRMXrCC, (outs GR8:$dst), (ins ccode:$cond), | ||
| "set${cond}\t$dst", []>, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define GET_SETCC (Subtarget->hasZU() ? X86::SETZUCCr : X86::SETCCr)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.