File: global-address.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (57 lines) | stat: -rw-r--r-- 2,354 bytes parent folder | download | duplicates (4)
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
51
52
53
54
55
56
57
; RUN: llc -mtriple=mipsel \
; RUN:     -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC-O32
; RUN: llc -mtriple=mipsel-linux-gnu \
; RUN:     -relocation-model=static < %s | FileCheck %s -check-prefix=STATIC-O32
; RUN: llc -mtriple=mips64el -mcpu=mips64r2 -target-abi n32 \
; RUN:     -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC-N32
; RUN: llc -mtriple=mips64el -mcpu=mips64r2 -target-abi n32 \
; RUN:     -relocation-model=static < %s | FileCheck %s -check-prefix=STATIC-N32
; RUN: llc -mtriple=mips64el -mcpu=mips64r2 -target-abi n64 \
; RUN:     -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC-N64
; RUN: llc -mtriple=mips64el -mcpu=mips64r2 -target-abi n64 \
; RUN:     -relocation-model=static < %s | FileCheck %s -check-prefix=STATIC-N64

@s1 = internal unnamed_addr global i32 8, align 4
@g1 = external global i32

define void @foo() nounwind {
entry:
; PIC-O32: lw  $[[R0:[0-9]+]], %got(s1)
; PIC-O32: lw  ${{[0-9]+}}, %lo(s1)($[[R0]])
; PIC-O32: lw  ${{[0-9]+}}, %got(g1)
; STATIC-O32: lui $[[R1:[0-9]+]], %hi(s1)
; STATIC-O32: lw  ${{[0-9]+}}, %lo(s1)($[[R1]])
; STATIC-O32: lui $[[R2:[0-9]+]], %hi(g1)
; STATIC-O32: lw  ${{[0-9]+}}, %lo(g1)($[[R2]])

; PIC-N32: lw  $[[R0:[0-9]+]], %got_page(s1)
; PIC-N32: lw  ${{[0-9]+}}, %got_ofst(s1)($[[R0]])
; PIC-N32: lw  ${{[0-9]+}}, %got_disp(g1)
; STATIC-N32: lui $[[R1:[0-9]+]], %hi(s1)
; STATIC-N32: lw  ${{[0-9]+}}, %lo(s1)($[[R1]])
; STATIC-N32: lui $[[R2:[0-9]+]], %hi(g1)
; STATIC-N32: lw  ${{[0-9]+}}, %lo(g1)($[[R2]])

; PIC-N64: ld  $[[R0:[0-9]+]], %got_page(s1)
; PIC-N64: lw  ${{[0-9]+}}, %got_ofst(s1)($[[R0]])
; PIC-N64: ld  ${{[0-9]+}}, %got_disp(g1)
; STATIC-N64: lui $[[R1:[0-9]+]], %highest(s1)
; STATIC-N64: daddiu ${{[0-9]+}}, ${{[0-9]+}}, %higher(s1)
; STATIC-N64: daddiu ${{[0-9]+}}, ${{[0-9]+}}, %hi(s1)
; STATIC-N64: dsll $[[R2:[0-9]+]], $[[R1]], 16
; STATIC-N64: lw  ${{[0-9]+}}, %lo(s1)($[[R2]])
; STATIC-N64: lui $[[R3:[0-9]+]], %highest(g1)
; STATIC-N64: daddiu $[[R3]], $[[R3]], %higher(g1)
; STATIC-N64: daddiu $[[R3]], $[[R3]], %hi(g1)
; STATIC-N64: lw  ${{[0-9]+}}, %lo(g1)($[[R3]])

  %0 = load i32, i32* @s1, align 4
  tail call void @foo1(i32 %0) nounwind
  %1 = load i32, i32* @g1, align 4
  store i32 %1, i32* @s1, align 4
  %add = add nsw i32 %1, 2
  store i32 %add, i32* @g1, align 4
  ret void
}

declare void @foo1(i32)