[FastISel][ARM] Use MOVT/MOVW if the subtarget requests it.
authorJuergen Ributzka <juergen@apple.com>
Wed, 13 Aug 2014 21:42:19 +0000 (21:42 +0000)
committerJuergen Ributzka <juergen@apple.com>
Wed, 13 Aug 2014 21:42:19 +0000 (21:42 +0000)
This change is also in preparation for a future change to make sure that
the constant materialization uses MOVT/MOVW when available and not a load
from the constant pool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215584 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMFastISel.cpp
test/CodeGen/ARM/fast-isel-mvn.ll

index 5d33303ffa1731132fc4bfa5d2a37c1b673a3998..5cb6d9a0a779dd4ada5eb0953b183cb84cecec52 100644 (file)
@@ -546,6 +546,9 @@ unsigned ARMFastISel::ARMMaterializeInt(const Constant *C, MVT VT) {
     }
   }
 
+  if (Subtarget->useMovt(*FuncInfo.MF))
+    return FastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue());
+
   // Load from constant pool.  For now 32-bit only.
   if (VT != MVT::i32)
     return false;
index 0bc9395e2d78ab63a6dd43e1450d96faf0e512f8..9cb56ea9ae13c0d31d241a852501d6d1b1f55678 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios | FileCheck %s --check-prefix=ARM
-; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=armv7-linux-gnueabi | FileCheck %s --check-prefix=ARM
+; RUN: llc -O0 -verify-machineinstrs -fast-isel-abort -relocation-model=dynamic-no-pic -arm-use-movt=false -mtriple=armv7-apple-ios     < %s | FileCheck %s --check-prefix=CHECK --check-prefix=ARM
+; RUN: llc -O0 -verify-machineinstrs -fast-isel-abort -relocation-model=dynamic-no-pic -arm-use-movt=false -mtriple=armv7-linux-gnueabi < %s | FileCheck %s --check-prefix=CHECK --check-prefix=ARM
 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios | FileCheck %s --check-prefix=THUMB
 ; rdar://10412592