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

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

Issue 550723002: Subzero: Use cvttss2si and similar instead of cvtss2si for fp->int casts. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Use truncating conversion instruction for fp to int conversions Created 6 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/IceTargetLoweringX8632.cpp ('k') | tests_lit/llvm2ice_tests/vector-cast.ll » ('j') | 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 operations. 1 ; This tries to be a comprehensive test of f32 and f64 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 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer 6 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer
7 ; doesn't know how to symbolize non-section-local functions. 7 ; doesn't know how to symbolize non-section-local functions.
8 ; The newer LLVM 3.6 one does work, but watch out for other bugs. 8 ; The newer LLVM 3.6 one does work, but watch out for other bugs.
9 9
10 ; RUN: %llvm2ice -O2 --verbose none %s \ 10 ; RUN: %llvm2ice -O2 --verbose none %s \
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 ; CALLTARGETS-LABEL: floatToUnsigned64 264 ; CALLTARGETS-LABEL: floatToUnsigned64
265 ; CHECK: call -4 265 ; CHECK: call -4
266 ; CALLTARGETS: call cvtftoui64 266 ; CALLTARGETS: call cvtftoui64
267 267
268 define internal i32 @doubleToSigned32(double %a) { 268 define internal i32 @doubleToSigned32(double %a) {
269 entry: 269 entry:
270 %conv = fptosi double %a to i32 270 %conv = fptosi double %a to i32
271 ret i32 %conv 271 ret i32 %conv
272 } 272 }
273 ; CHECK-LABEL: doubleToSigned32 273 ; CHECK-LABEL: doubleToSigned32
274 ; CHECK: cvtsd2si 274 ; CHECK: cvttsd2si
275 275
276 define internal i32 @floatToSigned32(float %a) { 276 define internal i32 @floatToSigned32(float %a) {
277 entry: 277 entry:
278 %conv = fptosi float %a to i32 278 %conv = fptosi float %a to i32
279 ret i32 %conv 279 ret i32 %conv
280 } 280 }
281 ; CHECK-LABEL: floatToSigned32 281 ; CHECK-LABEL: floatToSigned32
282 ; CHECK: cvtss2si 282 ; CHECK: cvttss2si
283 283
284 define internal i32 @doubleToUnsigned32(double %a) { 284 define internal i32 @doubleToUnsigned32(double %a) {
285 entry: 285 entry:
286 %conv = fptoui double %a to i32 286 %conv = fptoui double %a to i32
287 ret i32 %conv 287 ret i32 %conv
288 } 288 }
289 ; CHECK-LABEL: doubleToUnsigned32 289 ; CHECK-LABEL: doubleToUnsigned32
290 ; CALLTARGETS-LABEL: doubleToUnsigned32 290 ; CALLTARGETS-LABEL: doubleToUnsigned32
291 ; CHECK: call -4 291 ; CHECK: call -4
292 ; CALLTARGETS: call cvtdtoui32 292 ; CALLTARGETS: call cvtdtoui32
293 293
294 define internal i32 @floatToUnsigned32(float %a) { 294 define internal i32 @floatToUnsigned32(float %a) {
295 entry: 295 entry:
296 %conv = fptoui float %a to i32 296 %conv = fptoui float %a to i32
297 ret i32 %conv 297 ret i32 %conv
298 } 298 }
299 ; CHECK-LABEL: floatToUnsigned32 299 ; CHECK-LABEL: floatToUnsigned32
300 ; CALLTARGETS-LABEL: floatToUnsigned32 300 ; CALLTARGETS-LABEL: floatToUnsigned32
301 ; CHECK: call -4 301 ; CHECK: call -4
302 ; CALLTARGETS: call cvtftoui32 302 ; CALLTARGETS: call cvtftoui32
303 303
304 304
305 define internal i32 @doubleToSigned16(double %a) { 305 define internal i32 @doubleToSigned16(double %a) {
306 entry: 306 entry:
307 %conv = fptosi double %a to i16 307 %conv = fptosi double %a to i16
308 %conv.ret_ext = sext i16 %conv to i32 308 %conv.ret_ext = sext i16 %conv to i32
309 ret i32 %conv.ret_ext 309 ret i32 %conv.ret_ext
310 } 310 }
311 ; CHECK-LABEL: doubleToSigned16 311 ; CHECK-LABEL: doubleToSigned16
312 ; CHECK: cvtsd2si 312 ; CHECK: cvttsd2si
313 ; CHECK: movsx 313 ; CHECK: movsx
314 314
315 define internal i32 @floatToSigned16(float %a) { 315 define internal i32 @floatToSigned16(float %a) {
316 entry: 316 entry:
317 %conv = fptosi float %a to i16 317 %conv = fptosi float %a to i16
318 %conv.ret_ext = sext i16 %conv to i32 318 %conv.ret_ext = sext i16 %conv to i32
319 ret i32 %conv.ret_ext 319 ret i32 %conv.ret_ext
320 } 320 }
321 ; CHECK-LABEL: floatToSigned16 321 ; CHECK-LABEL: floatToSigned16
322 ; CHECK: cvtss2si 322 ; CHECK: cvttss2si
323 ; CHECK: movsx 323 ; CHECK: movsx
324 324
325 define internal i32 @doubleToUnsigned16(double %a) { 325 define internal i32 @doubleToUnsigned16(double %a) {
326 entry: 326 entry:
327 %conv = fptoui double %a to i16 327 %conv = fptoui double %a to i16
328 %conv.ret_ext = zext i16 %conv to i32 328 %conv.ret_ext = zext i16 %conv to i32
329 ret i32 %conv.ret_ext 329 ret i32 %conv.ret_ext
330 } 330 }
331 ; CHECK-LABEL: doubleToUnsigned16 331 ; CHECK-LABEL: doubleToUnsigned16
332 ; CHECK: cvtsd2si 332 ; CHECK: cvttsd2si
333 ; CHECK: movzx 333 ; CHECK: movzx
334 334
335 define internal i32 @floatToUnsigned16(float %a) { 335 define internal i32 @floatToUnsigned16(float %a) {
336 entry: 336 entry:
337 %conv = fptoui float %a to i16 337 %conv = fptoui float %a to i16
338 %conv.ret_ext = zext i16 %conv to i32 338 %conv.ret_ext = zext i16 %conv to i32
339 ret i32 %conv.ret_ext 339 ret i32 %conv.ret_ext
340 } 340 }
341 ; CHECK-LABEL: floatToUnsigned16 341 ; CHECK-LABEL: floatToUnsigned16
342 ; CHECK: cvtss2si 342 ; CHECK: cvttss2si
343 ; CHECK: movzx 343 ; CHECK: movzx
344 344
345 define internal i32 @doubleToSigned8(double %a) { 345 define internal i32 @doubleToSigned8(double %a) {
346 entry: 346 entry:
347 %conv = fptosi double %a to i8 347 %conv = fptosi double %a to i8
348 %conv.ret_ext = sext i8 %conv to i32 348 %conv.ret_ext = sext i8 %conv to i32
349 ret i32 %conv.ret_ext 349 ret i32 %conv.ret_ext
350 } 350 }
351 ; CHECK-LABEL: doubleToSigned8 351 ; CHECK-LABEL: doubleToSigned8
352 ; CHECK: cvtsd2si 352 ; CHECK: cvttsd2si
353 ; CHECK: movsx 353 ; CHECK: movsx
354 354
355 define internal i32 @floatToSigned8(float %a) { 355 define internal i32 @floatToSigned8(float %a) {
356 entry: 356 entry:
357 %conv = fptosi float %a to i8 357 %conv = fptosi float %a to i8
358 %conv.ret_ext = sext i8 %conv to i32 358 %conv.ret_ext = sext i8 %conv to i32
359 ret i32 %conv.ret_ext 359 ret i32 %conv.ret_ext
360 } 360 }
361 ; CHECK-LABEL: floatToSigned8 361 ; CHECK-LABEL: floatToSigned8
362 ; CHECK: cvtss2si 362 ; CHECK: cvttss2si
363 ; CHECK: movsx 363 ; CHECK: movsx
364 364
365 define internal i32 @doubleToUnsigned8(double %a) { 365 define internal i32 @doubleToUnsigned8(double %a) {
366 entry: 366 entry:
367 %conv = fptoui double %a to i8 367 %conv = fptoui double %a to i8
368 %conv.ret_ext = zext i8 %conv to i32 368 %conv.ret_ext = zext i8 %conv to i32
369 ret i32 %conv.ret_ext 369 ret i32 %conv.ret_ext
370 } 370 }
371 ; CHECK-LABEL: doubleToUnsigned8 371 ; CHECK-LABEL: doubleToUnsigned8
372 ; CHECK: cvtsd2si 372 ; CHECK: cvttsd2si
373 ; CHECK: movzx 373 ; CHECK: movzx
374 374
375 define internal i32 @floatToUnsigned8(float %a) { 375 define internal i32 @floatToUnsigned8(float %a) {
376 entry: 376 entry:
377 %conv = fptoui float %a to i8 377 %conv = fptoui float %a to i8
378 %conv.ret_ext = zext i8 %conv to i32 378 %conv.ret_ext = zext i8 %conv to i32
379 ret i32 %conv.ret_ext 379 ret i32 %conv.ret_ext
380 } 380 }
381 ; CHECK-LABEL: floatToUnsigned8 381 ; CHECK-LABEL: floatToUnsigned8
382 ; CHECK: cvtss2si 382 ; CHECK: cvttss2si
383 ; CHECK: movzx 383 ; CHECK: movzx
384 384
385 define internal i32 @doubleToUnsigned1(double %a) { 385 define internal i32 @doubleToUnsigned1(double %a) {
386 entry: 386 entry:
387 %tobool = fptoui double %a to i1 387 %tobool = fptoui double %a to i1
388 %tobool.ret_ext = zext i1 %tobool to i32 388 %tobool.ret_ext = zext i1 %tobool to i32
389 ret i32 %tobool.ret_ext 389 ret i32 %tobool.ret_ext
390 } 390 }
391 ; CHECK-LABEL: doubleToUnsigned1 391 ; CHECK-LABEL: doubleToUnsigned1
392 ; CHECK: cvtsd2si 392 ; CHECK: cvttsd2si
393 ; CHECK: and eax, 1 393 ; CHECK: and eax, 1
394 394
395 define internal i32 @floatToUnsigned1(float %a) { 395 define internal i32 @floatToUnsigned1(float %a) {
396 entry: 396 entry:
397 %tobool = fptoui float %a to i1 397 %tobool = fptoui float %a to i1
398 %tobool.ret_ext = zext i1 %tobool to i32 398 %tobool.ret_ext = zext i1 %tobool to i32
399 ret i32 %tobool.ret_ext 399 ret i32 %tobool.ret_ext
400 } 400 }
401 ; CHECK-LABEL: floatToUnsigned1 401 ; CHECK-LABEL: floatToUnsigned1
402 ; CHECK: cvtss2si 402 ; CHECK: cvttss2si
403 ; CHECK: and eax, 1 403 ; CHECK: and eax, 1
404 404
405 define internal double @signed64ToDouble(i64 %a) { 405 define internal double @signed64ToDouble(i64 %a) {
406 entry: 406 entry:
407 %conv = sitofp i64 %a to double 407 %conv = sitofp i64 %a to double
408 ret double %conv 408 ret double %conv
409 } 409 }
410 ; CHECK-LABEL: signed64ToDouble 410 ; CHECK-LABEL: signed64ToDouble
411 ; CALLTARGETS-LABEL: signed64ToDouble 411 ; CALLTARGETS-LABEL: signed64ToDouble
412 ; CHECK: call -4 412 ; CHECK: call -4
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 %cond = select i1 %cmp, double %a, double %b 1173 %cond = select i1 %cmp, double %a, double %b
1174 ret double %cond 1174 ret double %cond
1175 } 1175 }
1176 ; CHECK-LABEL: selectDoubleVarVar 1176 ; CHECK-LABEL: selectDoubleVarVar
1177 ; CHECK: ucomisd 1177 ; CHECK: ucomisd
1178 ; CHECK: ja {{[0-9]}} 1178 ; CHECK: ja {{[0-9]}}
1179 ; CHECK: fld 1179 ; CHECK: fld
1180 1180
1181 ; ERRORS-NOT: ICE translation error 1181 ; ERRORS-NOT: ICE translation error
1182 ; DUMP-NOT: SZ 1182 ; DUMP-NOT: SZ
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | tests_lit/llvm2ice_tests/vector-cast.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698