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