diff options
author | Quentin Colombet <qcolombet@apple.com> | 2014-04-23 20:43:38 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2014-04-23 20:43:38 +0000 |
commit | 28a24ca47165d035df5c5533071970f96c3b4808 (patch) | |
tree | 92ebee1f0c68c8a52ea436e64d93f7d1f1dc336f /lib | |
parent | 0f31056e7a29374ce549dbac23996cfd844c8cc9 (diff) | |
download | llvm-28a24ca47165d035df5c5533071970f96c3b4808.tar.gz llvm-28a24ca47165d035df5c5533071970f96c3b4808.tar.bz2 llvm-28a24ca47165d035df5c5533071970f96c3b4808.tar.xz |
[ARM64] Fix the information we give to the peephole optimizer for comparison.
ANDS does not use the same encoding scheme as other xxxS instructions (e.g.,
ADDS). Take that into account to avoid wrong peephole optimization.
<rdar://problem/16693089>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207020 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM64/ARM64InstrInfo.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Target/ARM64/ARM64InstrInfo.cpp b/lib/Target/ARM64/ARM64InstrInfo.cpp index 2c2b3ec19c..6a86723e04 100644 --- a/lib/Target/ARM64/ARM64InstrInfo.cpp +++ b/lib/Target/ARM64/ARM64InstrInfo.cpp @@ -567,15 +567,24 @@ bool ARM64InstrInfo::analyzeCompare(const MachineInstr *MI, unsigned &SrcReg, return true; case ARM64::SUBSWri: case ARM64::ADDSWri: - case ARM64::ANDSWri: case ARM64::SUBSXri: case ARM64::ADDSXri: - case ARM64::ANDSXri: SrcReg = MI->getOperand(1).getReg(); SrcReg2 = 0; CmpMask = ~0; CmpValue = MI->getOperand(2).getImm(); return true; + case ARM64::ANDSWri: + case ARM64::ANDSXri: + // ANDS does not use the same encoding scheme as the others xxxS + // instructions. + SrcReg = MI->getOperand(1).getReg(); + SrcReg2 = 0; + CmpMask = ~0; + CmpValue = ARM64_AM::decodeLogicalImmediate( + MI->getOperand(2).getImm(), + MI->getOpcode() == ARM64::ANDSWri ? 32 : 64); + return true; } return false; |