[llvm] r310653 - [ARM] Clarify legal addressing modes for ARM and Thumb2. NFC
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 10 12:31:27 PDT 2017
Author: efriedma
Date: Thu Aug 10 12:31:27 2017
New Revision: 310653
URL: http://llvm.org/viewvc/llvm-project?rev=310653&view=rev
Log:
[ARM] Clarify legal addressing modes for ARM and Thumb2. NFC
The existing code is very clever, but not clear, which seems
like the wrong tradeoff here.
Differential Revision: https://reviews.llvm.org/D36559
Modified:
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=310653&r1=310652&r2=310653&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Thu Aug 10 12:31:27 2017
@@ -12357,8 +12357,13 @@ bool ARMTargetLowering::isLegalT2ScaledA
Scale = Scale & ~1;
return Scale == 2 || Scale == 4 || Scale == 8;
case MVT::i64:
+ // FIXME: What are we trying to model here? ldrd doesn't have an r + r
+ // version in Thumb mode.
// r + r
- if (((unsigned)AM.HasBaseReg + Scale) <= 2)
+ if (Scale == 1)
+ return true;
+ // r * 2 (this can be lowered to r + r).
+ if (!AM.HasBaseReg && Scale == 2)
return true;
return false;
case MVT::isVoid:
@@ -12416,8 +12421,11 @@ bool ARMTargetLowering::isLegalAddressin
return isPowerOf2_32(Scale & ~1);
case MVT::i16:
case MVT::i64:
- // r + r
- if (((unsigned)AM.HasBaseReg + Scale) <= 2)
+ // r +/- r
+ if (Scale == 1 || (AM.HasBaseReg && Scale == -1))
+ return true;
+ // r * 2 (this can be lowered to r + r).
+ if (!AM.HasBaseReg && Scale == 2)
return true;
return false;
More information about the llvm-commits
mailing list