Reapply test case in 154038, this time with triple to prevent the backend
[oota-llvm.git] / test / CodeGen / Mips / global-address.ll
1 ; 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
3
4 @s1 = internal unnamed_addr global i32 8, align 4
5 @g1 = external global i32
6
7 define void @foo() nounwind {
8 entry:
9 ; PIC-O32: lw  $[[R0:[0-9]+]], %got(s1)
10 ; PIC-O32: lw  ${{[0-9]+}}, %lo(s1)($[[R0]])
11 ; PIC-O32: lw  ${{[0-9]+}}, %got(g1)
12 ; STATIC-O32: lui $[[R1:[0-9]+]], %hi(s1)
13 ; STATIC-O32: lw  ${{[0-9]+}}, %lo(s1)($[[R1]])
14 ; STATIC-O32: lui $[[R2:[0-9]+]], %hi(g1)
15 ; STATIC-O32: lw  ${{[0-9]+}}, %lo(g1)($[[R2]])
16
17 ; PIC-N32: lw  $[[R0:[0-9]+]], %got_page(s1)
18 ; PIC-N32: lw  ${{[0-9]+}}, %got_ofst(s1)($[[R0]])
19 ; PIC-N32: lw  ${{[0-9]+}}, %got_disp(g1)
20 ; STATIC-N32: lui $[[R1:[0-9]+]], %hi(s1)
21 ; STATIC-N32: lw  ${{[0-9]+}}, %lo(s1)($[[R1]])
22 ; STATIC-N32: lui $[[R2:[0-9]+]], %hi(g1)
23 ; STATIC-N32: lw  ${{[0-9]+}}, %lo(g1)($[[R2]])
24
25 ; PIC-N64: ld  $[[R0:[0-9]+]], %got_page(s1)
26 ; PIC-N64: lw  ${{[0-9]+}}, %got_ofst(s1)($[[R0]])
27 ; PIC-N64: ld  ${{[0-9]+}}, %got_disp(g1)
28 ; STATIC-N64: ld  $[[R1:[0-9]+]], %got_page(s1)
29 ; STATIC-N64: lw  ${{[0-9]+}}, %got_ofst(s1)($[[R1]])
30 ; STATIC-N64: ld  ${{[0-9]+}}, %got_disp(g1)
31
32   %0 = load i32* @s1, align 4
33   tail call void @foo1(i32 %0) nounwind
34   %1 = load i32* @g1, align 4
35   store i32 %1, i32* @s1, align 4
36   %add = add nsw i32 %1, 2
37   store i32 %add, i32* @g1, align 4
38   ret void
39 }
40
41 declare void @foo1(i32)
42