Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: tests_lit/llvm2ice_tests/fp.convert.ll

Issue 1330933002: Implements int2fp, fp2int, and fp2fp conversions for ARM32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceTargetLoweringARM32.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; This tries to be a comprehensive test of f32 and f64 convert operations. 1 ; This tries to be a comprehensive test of f32 and f64 convert operations.
2 ; The CHECK lines are only checking for basic instruction patterns 2 ; The CHECK lines are only checking for basic instruction patterns
3 ; that should be present regardless of the optimization level, so 3 ; that should be present regardless of the optimization level, so
4 ; there are no special OPTM1 match lines. 4 ; there are no special OPTM1 match lines.
5 5
6 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s 6 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s
7 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 | FileCheck %s 7 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 | FileCheck %s
8 8
9 ; RUN: %if --need=allow_dump --need=target_ARM32 --command %p2i --filetype=asm \
10 ; RUN: --target arm32 -i %s --args -Om1 --skip-unimplemented \
11 ; RUN: | %if --need=target_ARM32 --command FileCheck %s --check-prefix=ARM32
12
9 define internal float @fptrunc(double %a) { 13 define internal float @fptrunc(double %a) {
10 entry: 14 entry:
11 %conv = fptrunc double %a to float 15 %conv = fptrunc double %a to float
12 ret float %conv 16 ret float %conv
13 } 17 }
14 ; CHECK-LABEL: fptrunc 18 ; CHECK-LABEL: fptrunc
15 ; CHECK: cvtsd2ss 19 ; CHECK: cvtsd2ss
16 ; CHECK: fld 20 ; CHECK: fld
21 ; ARM32-LABEL: fptrunc
22 ; ARM32: vcvt.f32.f64 {{s[0-9]+}}, {{d[0-9]+}}
17 23
18 define internal double @fpext(float %a) { 24 define internal double @fpext(float %a) {
19 entry: 25 entry:
20 %conv = fpext float %a to double 26 %conv = fpext float %a to double
21 ret double %conv 27 ret double %conv
22 } 28 }
23 ; CHECK-LABEL: fpext 29 ; CHECK-LABEL: fpext
24 ; CHECK: cvtss2sd 30 ; CHECK: cvtss2sd
25 ; CHECK: fld 31 ; CHECK: fld
32 ; ARM32-LABEL: fpext
33 ; ARM32: vcvt.f64.f32 {{d[0-9]+}}, {{s[0-9]+}}
26 34
27 define internal i64 @doubleToSigned64(double %a) { 35 define internal i64 @doubleToSigned64(double %a) {
28 entry: 36 entry:
29 %conv = fptosi double %a to i64 37 %conv = fptosi double %a to i64
30 ret i64 %conv 38 ret i64 %conv
31 } 39 }
32 ; CHECK-LABEL: doubleToSigned64 40 ; CHECK-LABEL: doubleToSigned64
33 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptosi_f64_i64 41 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptosi_f64_i64
42 ; ARM32-LABEL: doubleToSigned64
43 ; TODO(jpp): implement this test.
34 44
35 define internal i64 @floatToSigned64(float %a) { 45 define internal i64 @floatToSigned64(float %a) {
36 entry: 46 entry:
37 %conv = fptosi float %a to i64 47 %conv = fptosi float %a to i64
38 ret i64 %conv 48 ret i64 %conv
39 } 49 }
40 ; CHECK-LABEL: floatToSigned64 50 ; CHECK-LABEL: floatToSigned64
41 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptosi_f32_i64 51 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptosi_f32_i64
52 ; ARM32-LABEL: floatToSigned64
53 ; TODO(jpp): implement this test.
42 54
43 define internal i64 @doubleToUnsigned64(double %a) { 55 define internal i64 @doubleToUnsigned64(double %a) {
44 entry: 56 entry:
45 %conv = fptoui double %a to i64 57 %conv = fptoui double %a to i64
46 ret i64 %conv 58 ret i64 %conv
47 } 59 }
48 ; CHECK-LABEL: doubleToUnsigned64 60 ; CHECK-LABEL: doubleToUnsigned64
49 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptoui_f64_i64 61 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptoui_f64_i64
62 ; ARM32-LABEL: doubleToUnsigned64
63 ; TODO(jpp): implement this test.
50 64
51 define internal i64 @floatToUnsigned64(float %a) { 65 define internal i64 @floatToUnsigned64(float %a) {
52 entry: 66 entry:
53 %conv = fptoui float %a to i64 67 %conv = fptoui float %a to i64
54 ret i64 %conv 68 ret i64 %conv
55 } 69 }
56 ; CHECK-LABEL: floatToUnsigned64 70 ; CHECK-LABEL: floatToUnsigned64
57 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptoui_f32_i64 71 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptoui_f32_i64
72 ; ARM32-LABEL: floatToUnsigned64
73 ; TODO(jpp): implement this test.
58 74
59 define internal i32 @doubleToSigned32(double %a) { 75 define internal i32 @doubleToSigned32(double %a) {
60 entry: 76 entry:
61 %conv = fptosi double %a to i32 77 %conv = fptosi double %a to i32
62 ret i32 %conv 78 ret i32 %conv
63 } 79 }
64 ; CHECK-LABEL: doubleToSigned32 80 ; CHECK-LABEL: doubleToSigned32
65 ; CHECK: cvttsd2si 81 ; CHECK: cvttsd2si
82 ; ARM32-LABEL: doubleToSigned32
83 ; ARM32-DAG: vcvt.s32.f64 [[REG:s[0-9]*]], {{d[0-9]*}}
84 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
66 85
67 define internal i32 @doubleToSigned32Const() { 86 define internal i32 @doubleToSigned32Const() {
68 entry: 87 entry:
69 %conv = fptosi double 867.5309 to i32 88 %conv = fptosi double 867.5309 to i32
70 ret i32 %conv 89 ret i32 %conv
71 } 90 }
72 ; CHECK-LABEL: doubleToSigned32Const 91 ; CHECK-LABEL: doubleToSigned32Const
73 ; CHECK: cvttsd2si 92 ; CHECK: cvttsd2si
93 ; ARM32-LABEL: doubleToSigned32Const
94 ; ARM32-DAG: movw [[ADDR:r[0-9]+]], #:lower16:.L$
95 ; ARM32-DAG: movt [[ADDR]], #:upper16:.L$
96 ; ARM32-DAG: vldr [[DREG:d[0-9]+]], {{\[}}[[ADDR]], #0{{\]}}
97 ; ARM32-DAG: vcvt.s32.f64 [[REG:s[0-9]+]], [[DREG]]
98 ; ARM32-DAF: vmov {{r[0-9]+}}, [[REG]]
74 99
75 define internal i32 @floatToSigned32(float %a) { 100 define internal i32 @floatToSigned32(float %a) {
76 entry: 101 entry:
77 %conv = fptosi float %a to i32 102 %conv = fptosi float %a to i32
78 ret i32 %conv 103 ret i32 %conv
79 } 104 }
80 ; CHECK-LABEL: floatToSigned32 105 ; CHECK-LABEL: floatToSigned32
81 ; CHECK: cvttss2si 106 ; CHECK: cvttss2si
107 ; ARM32-LABEL: floatToSigned32
108 ; ARM32-DAG: vcvt.s32.f32 [[REG:s[0-9]+]], {{s[0-9]+}}
109 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
82 110
83 define internal i32 @doubleToUnsigned32(double %a) { 111 define internal i32 @doubleToUnsigned32(double %a) {
84 entry: 112 entry:
85 %conv = fptoui double %a to i32 113 %conv = fptoui double %a to i32
86 ret i32 %conv 114 ret i32 %conv
87 } 115 }
88 ; CHECK-LABEL: doubleToUnsigned32 116 ; CHECK-LABEL: doubleToUnsigned32
89 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptoui_f64_i32 117 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptoui_f64_i32
118 ; ARM32-LABEL: doubleToUnsigned32
119 ; ARM32-DAG: vcvt.u32.f64 [[REG:s[0-9]+]], {{d[0-9]+}}
120 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
90 121
91 define internal i32 @floatToUnsigned32(float %a) { 122 define internal i32 @floatToUnsigned32(float %a) {
92 entry: 123 entry:
93 %conv = fptoui float %a to i32 124 %conv = fptoui float %a to i32
94 ret i32 %conv 125 ret i32 %conv
95 } 126 }
96 ; CHECK-LABEL: floatToUnsigned32 127 ; CHECK-LABEL: floatToUnsigned32
97 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptoui_f32_i32 128 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptoui_f32_i32
129 ; ARM32-LABEL: floatToUnsigned32
130 ; ARM32-DAG: vcvt.u32.f32 [[REG:s[0-9]+]], {{s[0-9]+}}
131 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
98 132
99 define internal i32 @doubleToSigned16(double %a) { 133 define internal i32 @doubleToSigned16(double %a) {
100 entry: 134 entry:
101 %conv = fptosi double %a to i16 135 %conv = fptosi double %a to i16
102 %conv.ret_ext = sext i16 %conv to i32 136 %conv.ret_ext = sext i16 %conv to i32
103 ret i32 %conv.ret_ext 137 ret i32 %conv.ret_ext
104 } 138 }
105 ; CHECK-LABEL: doubleToSigned16 139 ; CHECK-LABEL: doubleToSigned16
106 ; CHECK: cvttsd2si 140 ; CHECK: cvttsd2si
107 ; CHECK: movsx 141 ; CHECK: movsx
142 ; ARM32-LABEL: doubleToSigned16
143 ; ARM32-DAG: vcvt.s32.f64 [[REG:s[0-9]*]], {{d[0-9]*}}
144 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
145 ; ARM32: sxth
108 146
109 define internal i32 @floatToSigned16(float %a) { 147 define internal i32 @floatToSigned16(float %a) {
110 entry: 148 entry:
111 %conv = fptosi float %a to i16 149 %conv = fptosi float %a to i16
112 %conv.ret_ext = sext i16 %conv to i32 150 %conv.ret_ext = sext i16 %conv to i32
113 ret i32 %conv.ret_ext 151 ret i32 %conv.ret_ext
114 } 152 }
115 ; CHECK-LABEL: floatToSigned16 153 ; CHECK-LABEL: floatToSigned16
116 ; CHECK: cvttss2si 154 ; CHECK: cvttss2si
117 ; CHECK: movsx 155 ; CHECK: movsx
156 ; ARM32-LABEL: floatToSigned16
157 ; ARM32-DAG: vcvt.s32.f32 [[REG:s[0-9]*]], {{s[0-9]*}}
158 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
159 ; ARM32: sxth
118 160
119 define internal i32 @doubleToUnsigned16(double %a) { 161 define internal i32 @doubleToUnsigned16(double %a) {
120 entry: 162 entry:
121 %conv = fptoui double %a to i16 163 %conv = fptoui double %a to i16
122 %conv.ret_ext = zext i16 %conv to i32 164 %conv.ret_ext = zext i16 %conv to i32
123 ret i32 %conv.ret_ext 165 ret i32 %conv.ret_ext
124 } 166 }
125 ; CHECK-LABEL: doubleToUnsigned16 167 ; CHECK-LABEL: doubleToUnsigned16
126 ; CHECK: cvttsd2si 168 ; CHECK: cvttsd2si
127 ; CHECK: movzx 169 ; CHECK: movzx
170 ; ARM32-LABEL: doubleToUnsigned16
171 ; ARM32-DAG: vcvt.u32.f64 [[REG:s[0-9]*]], {{d[0-9]*}}
172 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
173 ; ARM32: uxth
128 174
129 define internal i32 @floatToUnsigned16(float %a) { 175 define internal i32 @floatToUnsigned16(float %a) {
130 entry: 176 entry:
131 %conv = fptoui float %a to i16 177 %conv = fptoui float %a to i16
132 %conv.ret_ext = zext i16 %conv to i32 178 %conv.ret_ext = zext i16 %conv to i32
133 ret i32 %conv.ret_ext 179 ret i32 %conv.ret_ext
134 } 180 }
135 ; CHECK-LABEL: floatToUnsigned16 181 ; CHECK-LABEL: floatToUnsigned16
136 ; CHECK: cvttss2si 182 ; CHECK: cvttss2si
137 ; CHECK: movzx 183 ; CHECK: movzx
184 ; ARM32-LABEL: floatToUnsigned16
185 ; ARM32-DAG: vcvt.u32.f32 [[REG:s[0-9]*]], {{s[0-9]*}}
186 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
187 ; ARM32: uxth
138 188
139 define internal i32 @doubleToSigned8(double %a) { 189 define internal i32 @doubleToSigned8(double %a) {
140 entry: 190 entry:
141 %conv = fptosi double %a to i8 191 %conv = fptosi double %a to i8
142 %conv.ret_ext = sext i8 %conv to i32 192 %conv.ret_ext = sext i8 %conv to i32
143 ret i32 %conv.ret_ext 193 ret i32 %conv.ret_ext
144 } 194 }
145 ; CHECK-LABEL: doubleToSigned8 195 ; CHECK-LABEL: doubleToSigned8
146 ; CHECK: cvttsd2si 196 ; CHECK: cvttsd2si
147 ; CHECK: movsx 197 ; CHECK: movsx
198 ; ARM32-LABEL: doubleToSigned8
199 ; ARM32-DAG: vcvt.s32.f64 [[REG:s[0-9]*]], {{d[0-9]*}}
200 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
201 ; ARM32: sxtb
148 202
149 define internal i32 @floatToSigned8(float %a) { 203 define internal i32 @floatToSigned8(float %a) {
150 entry: 204 entry:
151 %conv = fptosi float %a to i8 205 %conv = fptosi float %a to i8
152 %conv.ret_ext = sext i8 %conv to i32 206 %conv.ret_ext = sext i8 %conv to i32
153 ret i32 %conv.ret_ext 207 ret i32 %conv.ret_ext
154 } 208 }
155 ; CHECK-LABEL: floatToSigned8 209 ; CHECK-LABEL: floatToSigned8
156 ; CHECK: cvttss2si 210 ; CHECK: cvttss2si
157 ; CHECK: movsx 211 ; CHECK: movsx
212 ; ARM32-LABEL: floatToSigned8
213 ; ARM32-DAG: vcvt.s32.f32 [[REG:s[0-9]*]], {{s[0-9]*}}
214 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
215 ; ARM32: sxtb
158 216
159 define internal i32 @doubleToUnsigned8(double %a) { 217 define internal i32 @doubleToUnsigned8(double %a) {
160 entry: 218 entry:
161 %conv = fptoui double %a to i8 219 %conv = fptoui double %a to i8
162 %conv.ret_ext = zext i8 %conv to i32 220 %conv.ret_ext = zext i8 %conv to i32
163 ret i32 %conv.ret_ext 221 ret i32 %conv.ret_ext
164 } 222 }
165 ; CHECK-LABEL: doubleToUnsigned8 223 ; CHECK-LABEL: doubleToUnsigned8
166 ; CHECK: cvttsd2si 224 ; CHECK: cvttsd2si
167 ; CHECK: movzx 225 ; CHECK: movzx
226 ; ARM32-LABEL: doubleToUnsigned8
227 ; ARM32-DAG: vcvt.u32.f64 [[REG:s[0-9]*]], {{d[0-9]*}}
228 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
229 ; ARM32: uxtb
168 230
169 define internal i32 @floatToUnsigned8(float %a) { 231 define internal i32 @floatToUnsigned8(float %a) {
170 entry: 232 entry:
171 %conv = fptoui float %a to i8 233 %conv = fptoui float %a to i8
172 %conv.ret_ext = zext i8 %conv to i32 234 %conv.ret_ext = zext i8 %conv to i32
173 ret i32 %conv.ret_ext 235 ret i32 %conv.ret_ext
174 } 236 }
175 ; CHECK-LABEL: floatToUnsigned8 237 ; CHECK-LABEL: floatToUnsigned8
176 ; CHECK: cvttss2si 238 ; CHECK: cvttss2si
177 ; CHECK: movzx 239 ; CHECK: movzx
240 ; ARM32-LABEL: floatToUnsigned8
241 ; ARM32-DAG: vcvt.u32.f32 [[REG:s[0-9]*]], {{s[0-9]*}}
242 ; ARM32-DAG: vmov {{r[0-9]+}}, [[REG]]
243 ; ARM32: uxtb
178 244
179 define internal i32 @doubleToUnsigned1(double %a) { 245 define internal i32 @doubleToUnsigned1(double %a) {
180 entry: 246 entry:
181 %tobool = fptoui double %a to i1 247 %tobool = fptoui double %a to i1
182 %tobool.ret_ext = zext i1 %tobool to i32 248 %tobool.ret_ext = zext i1 %tobool to i32
183 ret i32 %tobool.ret_ext 249 ret i32 %tobool.ret_ext
184 } 250 }
185 ; CHECK-LABEL: doubleToUnsigned1 251 ; CHECK-LABEL: doubleToUnsigned1
186 ; CHECK: cvttsd2si 252 ; CHECK: cvttsd2si
187 ; CHECK: and eax,0x1 253 ; CHECK: and eax,0x1
254 ; ARM32-LABEL: doubleToUnsigned1
255 ; ARM32-DAG: vcvt.u32.f64 [[REG:s[0-9]*]], {{d[0-9]*}}
256 ; ARM32-DAG: vmov [[RES:r[0-9]+]], [[REG]]
257 ; ARM32-DAG: and {{r[0-9]+}}, [[RES]], #1
258 ; ARM32-NOT: uxth
259 ; ARM32-NOT: uxtb
188 260
189 define internal i32 @floatToUnsigned1(float %a) { 261 define internal i32 @floatToUnsigned1(float %a) {
190 entry: 262 entry:
191 %tobool = fptoui float %a to i1 263 %tobool = fptoui float %a to i1
192 %tobool.ret_ext = zext i1 %tobool to i32 264 %tobool.ret_ext = zext i1 %tobool to i32
193 ret i32 %tobool.ret_ext 265 ret i32 %tobool.ret_ext
194 } 266 }
195 ; CHECK-LABEL: floatToUnsigned1 267 ; CHECK-LABEL: floatToUnsigned1
196 ; CHECK: cvttss2si 268 ; CHECK: cvttss2si
197 ; CHECK: and eax,0x1 269 ; CHECK: and eax,0x1
270 ; ARM32-LABEL: floatToUnsigned1
271 ; ARM32-DAG: vcvt.u32.f32 [[REG:s[0-9]*]], {{s[0-9]*}}
272 ; ARM32-DAG: vmov [[RES:r[0-9]+]], [[REG]]
273 ; ARM32-DAG: and {{r[0-9]+}}, [[RES]], #1
274 ; ARM32-NOT: uxth
275 ; ARM32-NOT: uxtb
198 276
199 define internal double @signed64ToDouble(i64 %a) { 277 define internal double @signed64ToDouble(i64 %a) {
200 entry: 278 entry:
201 %conv = sitofp i64 %a to double 279 %conv = sitofp i64 %a to double
202 ret double %conv 280 ret double %conv
203 } 281 }
204 ; CHECK-LABEL: signed64ToDouble 282 ; CHECK-LABEL: signed64ToDouble
205 ; CHECK: call {{.*}} R_{{.*}} __Sz_sitofp_i64_f64 283 ; CHECK: call {{.*}} R_{{.*}} __Sz_sitofp_i64_f64
206 ; CHECK: fstp QWORD 284 ; CHECK: fstp QWORD
285 ; ARM32-LABEL: signed64ToDouble
286 ; TODO(jpp): implement this test.
207 287
208 define internal float @signed64ToFloat(i64 %a) { 288 define internal float @signed64ToFloat(i64 %a) {
209 entry: 289 entry:
210 %conv = sitofp i64 %a to float 290 %conv = sitofp i64 %a to float
211 ret float %conv 291 ret float %conv
212 } 292 }
213 ; CHECK-LABEL: signed64ToFloat 293 ; CHECK-LABEL: signed64ToFloat
214 ; CHECK: call {{.*}} R_{{.*}} __Sz_sitofp_i64_f32 294 ; CHECK: call {{.*}} R_{{.*}} __Sz_sitofp_i64_f32
215 ; CHECK: fstp DWORD 295 ; CHECK: fstp DWORD
296 ; ARM32-LABEL: signed64ToFloat
297 ; TODO(jpp): implement this test.
216 298
217 define internal double @unsigned64ToDouble(i64 %a) { 299 define internal double @unsigned64ToDouble(i64 %a) {
218 entry: 300 entry:
219 %conv = uitofp i64 %a to double 301 %conv = uitofp i64 %a to double
220 ret double %conv 302 ret double %conv
221 } 303 }
222 ; CHECK-LABEL: unsigned64ToDouble 304 ; CHECK-LABEL: unsigned64ToDouble
223 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_i64_f64 305 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_i64_f64
224 ; CHECK: fstp 306 ; CHECK: fstp
307 ; ARM32-LABEL: unsigned64ToDouble
308 ; TODO(jpp): implement this test.
225 309
226 define internal float @unsigned64ToFloat(i64 %a) { 310 define internal float @unsigned64ToFloat(i64 %a) {
227 entry: 311 entry:
228 %conv = uitofp i64 %a to float 312 %conv = uitofp i64 %a to float
229 ret float %conv 313 ret float %conv
230 } 314 }
231 ; CHECK-LABEL: unsigned64ToFloat 315 ; CHECK-LABEL: unsigned64ToFloat
232 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_i64_f32 316 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_i64_f32
233 ; CHECK: fstp 317 ; CHECK: fstp
318 ; ARM32-LABEL: unsigned64ToFloat
319 ; TODO(jpp): implement this test.
234 320
235 define internal double @unsigned64ToDoubleConst() { 321 define internal double @unsigned64ToDoubleConst() {
236 entry: 322 entry:
237 %conv = uitofp i64 12345678901234 to double 323 %conv = uitofp i64 12345678901234 to double
238 ret double %conv 324 ret double %conv
239 } 325 }
240 ; CHECK-LABEL: unsigned64ToDouble 326 ; CHECK-LABEL: unsigned64ToDoubleConst
241 ; CHECK: mov DWORD PTR [esp+0x4],0xb3a 327 ; CHECK: mov DWORD PTR [esp+0x4],0xb3a
242 ; CHECK: mov DWORD PTR [esp],0x73ce2ff2 328 ; CHECK: mov DWORD PTR [esp],0x73ce2ff2
243 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_i64_f64 329 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_i64_f64
244 ; CHECK: fstp 330 ; CHECK: fstp
331 ; ARM32-LABEL: unsigned64ToDoubleConst
332 ; TODO(jpp): implement this test.
245 333
246 define internal double @signed32ToDouble(i32 %a) { 334 define internal double @signed32ToDouble(i32 %a) {
247 entry: 335 entry:
248 %conv = sitofp i32 %a to double 336 %conv = sitofp i32 %a to double
249 ret double %conv 337 ret double %conv
250 } 338 }
251 ; CHECK-LABEL: signed32ToDouble 339 ; CHECK-LABEL: signed32ToDouble
252 ; CHECK: cvtsi2sd 340 ; CHECK: cvtsi2sd
253 ; CHECK: fld 341 ; CHECK: fld
342 ; ARM32-LABEL: signed32ToDouble
343 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], {{r[0-9]+}}
344 ; ARM32-DAG: vcvt.f64.s32 {{d[0-9]+}}, [[SRC]]
254 345
255 define internal double @signed32ToDoubleConst() { 346 define internal double @signed32ToDoubleConst() {
256 entry: 347 entry:
257 %conv = sitofp i32 123 to double 348 %conv = sitofp i32 123 to double
258 ret double %conv 349 ret double %conv
259 } 350 }
260 ; CHECK-LABEL: signed32ToDoubleConst 351 ; CHECK-LABEL: signed32ToDoubleConst
261 ; CHECK: cvtsi2sd {{.*[^1]}} 352 ; CHECK: cvtsi2sd {{.*[^1]}}
262 ; CHECK: fld 353 ; CHECK: fld
354 ; ARM32-LABEL: signed32ToDoubleConst
355 ; ARM32-DAG: movw [[CONST:r[0-9]+]], #123
356 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[CONST]]
357 ; ARM32-DAG: vcvt.f64.s32 {{d[0-9]+}}, [[SRC]]
263 358
264 define internal float @signed32ToFloat(i32 %a) { 359 define internal float @signed32ToFloat(i32 %a) {
265 entry: 360 entry:
266 %conv = sitofp i32 %a to float 361 %conv = sitofp i32 %a to float
267 ret float %conv 362 ret float %conv
268 } 363 }
269 ; CHECK-LABEL: signed32ToFloat 364 ; CHECK-LABEL: signed32ToFloat
270 ; CHECK: cvtsi2ss 365 ; CHECK: cvtsi2ss
271 ; CHECK: fld 366 ; CHECK: fld
367 ; ARM32-LABEL: signed32ToFloat
368 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], {{r[0-9]+}}
369 ; ARM32-DAG: vcvt.f32.s32 {{s[0-9]+}}, [[SRC]]
272 370
273 define internal double @unsigned32ToDouble(i32 %a) { 371 define internal double @unsigned32ToDouble(i32 %a) {
274 entry: 372 entry:
275 %conv = uitofp i32 %a to double 373 %conv = uitofp i32 %a to double
276 ret double %conv 374 ret double %conv
277 } 375 }
278 ; CHECK-LABEL: unsigned32ToDouble 376 ; CHECK-LABEL: unsigned32ToDouble
279 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_i32_f64 377 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_i32_f64
280 ; CHECK: fstp QWORD 378 ; CHECK: fstp QWORD
379 ; ARM32-LABEL: unsigned32ToDouble
380 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], {{r[0-9]+}}
381 ; ARM32-DAG: vcvt.f64.u32 {{d[0-9]+}}, [[SRC]]
281 382
282 define internal float @unsigned32ToFloat(i32 %a) { 383 define internal float @unsigned32ToFloat(i32 %a) {
283 entry: 384 entry:
284 %conv = uitofp i32 %a to float 385 %conv = uitofp i32 %a to float
285 ret float %conv 386 ret float %conv
286 } 387 }
287 ; CHECK-LABEL: unsigned32ToFloat 388 ; CHECK-LABEL: unsigned32ToFloat
288 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_i32_f32 389 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_i32_f32
289 ; CHECK: fstp DWORD 390 ; CHECK: fstp DWORD
391 ; ARM32-LABEL: unsigned32ToFloat
392 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], {{r[0-9]+}}
393 ; ARM32-DAG: vcvt.f32.u32 {{s[0-9]+}}, [[SRC]]
290 394
291 define internal double @signed16ToDouble(i32 %a) { 395 define internal double @signed16ToDouble(i32 %a) {
292 entry: 396 entry:
293 %a.arg_trunc = trunc i32 %a to i16 397 %a.arg_trunc = trunc i32 %a to i16
294 %conv = sitofp i16 %a.arg_trunc to double 398 %conv = sitofp i16 %a.arg_trunc to double
295 ret double %conv 399 ret double %conv
296 } 400 }
297 ; CHECK-LABEL: signed16ToDouble 401 ; CHECK-LABEL: signed16ToDouble
298 ; CHECK: cvtsi2sd 402 ; CHECK: cvtsi2sd
299 ; CHECK: fld QWORD 403 ; CHECK: fld QWORD
404 ; ARM32-LABEL: signed16ToDouble
405 ; ARM32-DAG: sxth [[INT:r[0-9]+]]
406 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
407 ; ARM32-DAG: vcvt.f64.s32 {{d[0-9]+}}, [[SRC]]
300 408
301 define internal float @signed16ToFloat(i32 %a) { 409 define internal float @signed16ToFloat(i32 %a) {
302 entry: 410 entry:
303 %a.arg_trunc = trunc i32 %a to i16 411 %a.arg_trunc = trunc i32 %a to i16
304 %conv = sitofp i16 %a.arg_trunc to float 412 %conv = sitofp i16 %a.arg_trunc to float
305 ret float %conv 413 ret float %conv
306 } 414 }
307 ; CHECK-LABEL: signed16ToFloat 415 ; CHECK-LABEL: signed16ToFloat
308 ; CHECK: cvtsi2ss 416 ; CHECK: cvtsi2ss
309 ; CHECK: fld DWORD 417 ; CHECK: fld DWORD
418 ; ARM32-LABEL: signed16ToFloat
419 ; ARM32-DAG: sxth [[INT:r[0-9]+]]
420 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
421 ; ARM32-DAG: vcvt.f32.s32 {{s[0-9]+}}, [[SRC]]
310 422
311 define internal double @unsigned16ToDouble(i32 %a) { 423 define internal double @unsigned16ToDouble(i32 %a) {
312 entry: 424 entry:
313 %a.arg_trunc = trunc i32 %a to i16 425 %a.arg_trunc = trunc i32 %a to i16
314 %conv = uitofp i16 %a.arg_trunc to double 426 %conv = uitofp i16 %a.arg_trunc to double
315 ret double %conv 427 ret double %conv
316 } 428 }
317 ; CHECK-LABEL: unsigned16ToDouble 429 ; CHECK-LABEL: unsigned16ToDouble
318 ; CHECK: cvtsi2sd 430 ; CHECK: cvtsi2sd
319 ; CHECK: fld 431 ; CHECK: fld
432 ; ARM32-LABEL: unsigned16ToDouble
433 ; ARM32-DAG: uxth [[INT:r[0-9]+]]
434 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
435 ; ARM32-DAG: vcvt.f64.u32 {{d[0-9]+}}, [[SRC]]
320 436
321 define internal double @unsigned16ToDoubleConst() { 437 define internal double @unsigned16ToDoubleConst() {
322 entry: 438 entry:
323 %conv = uitofp i16 12345 to double 439 %conv = uitofp i16 12345 to double
324 ret double %conv 440 ret double %conv
325 } 441 }
326 ; CHECK-LABEL: unsigned16ToDoubleConst 442 ; CHECK-LABEL: unsigned16ToDoubleConst
327 ; CHECK: cvtsi2sd 443 ; CHECK: cvtsi2sd
328 ; CHECK: fld 444 ; CHECK: fld
445 ; ARM32-LABEL: unsigned16ToDoubleConst
446 ; ARM32-DAG: movw [[INT:r[0-9]+]], #12345
447 ; ARM32-DAG: uxth [[INT]]
448 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
449 ; ARM32-DAG: vcvt.f64.u32 {{d[0-9]+}}, [[SRC]]
329 450
330 define internal float @unsigned16ToFloat(i32 %a) { 451 define internal float @unsigned16ToFloat(i32 %a) {
331 entry: 452 entry:
332 %a.arg_trunc = trunc i32 %a to i16 453 %a.arg_trunc = trunc i32 %a to i16
333 %conv = uitofp i16 %a.arg_trunc to float 454 %conv = uitofp i16 %a.arg_trunc to float
334 ret float %conv 455 ret float %conv
335 } 456 }
336 ; CHECK-LABEL: unsigned16ToFloat 457 ; CHECK-LABEL: unsigned16ToFloat
337 ; CHECK: cvtsi2ss 458 ; CHECK: cvtsi2ss
338 ; CHECK: fld 459 ; CHECK: fld
460 ; ARM32-LABEL: unsigned16ToFloat
461 ; ARM32-DAG: uxth [[INT:r[0-9]+]]
462 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
463 ; ARM32-DAG: vcvt.f32.u32 {{s[0-9]+}}, [[SRC]]
339 464
340 define internal double @signed8ToDouble(i32 %a) { 465 define internal double @signed8ToDouble(i32 %a) {
341 entry: 466 entry:
342 %a.arg_trunc = trunc i32 %a to i8 467 %a.arg_trunc = trunc i32 %a to i8
343 %conv = sitofp i8 %a.arg_trunc to double 468 %conv = sitofp i8 %a.arg_trunc to double
344 ret double %conv 469 ret double %conv
345 } 470 }
346 ; CHECK-LABEL: signed8ToDouble 471 ; CHECK-LABEL: signed8ToDouble
347 ; CHECK: cvtsi2sd 472 ; CHECK: cvtsi2sd
348 ; CHECK: fld 473 ; CHECK: fld
474 ; ARM32-LABEL: signed8ToDouble
475 ; ARM32-DAG: sxtb [[INT:r[0-9]+]]
476 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
477 ; ARM32-DAG: vcvt.f64.s32 {{d[0-9]+}}, [[SRC]]
349 478
350 define internal float @signed8ToFloat(i32 %a) { 479 define internal float @signed8ToFloat(i32 %a) {
351 entry: 480 entry:
352 %a.arg_trunc = trunc i32 %a to i8 481 %a.arg_trunc = trunc i32 %a to i8
353 %conv = sitofp i8 %a.arg_trunc to float 482 %conv = sitofp i8 %a.arg_trunc to float
354 ret float %conv 483 ret float %conv
355 } 484 }
356 ; CHECK-LABEL: signed8ToFloat 485 ; CHECK-LABEL: signed8ToFloat
357 ; CHECK: cvtsi2ss 486 ; CHECK: cvtsi2ss
358 ; CHECK: fld 487 ; CHECK: fld
488 ; ARM32-LABEL: signed8ToFloat
489 ; ARM32-DAG: sxtb [[INT:r[0-9]+]]
490 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
491 ; ARM32-DAG: vcvt.f32.s32 {{s[0-9]+}}, [[SRC]]
359 492
360 define internal double @unsigned8ToDouble(i32 %a) { 493 define internal double @unsigned8ToDouble(i32 %a) {
361 entry: 494 entry:
362 %a.arg_trunc = trunc i32 %a to i8 495 %a.arg_trunc = trunc i32 %a to i8
363 %conv = uitofp i8 %a.arg_trunc to double 496 %conv = uitofp i8 %a.arg_trunc to double
364 ret double %conv 497 ret double %conv
365 } 498 }
366 ; CHECK-LABEL: unsigned8ToDouble 499 ; CHECK-LABEL: unsigned8ToDouble
367 ; CHECK: cvtsi2sd 500 ; CHECK: cvtsi2sd
368 ; CHECK: fld 501 ; CHECK: fld
502 ; ARM32-LABEL: unsigned8ToDouble
503 ; ARM32-DAG: uxtb [[INT:r[0-9]+]]
504 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
505 ; ARM32-DAG: vcvt.f64.u32 {{d[0-9]+}}, [[SRC]]
369 506
370 define internal float @unsigned8ToFloat(i32 %a) { 507 define internal float @unsigned8ToFloat(i32 %a) {
371 entry: 508 entry:
372 %a.arg_trunc = trunc i32 %a to i8 509 %a.arg_trunc = trunc i32 %a to i8
373 %conv = uitofp i8 %a.arg_trunc to float 510 %conv = uitofp i8 %a.arg_trunc to float
374 ret float %conv 511 ret float %conv
375 } 512 }
376 ; CHECK-LABEL: unsigned8ToFloat 513 ; CHECK-LABEL: unsigned8ToFloat
377 ; CHECK: cvtsi2ss 514 ; CHECK: cvtsi2ss
378 ; CHECK: fld 515 ; CHECK: fld
516 ; ARM32-LABEL: unsigned8ToFloat
517 ; ARM32-DAG: uxtb [[INT:r[0-9]+]]
518 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
519 ; ARM32-DAG: vcvt.f32.u32 {{s[0-9]+}}, [[SRC]]
379 520
380 define internal double @unsigned1ToDouble(i32 %a) { 521 define internal double @unsigned1ToDouble(i32 %a) {
381 entry: 522 entry:
382 %a.arg_trunc = trunc i32 %a to i1 523 %a.arg_trunc = trunc i32 %a to i1
383 %conv = uitofp i1 %a.arg_trunc to double 524 %conv = uitofp i1 %a.arg_trunc to double
384 ret double %conv 525 ret double %conv
385 } 526 }
386 ; CHECK-LABEL: unsigned1ToDouble 527 ; CHECK-LABEL: unsigned1ToDouble
387 ; CHECK: cvtsi2sd 528 ; CHECK: cvtsi2sd
388 ; CHECK: fld 529 ; CHECK: fld
530 ; ARM32-LABEL: unsigned1ToDouble
531 ; ARM32-DAG: and [[INT:r[0-9]+]], {{r[0-9]+}}, #1
532 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
533 ; ARM32-DAG: vcvt.f64.u32 {{d[0-9]+}}, [[SRC]]
389 534
390 define internal float @unsigned1ToFloat(i32 %a) { 535 define internal float @unsigned1ToFloat(i32 %a) {
391 entry: 536 entry:
392 %a.arg_trunc = trunc i32 %a to i1 537 %a.arg_trunc = trunc i32 %a to i1
393 %conv = uitofp i1 %a.arg_trunc to float 538 %conv = uitofp i1 %a.arg_trunc to float
394 ret float %conv 539 ret float %conv
395 } 540 }
396 ; CHECK-LABEL: unsigned1ToFloat 541 ; CHECK-LABEL: unsigned1ToFloat
397 ; CHECK: cvtsi2ss 542 ; CHECK: cvtsi2ss
398 ; CHECK: fld 543 ; CHECK: fld
544 ; ARM32-LABEL: unsigned1ToFloat
545 ; ARM32-DAG: and [[INT:r[0-9]+]], {{r[0-9]+}}, #1
546 ; ARM32-DAG: vmov [[SRC:s[0-9]+]], [[INT]]
547 ; ARM32-DAG: vcvt.f32.u32 {{s[0-9]+}}, [[SRC]]
399 548
400 define internal float @int32BitcastToFloat(i32 %a) { 549 define internal float @int32BitcastToFloat(i32 %a) {
401 entry: 550 entry:
402 %conv = bitcast i32 %a to float 551 %conv = bitcast i32 %a to float
403 ret float %conv 552 ret float %conv
404 } 553 }
405 ; CHECK-LABEL: int32BitcastToFloat 554 ; CHECK-LABEL: int32BitcastToFloat
406 ; CHECK: mov 555 ; CHECK: mov
556 ; ARM32-LABEL: int32BitcastToFloat
557 ; TODO(jpp): implement this test.
407 558
408 define internal float @int32BitcastToFloatConst() { 559 define internal float @int32BitcastToFloatConst() {
409 entry: 560 entry:
410 %conv = bitcast i32 8675309 to float 561 %conv = bitcast i32 8675309 to float
411 ret float %conv 562 ret float %conv
412 } 563 }
413 ; CHECK-LABEL: int32BitcastToFloatConst 564 ; CHECK-LABEL: int32BitcastToFloatConst
414 ; CHECK: mov 565 ; CHECK: mov
566 ; ARM32-LABEL: int32BitcastToFloatConst
567 ; TODO(jpp): implement this test.
415 568
416 define internal double @int64BitcastToDouble(i64 %a) { 569 define internal double @int64BitcastToDouble(i64 %a) {
417 entry: 570 entry:
418 %conv = bitcast i64 %a to double 571 %conv = bitcast i64 %a to double
419 ret double %conv 572 ret double %conv
420 } 573 }
421 ; CHECK-LABEL: int64BitcastToDouble 574 ; CHECK-LABEL: int64BitcastToDouble
422 ; CHECK: mov 575 ; CHECK: mov
576 ; ARM32-LABEL: int64BitcastToDouble
577 ; TODO(jpp): implement this test.
423 578
424 define internal double @int64BitcastToDoubleConst() { 579 define internal double @int64BitcastToDoubleConst() {
425 entry: 580 entry:
426 %conv = bitcast i64 9035768 to double 581 %conv = bitcast i64 9035768 to double
427 ret double %conv 582 ret double %conv
428 } 583 }
429 ; CHECK-LABEL: int64BitcastToDoubleConst 584 ; CHECK-LABEL: int64BitcastToDoubleConst
430 ; CHECK: mov 585 ; CHECK: mov
586 ; ARM32-LABEL: int64BitcastToDoubleConst
587 ; TODO(jpp): implement this test.
588
OLDNEW
« no previous file with comments | « src/IceTargetLoweringARM32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698