llvm/test/CodeGen/ARM/subtarget-no-movt.ll
Akira Hatanaka 6780493e8d [ARM] Define a subtarget feature that is used to avoid using movt/movw
pairs for 32-bit immediates.

This change is needed to avoid emitting movt/movw pairs when doing LTO
and do so on a per-function basis.

Out-of-tree projects currently using cl::opt option -arm-use-movt=0 or
false to avoid emitting movt/movw pairs should make changes to add
subtarget feature "+no-movt" (see the changes made to clang in r242368).

rdar://problem/21529937

Differential Revision: http://reviews.llvm.org/D11026


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242369 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-16 00:58:23 +00:00

46 lines
1.6 KiB
LLVM

; RUN: llc -march thumb -mcpu=cortex-a8 -relocation-model=static %s -o - | FileCheck -check-prefix=NO-OPTION %s
; RUN: llc -march thumb -mcpu=cortex-a8 -relocation-model=static %s -o - -mattr=-no-movt | FileCheck -check-prefix=USE-MOVT %s
; RUN: llc -march thumb -mcpu=cortex-a8 -relocation-model=static %s -o - -mattr=+no-movt | FileCheck -check-prefix=NO-USE-MOVT %s
; RUN: llc -march thumb -mcpu=cortex-a8 -relocation-model=static %s -o - -O0 | FileCheck -check-prefix=NO-OPTION %s
; RUN: llc -march thumb -mcpu=cortex-a8 -relocation-model=static %s -o - -O0 -mattr=-no-movt | FileCheck -check-prefix=USE-MOVT %s
; RUN: llc -march thumb -mcpu=cortex-a8 -relocation-model=static %s -o - -O0 -mattr=+no-movt | FileCheck -check-prefix=NO-USE-MOVT %s
; NO-OPTION-LABEL: {{_?}}foo0
; NO-OPTION: ldr [[R0:r[0-9]+]], [[L0:.*]]
; NO-OPTION: [[L0]]:
; NO-OPTION: .long 2296237089
; USE-MOVT-LABEL: {{_?}}foo0
; USE-MOVT: movw [[R0:r[0-9]+]], #52257
; USE-MOVT: movt [[R0]], #35037
; NO-USE-MOVT-LABEL: {{_?}}foo0
; NO-USE-MOVT: ldr [[R0:r[0-9]+]], [[L0:.*]]
; NO-USE-MOVT: [[L0]]:
; NO-USE-MOVT: .long 2296237089
define i32 @foo0(i32 %a) #0 {
%1 = xor i32 -1998730207, %a
ret i32 %1
}
; NO-OPTION-LABEL: {{_?}}foo1
; NO-OPTION: movw [[R0:r[0-9]+]], #52257
; NO-OPTION: movt [[R0]], #35037
; USE-MOVT-LABEL: {{_?}}foo1
; USE-MOVT: movw [[R0:r[0-9]+]], #52257
; USE-MOVT: movt [[R0]], #35037
; NO-USE-MOVT-LABEL: {{_?}}foo1
; NO-USE-MOVT: ldr [[R0:r[0-9]+]], [[L0:.*]]
; NO-USE-MOVT: [[L0]]:
; NO-USE-MOVT: .long 2296237089
define i32 @foo1(i32 %a) {
%1 = xor i32 -1998730207, %a
ret i32 %1
}
attributes #0 = { "target-features"="+no-movt" }