1# RUN: llc -O0 -mtriple arm-linux -relocation-model=pic -mattr=+no-movt -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,ELF 2# RUN: llc -O0 -mtriple arm-linux -relocation-model=pic -mattr=-no-movt,+v8m -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,ELF 3# RUN: llc -O0 -mtriple arm-darwin -relocation-model=pic -mattr=+no-movt -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,DARWIN-NOMOVT 4# RUN: llc -O0 -mtriple arm-darwin -relocation-model=pic -mattr=-no-movt,+v8m -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,DARWIN-MOVT 5--- | 6 @internal_global = internal global i32 42 7 define void @test_internal_global() { ret void } 8 9 @external_global = external global i32 10 define void @test_external_global() { ret void } 11 12 @internal_constant = internal constant i32 42 13 define void @test_internal_constant() { ret void } 14 15 @external_constant = external constant i32 16 define void @test_external_constant() { ret void } 17... 18--- 19name: test_internal_global 20# CHECK-LABEL: name: test_internal_global 21legalized: true 22regBankSelected: true 23selected: false 24# CHECK: selected: true 25registers: 26 - { id: 0, class: gprb } 27 - { id: 1, class: gprb } 28body: | 29 bb.0: 30 %0(p0) = G_GLOBAL_VALUE @internal_global 31 ; DARWIN-MOVT: [[G:%[0-9]+]]:gpr = MOV_ga_pcrel {{.*}}@internal_global 32 ; DARWIN-NOMOVT: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel {{.*}}@internal_global 33 ; ELF: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel {{.*}}@internal_global 34 35 %1(s32) = G_LOAD %0(p0) :: (load 4 from @internal_global) 36 ; CHECK: [[V:%[0-9]+]]:gpr = LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @internal_global) 37 38 $r0 = COPY %1(s32) 39 ; CHECK: $r0 = COPY [[V]] 40 41 BX_RET 14, $noreg, implicit $r0 42 ; CHECK: BX_RET 14, $noreg, implicit $r0 43... 44--- 45name: test_external_global 46# CHECK-LABEL: name: test_external_global 47legalized: true 48regBankSelected: true 49selected: false 50# CHECK: selected: true 51registers: 52 - { id: 0, class: gprb } 53 - { id: 1, class: gprb } 54body: | 55 bb.0: 56 %0(p0) = G_GLOBAL_VALUE @external_global 57 ; DARWIN-MOVT: [[G:%[0-9]+]]:gpr = MOV_ga_pcrel_ldr {{.*}} @external_global :: (load 4 from got) 58 ; DARWIN-NOMOVT: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel_ldr {{.*}}@external_global :: (load 4 from got) 59 ; ELF: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel_ldr target-flags(arm-got) @external_global :: (load 4 from got) 60 61 %1(s32) = G_LOAD %0(p0) :: (load 4 from @external_global) 62 ; CHECK: [[V:%[0-9]+]]:gpr = LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @external_global) 63 64 $r0 = COPY %1(s32) 65 ; CHECK: $r0 = COPY [[V]] 66 67 BX_RET 14, $noreg, implicit $r0 68 ; CHECK: BX_RET 14, $noreg, implicit $r0 69... 70--- 71name: test_internal_constant 72# CHECK-LABEL: name: test_internal_constant 73legalized: true 74regBankSelected: true 75selected: false 76# CHECK: selected: true 77registers: 78 - { id: 0, class: gprb } 79 - { id: 1, class: gprb } 80body: | 81 bb.0: 82 %0(p0) = G_GLOBAL_VALUE @internal_constant 83 ; DARWIN-MOVT: [[G:%[0-9]+]]:gpr = MOV_ga_pcrel {{.*}}@internal_constant 84 ; DARWIN-NOMOVT: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel {{.*}}@internal_constant 85 ; ELF: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel {{.*}}@internal_constant 86 87 %1(s32) = G_LOAD %0(p0) :: (load 4 from @internal_constant) 88 ; CHECK: [[V:%[0-9]+]]:gpr = LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @internal_constant) 89 90 $r0 = COPY %1(s32) 91 ; CHECK: $r0 = COPY [[V]] 92 93 BX_RET 14, $noreg, implicit $r0 94 ; CHECK: BX_RET 14, $noreg, implicit $r0 95... 96--- 97name: test_external_constant 98# CHECK-LABEL: name: test_external_constant 99legalized: true 100regBankSelected: true 101selected: false 102# CHECK: selected: true 103registers: 104 - { id: 0, class: gprb } 105 - { id: 1, class: gprb } 106body: | 107 bb.0: 108 %0(p0) = G_GLOBAL_VALUE @external_constant 109 ; DARWIN-MOVT: [[G:%[0-9]+]]:gpr = MOV_ga_pcrel_ldr {{.*}} @external_constant :: (load 4 from got) 110 ; DARWIN-NOMOVT: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel_ldr {{.*}}@external_constant :: (load 4 from got) 111 ; ELF: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel_ldr target-flags(arm-got) @external_constant :: (load 4 from got) 112 113 %1(s32) = G_LOAD %0(p0) :: (load 4 from @external_constant) 114 ; CHECK: [[V:%[0-9]+]]:gpr = LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @external_constant) 115 116 $r0 = COPY %1(s32) 117 ; CHECK: $r0 = COPY [[V]] 118 119 BX_RET 14, $noreg, implicit $r0 120 ; CHECK: BX_RET 14, $noreg, implicit $r0 121... 122