blob: ed79de920e85ac09dc5054ec861384310fcda4f1 [file] [log] [blame]
Akira Hatanaka43fb2b22012-04-05 20:44:35 +00001; RUN: llc -march=mipsel -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC-O32
2; RUN: llc -march=mipsel -relocation-model=static -mtriple=mipsel-linux-gnu < %s | FileCheck %s -check-prefix=STATIC-O32
Eric Christophera5762812015-01-26 17:33:46 +00003; RUN: llc -march=mips64el -mcpu=mips64r2 -target-abi n32 -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC-N32
4; RUN: llc -march=mips64el -mcpu=mips64r2 -target-abi n32 -relocation-model=static -mtriple=mipsel-linux-gnu < %s | FileCheck %s -check-prefix=STATIC-N32
5; RUN: llc -march=mips64el -mcpu=mips64r2 -target-abi n64 -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC-N64
6; RUN: llc -march=mips64el -mcpu=mips64r2 -target-abi n64 -relocation-model=static < %s | FileCheck %s -check-prefix=STATIC-N64
Akira Hatanaka43fb2b22012-04-05 20:44:35 +00007
8@s1 = internal unnamed_addr global i32 8, align 4
9@g1 = external global i32
10
11define void @foo() nounwind {
12entry:
13; PIC-O32: lw $[[R0:[0-9]+]], %got(s1)
14; PIC-O32: lw ${{[0-9]+}}, %lo(s1)($[[R0]])
15; PIC-O32: lw ${{[0-9]+}}, %got(g1)
16; STATIC-O32: lui $[[R1:[0-9]+]], %hi(s1)
17; STATIC-O32: lw ${{[0-9]+}}, %lo(s1)($[[R1]])
18; STATIC-O32: lui $[[R2:[0-9]+]], %hi(g1)
19; STATIC-O32: lw ${{[0-9]+}}, %lo(g1)($[[R2]])
20
21; PIC-N32: lw $[[R0:[0-9]+]], %got_page(s1)
22; PIC-N32: lw ${{[0-9]+}}, %got_ofst(s1)($[[R0]])
23; PIC-N32: lw ${{[0-9]+}}, %got_disp(g1)
24; STATIC-N32: lui $[[R1:[0-9]+]], %hi(s1)
25; STATIC-N32: lw ${{[0-9]+}}, %lo(s1)($[[R1]])
26; STATIC-N32: lui $[[R2:[0-9]+]], %hi(g1)
27; STATIC-N32: lw ${{[0-9]+}}, %lo(g1)($[[R2]])
28
29; PIC-N64: ld $[[R0:[0-9]+]], %got_page(s1)
30; PIC-N64: lw ${{[0-9]+}}, %got_ofst(s1)($[[R0]])
31; PIC-N64: ld ${{[0-9]+}}, %got_disp(g1)
Simon Dardisca74dd72017-01-27 11:36:52 +000032; STATIC-N64: lui $[[R1:[0-9]+]], %highest(s1)
33; STATIC-N64: daddiu ${{[0-9]+}}, ${{[0-9]+}}, %higher(s1)
34; STATIC-N64: daddiu ${{[0-9]+}}, ${{[0-9]+}}, %hi(s1)
35; STATIC-N64: dsll $[[R2:[0-9]+]], $[[R1]], 16
36; STATIC-N64: lw ${{[0-9]+}}, %lo(s1)($[[R2]])
37; STATIC-N64: lui $[[R3:[0-9]+]], %highest(g1)
38; STATIC-N64: daddiu $[[R3]], $[[R3]], %higher(g1)
39; STATIC-N64: daddiu $[[R3]], $[[R3]], %hi(g1)
40; STATIC-N64: lw ${{[0-9]+}}, %lo(g1)($[[R3]])
Akira Hatanaka43fb2b22012-04-05 20:44:35 +000041
David Blaikiea79ac142015-02-27 21:17:42 +000042 %0 = load i32, i32* @s1, align 4
Akira Hatanaka43fb2b22012-04-05 20:44:35 +000043 tail call void @foo1(i32 %0) nounwind
David Blaikiea79ac142015-02-27 21:17:42 +000044 %1 = load i32, i32* @g1, align 4
Akira Hatanaka43fb2b22012-04-05 20:44:35 +000045 store i32 %1, i32* @s1, align 4
46 %add = add nsw i32 %1, 2
47 store i32 %add, i32* @g1, align 4
48 ret void
49}
50
51declare void @foo1(i32)
52