• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -O0 -mtriple=mips-img-linux-gnu -mcpu=mips32r6 -relocation-model=pic < %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-PIC
2; RUN: llc -O0 -mtriple=mips-img-linux-gnu -mcpu=mips32r6 -relocation-model=static < %s -o - | FileCheck %s --check-prefixes=CHECK-STATIC
3
4declare i32 @boo(...)
5declare i32 @foo(...)
6
7define i32 @main(i32 signext %argc, i8** %argv) {
8; CHECK: main:
9; CHECK: # %bb.1:
10; CHECK-PIC: addiu
11; CHECK-PIC: sw
12; CHECK-PIC: lui
13; CHECK-PIC: addiu
14; CHECK-PIC: balc
15; CHECK-PIC: addu
16; CHECK-PIC: lw
17; CHECK-PIC: addiu
18; CHECK-PIC: jrc
19; CHECK-PIC: bc
20; CHECK-PIC: bnezc
21; CHECK-PIC: nop
22; CHECK-PIC: bc
23
24; CHECK-STATIC: bc
25; CHECK-STATIC: j
26; CHECK-STATIC: bnezc
27; CHECK-STATIC: nop
28; CHECK-STATIC: j
29entry:
30  %retval = alloca i32, align 4
31  %argc.addr = alloca i32, align 4
32  %argv.addr = alloca i8**, align 4
33  store i32 0, i32* %retval, align 4
34  store i32 %argc, i32* %argc.addr, align 4
35  store i8** %argv, i8*** %argv.addr, align 4
36  %0 = load i32, i32* %argc.addr, align 4
37  %cmp = icmp sgt i32 %0, 1
38  br i1 %cmp, label %if.then, label %if.end4
39
40if.then:
41  call void asm sideeffect ".space 10", "~{$1}"()
42  %1 = load i32, i32* %argc.addr, align 4
43  %cmp1 = icmp sgt i32 %1, 3
44  br i1 %cmp1, label %if.then2, label %if.end
45
46if.then2:
47  call void asm sideeffect ".space 10", "~{$1}"()
48  %call = call i32 bitcast (i32 (...)* @boo to i32 ()*)()
49  store i32 %call, i32* %retval, align 4
50  br label %return
51
52if.end:
53  call void asm sideeffect ".space 4194228", "~{$1}"()
54  %call3 = call i32 bitcast (i32 (...)* @foo to i32 ()*)()
55  store i32 %call3, i32* %retval, align 4
56  br label %return
57
58if.end4:
59  store i32 0, i32* %retval, align 4
60  br label %return
61
62return:
63  %2 = load i32, i32* %retval, align 4
64  ret i32 %2
65
66}
67