2015-02-28 02:32:11 +08:00
|
|
|
; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=pic -mtriple=thumbv7-apple-ios | FileCheck %s --check-prefix=THUMB
|
|
|
|
; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=pic -mtriple=arm-apple-ios | FileCheck %s --check-prefix=ARM
|
|
|
|
; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=pic -mtriple=armv7-apple-ios | FileCheck %s --check-prefix=ARMv7
|
|
|
|
; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=pic -mtriple=thumbv7-none-linux-gnueabi | FileCheck %s --check-prefix=THUMB-ELF
|
|
|
|
; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=pic -mtriple=armv7-none-linux-gnueabi | FileCheck %s --check-prefix=ARMv7-ELF
|
2012-08-29 10:41:21 +08:00
|
|
|
|
|
|
|
@g = global i32 0, align 4
|
|
|
|
|
|
|
|
define i32 @LoadGV() {
|
|
|
|
entry:
|
|
|
|
; THUMB: LoadGV
|
|
|
|
; THUMB: movw [[reg0:r[0-9]+]],
|
|
|
|
; THUMB: movt [[reg0]],
|
|
|
|
; THUMB: add [[reg0]], pc
|
2012-09-27 13:21:41 +08:00
|
|
|
; THUMB-ELF: LoadGV
|
2013-07-22 23:49:36 +08:00
|
|
|
; THUMB-ELF: ldr r[[reg0:[0-9]+]],
|
|
|
|
; THUMB-ELF: ldr r[[reg1:[0-9]+]],
|
2013-05-25 11:08:10 +08:00
|
|
|
; THUMB-ELF: ldr r[[reg0]], [r[[reg0]], r[[reg1]]]
|
2012-08-29 10:41:21 +08:00
|
|
|
; ARM: LoadGV
|
|
|
|
; ARM: ldr [[reg1:r[0-9]+]],
|
|
|
|
; ARM: add [[reg1]], pc, [[reg1]]
|
|
|
|
; ARMv7: LoadGV
|
|
|
|
; ARMv7: movw [[reg2:r[0-9]+]],
|
|
|
|
; ARMv7: movt [[reg2]],
|
|
|
|
; ARMv7: add [[reg2]], pc, [[reg2]]
|
2012-09-27 13:21:41 +08:00
|
|
|
; ARMv7-ELF: LoadGV
|
|
|
|
; ARMv7-ELF: ldr r[[reg2:[0-9]+]],
|
2013-08-16 20:52:08 +08:00
|
|
|
; ARMv7-ELF: .LPC
|
|
|
|
; ARMv7-ELF-NEXT: add r[[reg2]], pc
|
2012-09-27 13:21:41 +08:00
|
|
|
; ARMv7-ELF: ldr r[[reg3:[0-9]+]],
|
2013-06-14 10:49:43 +08:00
|
|
|
; ARMv7-ELF: ldr r[[reg2]], [r[[reg3]], r[[reg2]]]
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i32, i32* @g
|
2012-08-29 10:41:21 +08:00
|
|
|
ret i32 %tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
@i = external global i32
|
|
|
|
|
|
|
|
define i32 @LoadIndirectSymbol() {
|
|
|
|
entry:
|
|
|
|
; THUMB: LoadIndirectSymbol
|
|
|
|
; THUMB: movw r[[reg3:[0-9]+]],
|
|
|
|
; THUMB: movt r[[reg3]],
|
|
|
|
; THUMB: add r[[reg3]], pc
|
|
|
|
; THUMB: ldr r[[reg3]], [r[[reg3]]]
|
2012-09-27 13:21:41 +08:00
|
|
|
; THUMB-ELF: LoadIndirectSymbol
|
2013-07-22 23:49:36 +08:00
|
|
|
; THUMB-ELF: ldr r[[reg3:[0-9]+]],
|
|
|
|
; THUMB-ELF: ldr r[[reg4:[0-9]+]],
|
2013-05-25 11:08:10 +08:00
|
|
|
; THUMB-ELF: ldr r[[reg3]], [r[[reg3]], r[[reg4]]]
|
2012-08-29 10:41:21 +08:00
|
|
|
; ARM: LoadIndirectSymbol
|
|
|
|
; ARM: ldr [[reg4:r[0-9]+]],
|
|
|
|
; ARM: ldr [[reg4]], [pc, [[reg4]]]
|
|
|
|
; ARMv7: LoadIndirectSymbol
|
|
|
|
; ARMv7: movw r[[reg5:[0-9]+]],
|
|
|
|
; ARMv7: movt r[[reg5]],
|
|
|
|
; ARMv7: add r[[reg5]], pc, r[[reg5]]
|
|
|
|
; ARMv7: ldr r[[reg5]], [r[[reg5]]]
|
2012-09-27 13:21:41 +08:00
|
|
|
; ARMv7-ELF: LoadIndirectSymbol
|
|
|
|
; ARMv7-ELF: ldr r[[reg5:[0-9]+]],
|
2013-08-16 20:52:08 +08:00
|
|
|
; ARMv7-ELF: .LPC
|
|
|
|
; ARMv7-ELF-NEXT: add r[[reg5]], pc
|
2012-09-27 13:21:41 +08:00
|
|
|
; ARMv7-ELF: ldr r[[reg6:[0-9]+]],
|
2013-06-14 10:49:43 +08:00
|
|
|
; ARMv7-ELF: ldr r[[reg5]], [r[[reg6]], r[[reg5]]]
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i32, i32* @i
|
2012-08-29 10:41:21 +08:00
|
|
|
ret i32 %tmp
|
|
|
|
}
|