[llvm-commits] [llvm] r152847 - /llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
Chad Rosier
mcrosier at apple.com
Thu Mar 15 15:37:27 PDT 2012
On Mar 15, 2012, at 3:06 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Thu, Mar 15, 2012 at 2:40 PM, Chad Rosier <mcrosier at apple.com> wrote:
>> Author: mcrosier
>> Date: Thu Mar 15 16:40:23 2012
>> New Revision: 152847
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=152847&view=rev
>> Log:
>> [fast-isel] Don't try to encode LONG_MIN using cmn instructions.
>> rdar://11038907
>>
>> Modified:
>> llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
>>
>> Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=152847&r1=152846&r2=152847&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original)
>> +++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Thu Mar 15 16:40:23 2012
>> @@ -1384,12 +1384,16 @@
>> SrcVT == MVT::i1) {
>> const APInt &CIVal = ConstInt->getValue();
>> Imm = (isZExt) ? (int)CIVal.getZExtValue() : (int)CIVal.getSExtValue();
>> - if (Imm < 0) {
>> - isNegativeImm = true;
>> - Imm = -Imm;
>> + // We can't encode LONG_MIN (i.e., 0x80000000) as an immediate because
>> + // there is no way to represent 2147483648 as a signed 32-bit int.
>> + if (Imm != (int)0x80000000) {
>> + if (Imm < 0) {
>> + isNegativeImm = true;
>> + Imm = -Imm;
>> + }
>> + UseImm = isThumb2 ? (ARM_AM::getT2SOImmVal(Imm) != -1) :
>> + (ARM_AM::getSOImmVal(Imm) != -1);
>> }
>> - UseImm = isThumb2 ? (ARM_AM::getT2SOImmVal(Imm) != -1) :
>> - (ARM_AM::getSOImmVal(Imm) != -1);
>
> Why not just skip the negation rather than forcing it not to use an
> immediate? ARM_AM::getT2SOImmVal(INT_MIN) will succeed, AFAIK.
Ah, yes. That would be a better fix. I'll double check if it works.
> Also, missing test case.
Coming up!
Thanks, Eli.
> -Eli
More information about the llvm-commits
mailing list