summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-08-14 23:29:49 +0000
committerJuergen Ributzka <juergen@apple.com>2014-08-14 23:29:49 +0000
commit81db58e177c842b79de0c44767a8eb8695edf82f (patch)
treed3a6daba1691ca45c2ec82a0561a9562ff80175f
parent7cbd2b9910ccebaf0ba8e397fbb25cfddc990207 (diff)
downloadbcm5719-llvm-81db58e177c842b79de0c44767a8eb8695edf82f.tar.gz
bcm5719-llvm-81db58e177c842b79de0c44767a8eb8695edf82f.zip
[FastISel][ARM] Fall-back to constant pool loads when materializing an i32 constant.
FastEmit_i won't always succeed to materialize an i32 constant and just fail. This would trigger a fall-back to SelectionDAG, which is really not necessary. This fix will first fall-back to a constant pool load to materialize the constant before giving up for good. This fixes <rdar://problem/18022633>. llvm-svn: 215682
-rw-r--r--llvm/lib/Target/ARM/ARMFastISel.cpp3
-rw-r--r--llvm/test/CodeGen/ARM/fast-isel-mvn.ll12
2 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp
index 5cb6d9a0a77..a6c51982bd1 100644
--- a/llvm/lib/Target/ARM/ARMFastISel.cpp
+++ b/llvm/lib/Target/ARM/ARMFastISel.cpp
@@ -547,7 +547,8 @@ unsigned ARMFastISel::ARMMaterializeInt(const Constant *C, MVT VT) {
}
if (Subtarget->useMovt(*FuncInfo.MF))
- return FastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue());
+ if (FastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue()))
+ return true;
// Load from constant pool. For now 32-bit only.
if (VT != MVT::i32)
diff --git a/llvm/test/CodeGen/ARM/fast-isel-mvn.ll b/llvm/test/CodeGen/ARM/fast-isel-mvn.ll
index 9cb56ea9ae1..c9c32880cce 100644
--- a/llvm/test/CodeGen/ARM/fast-isel-mvn.ll
+++ b/llvm/test/CodeGen/ARM/fast-isel-mvn.ll
@@ -106,3 +106,15 @@ entry:
call void @foo(i32 -2130706433)
ret void
}
+
+; Load from constant pool.
+define i32 @t10(i32 %a) {
+; ARM-LABEL: t10
+; ARM: ldr
+; THUMB-LABEL: t10
+; THUMB: movw r1, #52257
+; THUMB-NEXT: movt r1, #35037
+ %1 = xor i32 -1998730207, %a
+ ret i32 %1
+}
+
OpenPOWER on IntegriCloud