[mips] Test case for r192124.
[oota-llvm.git] / test / CodeGen / Mips / mips16_32_8.ll
1 ; 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
11 define void @foo() #0 {
12 entry:
13   store i32 10, i32* @i, align 4
14   ret void
15 }
16
17 ; 32:   .set    mips16                  # @foo
18 ; 32:   .ent    foo
19 ; 32:   save    {{.+}}
20 ; 32:   restore {{.+}} 
21 ; 32:   .end    foo
22
23 define void @nofoo() #1 {
24 entry:
25   store i32 20, i32* @i, align 4
26   %0 = load float* @x, align 4
27   %1 = load float* @y, align 4
28   %add = fadd float %0, %1
29   store float %add, float* @f, align 4
30   %2 = load float* @f, align 4
31   %conv = fpext float %2 to double
32   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([8 x i8]* @.str, i32 0, i32 0), double %conv)
33   ret void
34 }
35
36 ; 32:   .set    nomips16                  # @nofoo
37 ; 32:   .ent    nofoo
38 ; 32:   .set    noreorder
39 ; 32:   .set    nomacro
40 ; 32:   .set    noat
41 ; 32:   add.s   {{.+}}
42 ; 32:   mfc1    {{.+}}
43 ; 32:   .set    at
44 ; 32:   .set    macro
45 ; 32:   .set    reorder
46 ; 32:   .end    nofoo
47 declare i32 @printf(i8*, ...) #2
48
49 define i32 @main() #3 {
50 entry:
51   call void @foo()
52   %0 = load i32* @i, align 4
53   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([11 x i8]* @.str1, i32 0, i32 0), i32 %0)
54   call void @nofoo()
55   %1 = load i32* @i, align 4
56   %call1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([13 x i8]* @.str2, i32 0, i32 0), i32 %1)
57   ret i32 0
58 }
59
60 ; 32:   .set    nomips16                  # @main
61 ; 32:   .ent    main
62 ; 32:   .set    noreorder
63 ; 32:   .set    nomacro
64 ; 32:   .set    noat
65 ; 32:   jr      $ra
66 ; 32:   .set    at
67 ; 32:   .set    macro
68 ; 32:   .set    reorder
69 ; 32:   .end    main
70
71 attributes #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" }
72 attributes #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" }
73 attributes #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" }
74 attributes #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" }