1 ; RUN: llc -O0 -mtriple mips-unknown-linux-gnu -relocation-model=static < %s | FileCheck %s -check-prefix=STATIC
2 ; RUN: llc -O0 -mtriple mips-unknown-linux-gnu -relocation-model=static -frame-pointer=all < %s | FileCheck %s -check-prefix=STATIC-FP
3 ; RUN: llc -O0 -mtriple mips-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC
4 ; RUN: llc -O0 -mtriple mips-unknown-linux-gnu -relocation-model=pic -frame-pointer=all < %s | FileCheck %s -check-prefix=PIC-FP
6 ; Generated using clang -O0 -emit-llvm -S -target mipsel-unknown-linux -g test.c -o test.ll
9 ; void hello_world(void) {
10 ; printf("Hello, World!\n");
13 @.str = private unnamed_addr constant [15 x i8] c"Hello, World!\0A\00", align 1
15 define void @hello_world() #0 !dbg !4 {
17 ; STATIC: addiu $sp, $sp, -{{[0-9]+}}
18 ; STATIC: sw $ra, {{[0-9]+}}($sp)
19 ; STATIC: .loc 1 2 3 prologue_end
20 ; STATIC: lui $[[R0:[0-9]+]], %hi($.str)
22 ; STATIC-FP: addiu $sp, $sp, -{{[0-9]+}}
23 ; STATIC-FP: sw $ra, {{[0-9]+}}($sp)
24 ; STATIC-FP: sw $fp, {{[0-9]+}}($sp)
25 ; STATIC-FP: move $fp, $sp
26 ; STATIC-FP: .loc 1 2 3 prologue_end
27 ; STATIC-FP: lui $[[R0:[0-9]+]], %hi($.str)
29 ; PIC: lui $[[R0:[0-9]+]], %hi(_gp_disp)
30 ; PIC: addiu $[[R0]], $[[R0]], %lo(_gp_disp)
31 ; PIC: addiu $sp, $sp, -{{[0-9]+}}
32 ; PIC: sw $ra, {{[0-9]+}}($sp)
33 ; PIC: addu $[[R1:[0-9]+|gp]], $[[R0]], $25
34 ; PIC: .loc 1 2 3 prologue_end
35 ; PIC: lw $[[R2:[0-9]+]], %got($.str)($[[R1]])
37 ; PIC-FP: lui $[[R0:[0-9]+]], %hi(_gp_disp)
38 ; PIC-FP: addiu $[[R0]], $[[R0]], %lo(_gp_disp)
39 ; PIC-FP: addiu $sp, $sp, -{{[0-9]+}}
40 ; PIC-FP: sw $ra, {{[0-9]+}}($sp)
41 ; PIC-FP: sw $fp, {{[0-9]+}}($sp)
42 ; PIC-FP: move $fp, $sp
43 ; PIC-FP: addu $[[R1:[0-9]+|gp]], $[[R0]], $25
44 ; PIC-FP: .loc 1 2 3 prologue_end
45 ; PIC-FP: lw $[[R2:[0-9]+]], %got($.str)($[[R1]])
47 %call = call i32 (ptr, ...) @printf(ptr @.str), !dbg !10
51 declare i32 @printf(ptr, ...)
53 attributes #0 = { nounwind }
56 !llvm.module.flags = !{!7, !8}
59 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
60 !1 = !DIFile(filename: "test.c", directory: "/tmp")
62 !4 = distinct !DISubprogram(name: "hello_world", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
63 !5 = !DISubroutineType(types: !6)
65 !7 = !{i32 2, !"Dwarf Version", i32 4}
66 !8 = !{i32 2, !"Debug Info Version", i32 3}
67 !9 = !{!"clang version 3.8.0"}
68 !10 = !DILocation(line: 2, column: 3, scope: !4)
69 !11 = !DILocation(line: 3, column: 1, scope: !4)