Skip to content

Commit 608f957

Browse files
committed
Update predicate for setcc/setzucc and tests accordingly
1 parent 92f4fdd commit 608f957

File tree

15 files changed

+4623
-2403
lines changed

15 files changed

+4623
-2403
lines changed

llvm/lib/Target/X86/X86FixupSetCC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ bool X86FixupSetCCPass::runOnMachineFunction(MachineFunction &MF) {
122122
// register.
123123
Register ZeroReg = MRI->createVirtualRegister(RC);
124124
if (ST->hasZU()) {
125-
if (MI.getOpcode() != X86::SETZUCCr)
126-
MI.setDesc(TII->get(X86::SETZUCCr));
125+
assert((MI.getOpcode() == X86::SETZUCCr) &&
126+
"Expect setzucc instruction!");
127127
BuildMI(*ZExt->getParent(), ZExt, ZExt->getDebugLoc(),
128128
TII->get(TargetOpcode::IMPLICIT_DEF), ZeroReg);
129129
} else {

llvm/lib/Target/X86/X86InstrCMovSetCC.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ let Predicates = [HasCMOV, HasCF] in {
137137
}
138138

139139
// SetCC instructions.
140-
let Uses = [EFLAGS], isCodeGenOnly = 1, ForceDisassemble = 1, Predicates = [NoNDD] in {
140+
let Uses = [EFLAGS], isCodeGenOnly = 1, ForceDisassemble = 1, Predicates = [NoZU] in {
141141
def SETCCr : I<0x90, MRMXrCC, (outs GR8:$dst), (ins ccode:$cond),
142142
"set${cond}\t$dst",
143143
[(set GR8:$dst, (X86setcc timm:$cond, EFLAGS))]>,
@@ -153,7 +153,7 @@ let Uses = [EFLAGS], isCodeGenOnly = 1, ForceDisassemble = 1 in {
153153

154154
// SetZUCC and promoted SetCC instructions.
155155
let Uses = [EFLAGS], isCodeGenOnly = 1, ForceDisassemble = 1,
156-
hasSideEffects = 0, Predicates = [In64BitMode], Predicates = [HasNDD] in {
156+
hasSideEffects = 0, Predicates = [In64BitMode], Predicates = [HasZU] in {
157157
def SETZUCCr : I<0x40, MRMXrCC, (outs GR8:$dst), (ins ccode:$cond),
158158
"setzu${cond}\t$dst",
159159
[(set GR8:$dst, (X86setcc timm:$cond, EFLAGS))]>,

llvm/lib/Target/X86/X86InstrPredicates.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def NoEGPR : Predicate<"!Subtarget->hasEGPR()">;
4646
def HasNDD : Predicate<"Subtarget->hasNDD()">;
4747
def NoNDD : Predicate<"!Subtarget->hasNDD()">;
4848
def HasZU : Predicate<"Subtarget->hasZU()">;
49+
def NoZU : Predicate<"!Subtarget->hasZU()">;
4950
def HasCF : Predicate<"Subtarget->hasCF()">;
5051
def HasCMOV : Predicate<"Subtarget->canUseCMOV()">;
5152
def NoCMOV : Predicate<"!Subtarget->canUseCMOV()">;

llvm/test/CodeGen/X86/apx/add.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ define i1 @add64ri_reloc(i16 %k) {
758758
; CHECK-NEXT: addq %rax, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x01,0xc0]
759759
; CHECK-NEXT: addq $val, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x05,A,A,A,A]
760760
; CHECK-NEXT: # fixup A - offset: 2, value: val, kind: reloc_signed_4byte
761-
; CHECK-NEXT: setzune %al # encoding: [0x62,0xf4,0x7f,0x18,0x45,0xc0]
761+
; CHECK-NEXT: setne %al # encoding: [0x0f,0x95,0xc0]
762762
; CHECK-NEXT: retq # encoding: [0xc3]
763763
;
764764
; NF-LABEL: add64ri_reloc:
@@ -768,7 +768,7 @@ define i1 @add64ri_reloc(i16 %k) {
768768
; NF-NEXT: addq %rax, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x01,0xc0]
769769
; NF-NEXT: addq $val, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x05,A,A,A,A]
770770
; NF-NEXT: # fixup A - offset: 2, value: val, kind: reloc_signed_4byte
771-
; NF-NEXT: setzune %al # encoding: [0x62,0xf4,0x7f,0x18,0x45,0xc0]
771+
; NF-NEXT: setne %al # encoding: [0x0f,0x95,0xc0]
772772
; NF-NEXT: retq # encoding: [0xc3]
773773
%g = getelementptr inbounds i16, ptr @val, i16 %k
774774
%cmp = icmp ne ptr %g, null

0 commit comments

Comments
 (0)