diff options
author | Chad Rosier <mcrosier@apple.com> | 2011-11-10 01:30:39 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2011-11-10 01:30:39 +0000 |
commit | 3fbd094ad96ada9bd02dd454ba655f7d707ab862 (patch) | |
tree | 3316f24f739b7115d0ff130d11617eb8b4d5aa72 /llvm/lib/Target/ARM/ARMFastISel.cpp | |
parent | dac5efa8c48362d521599e1e8c91f66090018eba (diff) | |
download | bcm5719-llvm-3fbd094ad96ada9bd02dd454ba655f7d707ab862.tar.gz bcm5719-llvm-3fbd094ad96ada9bd02dd454ba655f7d707ab862.zip |
For immediate encodings of icmp, zero or sign extend first. Then
determine if the value is negative and flip the sign accordingly.
rdar://10422026
llvm-svn: 144258
Diffstat (limited to 'llvm/lib/Target/ARM/ARMFastISel.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMFastISel.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp index 44c88aa7fd7..4c47ff9cdfb 100644 --- a/llvm/lib/Target/ARM/ARMFastISel.cpp +++ b/llvm/lib/Target/ARM/ARMFastISel.cpp @@ -1216,7 +1216,6 @@ bool ARMFastISel::ARMEmitCmp(const Value *Src1Value, const Value *Src2Value, // Check to see if the 2nd operand is a constant that we can encode directly // in the compare. - uint64_t Imm; int EncodedImm = 0; bool EncodeImm = false; bool isNegativeImm = false; @@ -1224,10 +1223,11 @@ bool ARMFastISel::ARMEmitCmp(const Value *Src1Value, const Value *Src2Value, if (SrcVT == MVT::i32 || SrcVT == MVT::i16 || SrcVT == MVT::i8 || SrcVT == MVT::i1) { const APInt &CIVal = ConstInt->getValue(); - - isNegativeImm = CIVal.isNegative(); - Imm = (isNegativeImm) ? (-CIVal).getZExtValue() : CIVal.getZExtValue(); - EncodedImm = (int)Imm; + EncodedImm = (isZExt) ? (int)CIVal.getZExtValue() : (int)CIVal.getSExtValue(); + if (EncodedImm < 0) { + isNegativeImm = true; + EncodedImm = -EncodedImm; + } EncodeImm = isThumb2 ? (ARM_AM::getT2SOImmVal(EncodedImm) != -1) : (ARM_AM::getSOImmVal(EncodedImm) != -1); } |