blob: 5e03928a11f1a757774ba58f0bb8ad1ba86542d9 [file] [log] [blame]
Reed Kotler1595f362013-04-09 19:46:01 +00001; RUN: llc -march=mipsel -mcpu=mips32 -relocation-model=static -O3 < %s -mips-mixed-16-32 | FileCheck %s -check-prefix=32
2
3@x = global float 1.000000e+00, align 4
4@y = global float 0x4007333340000000, align 4
5@i = common global i32 0, align 4
6@f = common global float 0.000000e+00, align 4
7@.str = private unnamed_addr constant [8 x i8] c"f = %f\0A\00", align 1
8@.str1 = private unnamed_addr constant [11 x i8] c"hello %i \0A\00", align 1
9@.str2 = private unnamed_addr constant [13 x i8] c"goodbye %i \0A\00", align 1
10
11define void @foo() #0 {
12entry:
13 store i32 10, i32* @i, align 4
14 ret void
15}
16
Rafael Espindola6633d572014-01-14 18:57:12 +000017; 32: .set mips16
Reed Kotler1595f362013-04-09 19:46:01 +000018; 32: .ent foo
Reed Kotler5c29d632013-12-15 20:49:30 +000019; 32: jrc $ra
Reed Kotler1595f362013-04-09 19:46:01 +000020; 32: .end foo
21
22define void @nofoo() #1 {
23entry:
24 store i32 20, i32* @i, align 4
David Blaikiea79ac142015-02-27 21:17:42 +000025 %0 = load float, float* @x, align 4
26 %1 = load float, float* @y, align 4
Reed Kotler1595f362013-04-09 19:46:01 +000027 %add = fadd float %0, %1
28 store float %add, float* @f, align 4
David Blaikiea79ac142015-02-27 21:17:42 +000029 %2 = load float, float* @f, align 4
Reed Kotler1595f362013-04-09 19:46:01 +000030 %conv = fpext float %2 to double
David Blaikie23af6482015-04-16 23:24:18 +000031 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), double %conv)
Reed Kotler1595f362013-04-09 19:46:01 +000032 ret void
33}
34
Rafael Espindola6633d572014-01-14 18:57:12 +000035; 32: .set nomips16
Reed Kotler1595f362013-04-09 19:46:01 +000036; 32: .ent nofoo
37; 32: .set noreorder
38; 32: .set nomacro
39; 32: .set noat
40; 32: add.s {{.+}}
41; 32: mfc1 {{.+}}
42; 32: .set at
43; 32: .set macro
44; 32: .set reorder
45; 32: .end nofoo
46declare i32 @printf(i8*, ...) #2
47
48define i32 @main() #3 {
49entry:
50 call void @foo()
David Blaikiea79ac142015-02-27 21:17:42 +000051 %0 = load i32, i32* @i, align 4
David Blaikie23af6482015-04-16 23:24:18 +000052 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str1, i32 0, i32 0), i32 %0)
Reed Kotler1595f362013-04-09 19:46:01 +000053 call void @nofoo()
David Blaikiea79ac142015-02-27 21:17:42 +000054 %1 = load i32, i32* @i, align 4
David Blaikie23af6482015-04-16 23:24:18 +000055 %call1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str2, i32 0, i32 0), i32 %1)
Reed Kotler1595f362013-04-09 19:46:01 +000056 ret i32 0
57}
58
Rafael Espindola6633d572014-01-14 18:57:12 +000059; 32: .set nomips16
Reed Kotler1595f362013-04-09 19:46:01 +000060; 32: .ent main
61; 32: .set noreorder
62; 32: .set nomacro
63; 32: .set noat
64; 32: jr $ra
65; 32: .set at
66; 32: .set macro
67; 32: .set reorder
68; 32: .end main
69
Bill Wendling187d3dd2013-08-22 21:28:54 +000070attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
71attributes #1 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "unsafe-fp-math"="false" "use-soft-float"="false" }
72attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
73attributes #3 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }