From 6bb5c42da057ddfb2d38979bb84ca04eb80e3041 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Tue, 17 Jan 2017 23:04:01 +0000 Subject: [PATCH] GlobalISel: fix comparison order for G_FCMP As with G_ICMP we'd written the CSET instructions backwards. llvm-svn: 292285 --- lib/Target/AArch64/AArch64InstructionSelector.cpp | 4 ++-- test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Target/AArch64/AArch64InstructionSelector.cpp b/lib/Target/AArch64/AArch64InstructionSelector.cpp index b51473524c7..f8565379998 100644 --- a/lib/Target/AArch64/AArch64InstructionSelector.cpp +++ b/lib/Target/AArch64/AArch64InstructionSelector.cpp @@ -1134,7 +1134,7 @@ bool AArch64InstructionSelector::select(MachineInstr &I) const { .addDef(Def1Reg) .addUse(AArch64::WZR) .addUse(AArch64::WZR) - .addImm(CC1); + .addImm(getInvertedCondCode(CC1)); if (CC2 != AArch64CC::AL) { unsigned Def2Reg = MRI.createVirtualRegister(&AArch64::GPR32RegClass); @@ -1143,7 +1143,7 @@ bool AArch64InstructionSelector::select(MachineInstr &I) const { .addDef(Def2Reg) .addUse(AArch64::WZR) .addUse(AArch64::WZR) - .addImm(CC2); + .addImm(getInvertedCondCode(CC2)); MachineInstr &OrMI = *BuildMI(MBB, I, I.getDebugLoc(), TII.get(AArch64::ORRWrr)) .addDef(DefReg) diff --git a/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir b/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir index ece5a858b49..b443303eaf5 100644 --- a/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir +++ b/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir @@ -2879,12 +2879,12 @@ registers: # CHECK: body: # CHECK: FCMPSrr %0, %0, implicit-def %nzcv -# CHECK: [[TST_MI:%[0-9]+]] = CSINCWr %wzr, %wzr, 4, implicit %nzcv -# CHECK: [[TST_GT:%[0-9]+]] = CSINCWr %wzr, %wzr, 12, implicit %nzcv +# CHECK: [[TST_MI:%[0-9]+]] = CSINCWr %wzr, %wzr, 5, implicit %nzcv +# CHECK: [[TST_GT:%[0-9]+]] = CSINCWr %wzr, %wzr, 13, implicit %nzcv # CHECK: %1 = ORRWrr [[TST_MI]], [[TST_GT]] # CHECK: FCMPDrr %2, %2, implicit-def %nzcv -# CHECK: %3 = CSINCWr %wzr, %wzr, 5, implicit %nzcv +# CHECK: %3 = CSINCWr %wzr, %wzr, 4, implicit %nzcv body: | bb.0: