Fix PPCMaterializeInt to check the size of the integer based on the
[oota-llvm.git] / test / CodeGen / PowerPC / fast-isel-ret.ll
1 ; FIXME: FastISel currently returns false if it hits code that uses VSX
2 ; registers and with -fast-isel-abort=1 turned on the test case will then fail.
3 ; When fastisel better supports VSX fix up this test case.
4 ;
5 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx | FileCheck %s --check-prefix=ELF64
6
7 define zeroext i1 @rettrue() nounwind {
8 entry:
9 ; ELF64-LABEL: rettrue
10 ; ELF64: li 3, 1
11 ; ELF64: blr
12   ret i1 true
13 }
14
15 define zeroext i1 @retfalse() nounwind {
16 entry:
17 ; ELF64-LABEL: retfalse
18 ; ELF64: li 3, 0
19 ; ELF64: blr
20   ret i1 false
21 }
22
23 define signext i1 @retstrue() nounwind {
24 entry:
25 ; ELF64-LABEL: retstrue
26 ; ELF64: li 3, -1
27 ; ELF64: blr
28   ret i1 true
29 }
30
31 define signext i1 @retsfalse() nounwind {
32 entry:
33 ; ELF64-LABEL: retsfalse
34 ; ELF64: li 3, 0
35 ; ELF64: blr
36   ret i1 false
37 }
38
39 define signext i8 @ret2(i8 signext %a) nounwind {
40 entry:
41 ; ELF64-LABEL: ret2
42 ; ELF64: extsb
43 ; ELF64: blr
44   ret i8 %a
45 }
46
47 define zeroext i8 @ret3(i8 signext %a) nounwind {
48 entry:
49 ; ELF64-LABEL: ret3
50 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 56
51 ; ELF64: blr
52   ret i8 %a
53 }
54
55 define signext i16 @ret4(i16 signext %a) nounwind {
56 entry:
57 ; ELF64-LABEL: ret4
58 ; ELF64: extsh
59 ; ELF64: blr
60   ret i16 %a
61 }
62
63 define zeroext i16 @ret5(i16 signext %a) nounwind {
64 entry:
65 ; ELF64-LABEL: ret5
66 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 48
67 ; ELF64: blr
68   ret i16 %a
69 }
70
71 define i16 @ret6(i16 %a) nounwind {
72 entry:
73 ; ELF64-LABEL: ret6
74 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 48
75 ; ELF64: blr
76   ret i16 %a
77 }
78
79 define signext i32 @ret7(i32 signext %a) nounwind {
80 entry:
81 ; ELF64-LABEL: ret7
82 ; ELF64: extsw
83 ; ELF64: blr
84   ret i32 %a
85 }
86
87 define zeroext i32 @ret8(i32 signext %a) nounwind {
88 entry:
89 ; ELF64-LABEL: ret8
90 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 32
91 ; ELF64: blr
92   ret i32 %a
93 }
94
95 define i32 @ret9(i32 %a) nounwind {
96 entry:
97 ; ELF64-LABEL: ret9
98 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 32
99 ; ELF64: blr
100   ret i32 %a
101 }
102
103 define i64 @ret10(i64 %a) nounwind {
104 entry:
105 ; ELF64-LABEL: ret10
106 ; ELF64-NOT: exts
107 ; ELF64-NOT: rldicl
108 ; ELF64: blr
109   ret i64 %a
110 }
111
112 define float @ret11(float %a) nounwind {
113 entry:
114 ; ELF64-LABEL: ret11
115 ; ELF64: blr
116   ret float %a
117 }
118
119 define double @ret12(double %a) nounwind {
120 entry:
121 ; ELF64-LABEL: ret12
122 ; ELF64: blr
123   ret double %a
124 }
125
126 define i8 @ret13() nounwind {
127 entry:
128 ; ELF64-LABEL: ret13
129 ; ELF64: li
130 ; ELF64: blr
131   ret i8 15;
132 }
133
134 define i16 @ret14() nounwind {
135 entry:
136 ; ELF64-LABEL: ret14
137 ; ELF64: li
138 ; ELF64: blr
139   ret i16 -225;
140 }
141
142 define i32 @ret15() nounwind {
143 entry:
144 ; ELF64-LABEL: ret15
145 ; ELF64: lis
146 ; ELF64: ori
147 ; ELF64: blr
148   ret i32 278135;
149 }
150
151 define i64 @ret16() nounwind {
152 entry:
153 ; ELF64-LABEL: ret16
154 ; ELF64: li
155 ; ELF64: sldi
156 ; ELF64: oris
157 ; ELF64: ori
158 ; ELF64: blr
159   ret i64 27813515225;
160 }
161
162 define float @ret17() nounwind {
163 entry:
164 ; ELF64-LABEL: ret17
165 ; ELF64: addis
166 ; ELF64: lfs
167 ; ELF64: blr
168   ret float 2.5;
169 }
170
171 define double @ret18() nounwind {
172 entry:
173 ; ELF64-LABEL: ret18
174 ; ELF64: addis
175 ; ELF64: lfd
176 ; ELF64: blr
177   ret double 2.5e-33;
178 }
179
180 define zeroext i32 @ret19() nounwind {
181 entry:
182 ; ELF64-LABEL: ret19
183 ; ELF64: li
184 ; ELF64: oris
185 ; ELF64: ori
186 ; ELF64: blr
187   ret i32 -1
188 }