diff options
author | Evan Cheng <evan.cheng@apple.com> | 2012-06-23 00:29:06 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2012-06-23 00:29:06 +0000 |
commit | fc47253294047a62b30a2347a0bf421d934fb69c (patch) | |
tree | 7467ad7ae623f8fac5df22bbd2b40edabaca7e6d /test/CodeGen/ARM/sub.ll | |
parent | 512be1f83e3481403c0ce5ce678254388a6fb852 (diff) | |
download | external_llvm-fc47253294047a62b30a2347a0bf421d934fb69c.zip external_llvm-fc47253294047a62b30a2347a0bf421d934fb69c.tar.gz external_llvm-fc47253294047a62b30a2347a0bf421d934fb69c.tar.bz2 |
(sub X, imm) gets canonicalized to (add X, -imm)
There are patterns to handle immediates when they fit in the immediate field.
e.g. %sub = add i32 %x, -123
=> sub r0, r0, #123
Add patterns to catch immediates that do not fit but should be materialized
with a single movw instruction rather than movw + movt pair.
e.g. %sub = add i32 %x, -65535
=> movw r1, #65535
sub r0, r0, r1
rdar://11726136
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159057 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM/sub.ll')
-rw-r--r-- | test/CodeGen/ARM/sub.ll | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/sub.ll b/test/CodeGen/ARM/sub.ll index 06ea703..474043a 100644 --- a/test/CodeGen/ARM/sub.ll +++ b/test/CodeGen/ARM/sub.ll @@ -36,3 +36,15 @@ entry: %sel = select i1 %cmp, i32 1, i32 %sub ret i32 %sel } + +; rdar://11726136 +define i32 @f5(i32 %x) { +entry: +; CHECK: f5 +; CHECK: movw r1, #65535 +; CHECK-NOT: movt +; CHECK-NOT: add +; CHECK: sub r0, r0, r1 + %sub = add i32 %x, -65535 + ret i32 %sub +} |