Add the first backend support for on demand subtarget creation
[oota-llvm.git] / test / CodeGen / Mips / hfptrcall.ll
1 ; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips16 -relocation-model=pic < %s | FileCheck %s -check-prefix=picel
2
3 @ptrsv = global float ()* @sv, align 4
4 @ptrdv = global double ()* @dv, align 4
5 @ptrscv = global { float, float } ()* @scv, align 4
6 @ptrdcv = global { double, double } ()* @dcv, align 4
7 @x = common global float 0.000000e+00, align 4
8 @.str = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
9 @xd = common global double 0.000000e+00, align 8
10 @xy = common global { float, float } zeroinitializer, align 4
11 @.str1 = private unnamed_addr constant [10 x i8] c"%f + %fi\0A\00", align 1
12 @xyd = common global { double, double } zeroinitializer, align 8
13
14 ; Function Attrs: nounwind
15 define float @sv() #0 {
16 entry:
17   ret float 1.000000e+01
18 }
19 ; picel:        .ent    sv
20 ; picel:        lw      ${{[0-9]+}}, %call16(__mips16_ret_sf)(${{[0-9]+}})
21 ; picel:        .end    sv
22
23 ; Function Attrs: nounwind
24 define double @dv() #0 {
25 entry:
26   ret double 1.500000e+01
27 }
28
29 ; picel:        .ent    dv
30 ; picel:        lw      ${{[0-9]+}}, %call16(__mips16_ret_df)(${{[0-9]+}})
31 ; picel:        .end    dv
32
33 ; Function Attrs: nounwind
34 define { float, float } @scv() #0 {
35 entry:
36   %retval = alloca { float, float }, align 4
37   %real = getelementptr inbounds { float, float }* %retval, i32 0, i32 0
38   %imag = getelementptr inbounds { float, float }* %retval, i32 0, i32 1
39   store float 5.000000e+00, float* %real
40   store float 9.900000e+01, float* %imag
41   %0 = load { float, float }* %retval
42   ret { float, float } %0
43 }
44
45 ; picel:        .ent    scv
46 ; picel:        lw      ${{[0-9]+}}, %call16(__mips16_ret_sc)(${{[0-9]+}})
47 ; picel:        .end    scv
48
49 ; Function Attrs: nounwind
50 define { double, double } @dcv() #0 {
51 entry:
52   %retval = alloca { double, double }, align 8
53   %real = getelementptr inbounds { double, double }* %retval, i32 0, i32 0
54   %imag = getelementptr inbounds { double, double }* %retval, i32 0, i32 1
55   store double 0x416BC8B0A0000000, double* %real
56   store double 0x41CDCCB763800000, double* %imag
57   %0 = load { double, double }* %retval
58   ret { double, double } %0
59 }
60
61 ; picel:        .ent    dcv
62 ; picel:        lw      ${{[0-9]+}}, %call16(__mips16_ret_dc)(${{[0-9]+}})
63 ; picel:        .end    dcv
64
65 ; Function Attrs: nounwind
66 define i32 @main() #0 {
67 entry:
68   %0 = load float ()** @ptrsv, align 4
69   %call = call float %0()
70   store float %call, float* @x, align 4
71   %1 = load float* @x, align 4
72   %conv = fpext float %1 to double
73   %call1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double %conv)
74   %2 = load double ()** @ptrdv, align 4
75   %call2 = call double %2()
76   store double %call2, double* @xd, align 8
77   %3 = load double* @xd, align 8
78   %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double %3)
79   %4 = load { float, float } ()** @ptrscv, align 4
80   %call4 = call { float, float } %4()
81   %5 = extractvalue { float, float } %call4, 0
82   %6 = extractvalue { float, float } %call4, 1
83   store float %5, float* getelementptr inbounds ({ float, float }* @xy, i32 0, i32 0)
84   store float %6, float* getelementptr inbounds ({ float, float }* @xy, i32 0, i32 1)
85   %xy.real = load float* getelementptr inbounds ({ float, float }* @xy, i32 0, i32 0)
86   %xy.imag = load float* getelementptr inbounds ({ float, float }* @xy, i32 0, i32 1)
87   %conv5 = fpext float %xy.real to double
88   %conv6 = fpext float %xy.imag to double
89   %xy.real7 = load float* getelementptr inbounds ({ float, float }* @xy, i32 0, i32 0)
90   %xy.imag8 = load float* getelementptr inbounds ({ float, float }* @xy, i32 0, i32 1)
91   %conv9 = fpext float %xy.real7 to double
92   %conv10 = fpext float %xy.imag8 to double
93   %call11 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), double %conv5, double %conv10)
94   %7 = load { double, double } ()** @ptrdcv, align 4
95   %call12 = call { double, double } %7()
96   %8 = extractvalue { double, double } %call12, 0
97   %9 = extractvalue { double, double } %call12, 1
98   store double %8, double* getelementptr inbounds ({ double, double }* @xyd, i32 0, i32 0)
99   store double %9, double* getelementptr inbounds ({ double, double }* @xyd, i32 0, i32 1)
100   %xyd.real = load double* getelementptr inbounds ({ double, double }* @xyd, i32 0, i32 0)
101   %xyd.imag = load double* getelementptr inbounds ({ double, double }* @xyd, i32 0, i32 1)
102   %xyd.real13 = load double* getelementptr inbounds ({ double, double }* @xyd, i32 0, i32 0)
103   %xyd.imag14 = load double* getelementptr inbounds ({ double, double }* @xyd, i32 0, i32 1)
104   %call15 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), double %xyd.real, double %xyd.imag14)
105   ret i32 0
106 }
107
108 ; picel:        .ent    main
109
110 ; picel:        lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_0)(${{[0-9]+}})
111
112 ; picel:        lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_0)(${{[0-9]+}})
113
114 ; picel:        lw      ${{[0-9]+}}, %got(__mips16_call_stub_sc_0)(${{[0-9]+}})
115
116 ; picel:        lw      ${{[0-9]+}}, %got(__mips16_call_stub_dc_0)(${{[0-9]+}})
117
118
119 declare i32 @printf(i8*, ...) #1
120
121 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
122 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
123
124
125