mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-05 19:10:19 +00:00
[GlobalISel] Fix AArch64 ICMP instruction selection
Differential Revision: https://reviews.llvm.org/D28175 llvm-svn: 291097
This commit is contained in:
parent
74ff99c1f4
commit
092ee33045
@ -1071,8 +1071,12 @@ bool AArch64InstructionSelector::select(MachineInstr &I) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
const AArch64CC::CondCode CC = changeICMPPredToAArch64CC(
|
||||
(CmpInst::Predicate)I.getOperand(1).getPredicate());
|
||||
// CSINC increments the result by one when the condition code is false.
|
||||
// Therefore, we have to invert the predicate to get an increment by 1 when
|
||||
// the predicate is true.
|
||||
const AArch64CC::CondCode invCC =
|
||||
changeICMPPredToAArch64CC(CmpInst::getInversePredicate(
|
||||
(CmpInst::Predicate)I.getOperand(1).getPredicate()));
|
||||
|
||||
MachineInstr &CmpMI = *BuildMI(MBB, I, I.getDebugLoc(), TII.get(CmpOpc))
|
||||
.addDef(ZReg)
|
||||
@ -1084,7 +1088,7 @@ bool AArch64InstructionSelector::select(MachineInstr &I) const {
|
||||
.addDef(I.getOperand(0).getReg())
|
||||
.addUse(AArch64::WZR)
|
||||
.addUse(AArch64::WZR)
|
||||
.addImm(CC);
|
||||
.addImm(invCC);
|
||||
|
||||
constrainSelectedInstRegOperands(CmpMI, TII, TRI, RBI);
|
||||
constrainSelectedInstRegOperands(CSetMI, TII, TRI, RBI);
|
||||
|
@ -2836,13 +2836,13 @@ registers:
|
||||
|
||||
# CHECK: body:
|
||||
# CHECK: %wzr = SUBSWrr %0, %0, implicit-def %nzcv
|
||||
# CHECK: %1 = CSINCWr %wzr, %wzr, 0, implicit %nzcv
|
||||
# CHECK: %1 = CSINCWr %wzr, %wzr, 1, implicit %nzcv
|
||||
|
||||
# CHECK: %xzr = SUBSXrr %2, %2, implicit-def %nzcv
|
||||
# CHECK: %3 = CSINCWr %wzr, %wzr, 2, implicit %nzcv
|
||||
# CHECK: %3 = CSINCWr %wzr, %wzr, 3, implicit %nzcv
|
||||
|
||||
# CHECK: %xzr = SUBSXrr %4, %4, implicit-def %nzcv
|
||||
# CHECK: %5 = CSINCWr %wzr, %wzr, 1, implicit %nzcv
|
||||
# CHECK: %5 = CSINCWr %wzr, %wzr, 0, implicit %nzcv
|
||||
|
||||
body: |
|
||||
bb.0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user