File: load-global.ll

package info (click to toggle)
llvm-toolchain-3.7 1%3A3.7.1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 345,556 kB
  • ctags: 362,199
  • sloc: cpp: 2,156,381; ansic: 458,339; objc: 91,547; python: 89,988; asm: 86,305; sh: 21,479; makefile: 6,853; perl: 5,601; ml: 5,458; pascal: 3,933; lisp: 2,429; xml: 686; cs: 239; php: 202; csh: 117
file content (50 lines) | stat: -rw-r--r-- 1,549 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
; RUN: llc < %s -mtriple=armv6-apple-darwin -relocation-model=static | FileCheck %s -check-prefix=STATIC
; RUN: llc < %s -mtriple=armv6-apple-darwin -relocation-model=dynamic-no-pic | FileCheck %s -check-prefix=DYNAMIC
; RUN: llc < %s -mtriple=armv6-apple-darwin -relocation-model=pic | FileCheck %s -check-prefix=PIC
; RUN: llc < %s -mtriple=thumbv6-apple-darwin -relocation-model=pic | FileCheck %s -check-prefix=PIC_T
; RUN: llc < %s -mtriple=armv7-apple-darwin -relocation-model=pic | FileCheck %s -check-prefix=PIC_V7
; RUN: llc < %s -mtriple=armv6-linux-gnueabi -relocation-model=pic | FileCheck %s -check-prefix=LINUX

@G = external global i32

define i32 @test1() {
; STATIC: _test1:
; STATIC: ldr r0, LCPI0_0
; STATIC: ldr r0, [r0]
; STATIC: .long _G

; DYNAMIC: _test1:
; DYNAMIC: ldr r0, LCPI0_0
; DYNAMIC: ldr r0, [r0]
; DYNAMIC: ldr r0, [r0]
; DYNAMIC: .long L_G$non_lazy_ptr

; PIC: _test1
; PIC: ldr r0, LCPI0_0
; PIC: ldr r0, [pc, r0]
; PIC: ldr r0, [r0]
; PIC: .long L_G$non_lazy_ptr-(LPC0_0+8)

; PIC_T: _test1
; PIC_T: ldr r0, LCPI0_0
; PIC_T: add r0, pc
; PIC_T: ldr r0, [r0]
; PIC_T: ldr r0, [r0]
; PIC_T: .long L_G$non_lazy_ptr-(LPC0_0+4)

; PIC_V7: _test1
; PIC_V7: movw r0, :lower16:(L_G$non_lazy_ptr-(LPC0_0+8))
; PIC_V7: movt r0, :upper16:(L_G$non_lazy_ptr-(LPC0_0+8))
; PIC_V7: ldr r0, [pc, r0]
; PIC_V7: ldr r0, [r0]

; LINUX: test1
; LINUX: ldr r0, .LCPI0_0
; LINUX: ldr r1, .LCPI0_1
; LINUX: add r0, pc, r0
; LINUX: ldr r0, [r1, r0]
; LINUX: ldr r0, [r0]
; LINUX: .long G(GOT)
	%tmp = load i32, i32* @G
	ret i32 %tmp
}