diff options
author | Jim Grosbach <grosbach@apple.com> | 2011-10-28 22:36:30 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2011-10-28 22:36:30 +0000 |
commit | 89a633708542de5847e807f98f86edfefc9fc019 (patch) | |
tree | fe302d4a900bb7bd0106a7571975841f27455d0f /lib/Target/ARM/ARMInstrThumb2.td | |
parent | 48c1f84b104fd32109d809a56f5ebbf461c0910c (diff) | |
download | llvm-89a633708542de5847e807f98f86edfefc9fc019.tar.gz llvm-89a633708542de5847e807f98f86edfefc9fc019.tar.bz2 llvm-89a633708542de5847e807f98f86edfefc9fc019.tar.xz |
Add Thumb2 alias for "mov Rd, #imm" to "mvn Rd, #~imm".
When '~imm' is encodable as a t2_so_imm but plain 'imm' is not. For example,
mov r2, #-3
becomes
mvn r2, #2
rdar://10349224
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143235 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMInstrThumb2.td')
-rw-r--r-- | lib/Target/ARM/ARMInstrThumb2.td | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Target/ARM/ARMInstrThumb2.td b/lib/Target/ARM/ARMInstrThumb2.td index 9a48b1860f..d06510744a 100644 --- a/lib/Target/ARM/ARMInstrThumb2.td +++ b/lib/Target/ARM/ARMInstrThumb2.td @@ -76,10 +76,16 @@ def t2_so_imm : Operand<i32>, ImmLeaf<i32, [{ // t2_so_imm_not - Match an immediate that is a complement // of a t2_so_imm. +// Note: this pattern doesn't require an encoder method and such, as it's +// only used on aliases (Pat<> and InstAlias<>). The actual encoding +// is handled by the destination instructions, which use t2_so_imm. +def t2_so_imm_not_asmoperand : AsmOperandClass { let Name = "T2SOImmNot"; } def t2_so_imm_not : Operand<i32>, PatLeaf<(imm), [{ return ARM_AM::getT2SOImmVal(~((uint32_t)N->getZExtValue())) != -1; -}], t2_so_imm_not_XFORM>; +}], t2_so_imm_not_XFORM> { + let ParserMatchClass = t2_so_imm_not_asmoperand; +} // t2_so_imm_neg - Match an immediate that is a negation of a t2_so_imm. def t2_so_imm_neg : Operand<i32>, @@ -4066,3 +4072,9 @@ def : t2InstAlias<"sxtb16${p} $Rd, $Rm$rot", (t2SXTB16 rGPR:$Rd, rGPR:$Rm, rot_imm:$rot, pred:$p)>; def : t2InstAlias<"sxth${p} $Rd, $Rm$rot", (t2SXTH rGPR:$Rd, rGPR:$Rm, rot_imm:$rot, pred:$p)>; + + +// "mov Rd, t2_so_imm_not" can be handled via "mvn" in assembly, just like +// for isel. +def : t2InstAlias<"mov${p} $Rd, $imm", + (t2MVNi rGPR:$Rd, t2_so_imm_not:$imm, pred:$p, zero_reg)>; |