@@ -340,98 +340,73 @@ define float @fold_demote_s_d(float %a, double %b) nounwind {
340
340
define half @fold_demote_h_s (half %a , float %b ) nounwind {
341
341
; RV32I-LABEL: fold_demote_h_s:
342
342
; RV32I: # %bb.0:
343
- ; RV32I-NEXT: addi sp, sp, -16
344
- ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
345
- ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
346
- ; RV32I-NEXT: mv s0, a1
347
- ; RV32I-NEXT: lui a1, 16
348
- ; RV32I-NEXT: addi a1, a1, -1
349
- ; RV32I-NEXT: and a0, a0, a1
350
- ; RV32I-NEXT: call __gnu_h2f_ieee@plt
351
- ; RV32I-NEXT: lui a1, 524288
352
- ; RV32I-NEXT: and a2, s0, a1
353
- ; RV32I-NEXT: addi a1, a1, -1
354
- ; RV32I-NEXT: and a0, a0, a1
355
- ; RV32I-NEXT: or a0, a0, a2
356
- ; RV32I-NEXT: call __gnu_f2h_ieee@plt
357
- ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
358
- ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
359
- ; RV32I-NEXT: addi sp, sp, 16
343
+ ; RV32I-NEXT: lui a2, 8
344
+ ; RV32I-NEXT: addi a2, a2, -1
345
+ ; RV32I-NEXT: and a0, a0, a2
346
+ ; RV32I-NEXT: lui a2, 524288
347
+ ; RV32I-NEXT: and a1, a1, a2
348
+ ; RV32I-NEXT: srli a1, a1, 16
349
+ ; RV32I-NEXT: or a0, a0, a1
360
350
; RV32I-NEXT: ret
361
351
;
362
352
; RV64I-LABEL: fold_demote_h_s:
363
353
; RV64I: # %bb.0:
364
- ; RV64I-NEXT: addi sp, sp, -16
365
- ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
366
- ; RV64I-NEXT: sd s0, 0(sp) # 8-byte Folded Spill
367
- ; RV64I-NEXT: mv s0, a1
368
- ; RV64I-NEXT: lui a1, 16
369
- ; RV64I-NEXT: addiw a1, a1, -1
370
- ; RV64I-NEXT: and a0, a0, a1
371
- ; RV64I-NEXT: call __gnu_h2f_ieee@plt
372
- ; RV64I-NEXT: lui a1, 524288
373
- ; RV64I-NEXT: and a2, s0, a1
374
- ; RV64I-NEXT: addiw a1, a1, -1
375
- ; RV64I-NEXT: and a0, a0, a1
376
- ; RV64I-NEXT: or a0, a0, a2
377
- ; RV64I-NEXT: call __gnu_f2h_ieee@plt
378
- ; RV64I-NEXT: ld s0, 0(sp) # 8-byte Folded Reload
379
- ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
380
- ; RV64I-NEXT: addi sp, sp, 16
354
+ ; RV64I-NEXT: lui a2, 8
355
+ ; RV64I-NEXT: addiw a2, a2, -1
356
+ ; RV64I-NEXT: and a0, a0, a2
357
+ ; RV64I-NEXT: addi a2, zero, 1
358
+ ; RV64I-NEXT: slli a2, a2, 31
359
+ ; RV64I-NEXT: and a1, a1, a2
360
+ ; RV64I-NEXT: srli a1, a1, 16
361
+ ; RV64I-NEXT: or a0, a0, a1
381
362
; RV64I-NEXT: ret
382
363
;
383
364
; RV32IF-LABEL: fold_demote_h_s:
384
365
; RV32IF: # %bb.0:
385
- ; RV32IF-NEXT: addi sp, sp, -16
386
- ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
387
- ; RV32IF-NEXT: fsw fs0, 8(sp) # 4-byte Folded Spill
388
- ; RV32IF-NEXT: fmv.s fs0, fa1
389
- ; RV32IF-NEXT: fmv.x.w a0, fa0
390
- ; RV32IF-NEXT: call __gnu_h2f_ieee@plt
391
- ; RV32IF-NEXT: fsgnj.s fa0, fa0, fs0
392
- ; RV32IF-NEXT: call __gnu_f2h_ieee@plt
366
+ ; RV32IF-NEXT: fmv.x.w a0, fa1
367
+ ; RV32IF-NEXT: fmv.x.w a1, fa0
368
+ ; RV32IF-NEXT: lui a2, 8
369
+ ; RV32IF-NEXT: addi a2, a2, -1
370
+ ; RV32IF-NEXT: and a1, a1, a2
371
+ ; RV32IF-NEXT: lui a2, 524288
372
+ ; RV32IF-NEXT: and a0, a0, a2
373
+ ; RV32IF-NEXT: srli a0, a0, 16
374
+ ; RV32IF-NEXT: or a0, a1, a0
393
375
; RV32IF-NEXT: lui a1, 1048560
394
376
; RV32IF-NEXT: or a0, a0, a1
395
377
; RV32IF-NEXT: fmv.w.x fa0, a0
396
- ; RV32IF-NEXT: flw fs0, 8(sp) # 4-byte Folded Reload
397
- ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
398
- ; RV32IF-NEXT: addi sp, sp, 16
399
378
; RV32IF-NEXT: ret
400
379
;
401
380
; RV32IFD-LABEL: fold_demote_h_s:
402
381
; RV32IFD: # %bb.0:
403
- ; RV32IFD-NEXT: addi sp, sp, -16
404
- ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
405
- ; RV32IFD-NEXT: fsd fs0, 0(sp) # 8-byte Folded Spill
406
- ; RV32IFD-NEXT: fmv.s fs0, fa1
407
- ; RV32IFD-NEXT: fmv.x.w a0, fa0
408
- ; RV32IFD-NEXT: call __gnu_h2f_ieee@plt
409
- ; RV32IFD-NEXT: fsgnj.s fa0, fa0, fs0
410
- ; RV32IFD-NEXT: call __gnu_f2h_ieee@plt
382
+ ; RV32IFD-NEXT: fmv.x.w a0, fa1
383
+ ; RV32IFD-NEXT: fmv.x.w a1, fa0
384
+ ; RV32IFD-NEXT: lui a2, 8
385
+ ; RV32IFD-NEXT: addi a2, a2, -1
386
+ ; RV32IFD-NEXT: and a1, a1, a2
387
+ ; RV32IFD-NEXT: lui a2, 524288
388
+ ; RV32IFD-NEXT: and a0, a0, a2
389
+ ; RV32IFD-NEXT: srli a0, a0, 16
390
+ ; RV32IFD-NEXT: or a0, a1, a0
411
391
; RV32IFD-NEXT: lui a1, 1048560
412
392
; RV32IFD-NEXT: or a0, a0, a1
413
393
; RV32IFD-NEXT: fmv.w.x fa0, a0
414
- ; RV32IFD-NEXT: fld fs0, 0(sp) # 8-byte Folded Reload
415
- ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
416
- ; RV32IFD-NEXT: addi sp, sp, 16
417
394
; RV32IFD-NEXT: ret
418
395
;
419
396
; RV64IFD-LABEL: fold_demote_h_s:
420
397
; RV64IFD: # %bb.0:
421
- ; RV64IFD-NEXT: addi sp, sp, -16
422
- ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
423
- ; RV64IFD-NEXT: fsd fs0, 0(sp) # 8-byte Folded Spill
424
- ; RV64IFD-NEXT: fmv.s fs0, fa1
425
- ; RV64IFD-NEXT: fmv.x.w a0, fa0
426
- ; RV64IFD-NEXT: call __gnu_h2f_ieee@plt
427
- ; RV64IFD-NEXT: fsgnj.s fa0, fa0, fs0
428
- ; RV64IFD-NEXT: call __gnu_f2h_ieee@plt
398
+ ; RV64IFD-NEXT: fmv.x.w a0, fa1
399
+ ; RV64IFD-NEXT: fmv.x.w a1, fa0
400
+ ; RV64IFD-NEXT: lui a2, 8
401
+ ; RV64IFD-NEXT: addiw a2, a2, -1
402
+ ; RV64IFD-NEXT: and a1, a1, a2
403
+ ; RV64IFD-NEXT: lui a2, 524288
404
+ ; RV64IFD-NEXT: and a0, a0, a2
405
+ ; RV64IFD-NEXT: srli a0, a0, 16
406
+ ; RV64IFD-NEXT: or a0, a1, a0
429
407
; RV64IFD-NEXT: lui a1, 1048560
430
408
; RV64IFD-NEXT: or a0, a0, a1
431
409
; RV64IFD-NEXT: fmv.w.x fa0, a0
432
- ; RV64IFD-NEXT: fld fs0, 0(sp) # 8-byte Folded Reload
433
- ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
434
- ; RV64IFD-NEXT: addi sp, sp, 16
435
410
; RV64IFD-NEXT: ret
436
411
;
437
412
; RV32IFZFH-LABEL: fold_demote_h_s:
@@ -459,104 +434,76 @@ define half @fold_demote_h_s(half %a, float %b) nounwind {
459
434
define half @fold_demote_h_d (half %a , double %b ) nounwind {
460
435
; RV32I-LABEL: fold_demote_h_d:
461
436
; RV32I: # %bb.0:
462
- ; RV32I-NEXT: addi sp, sp, -16
463
- ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
464
- ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
465
- ; RV32I-NEXT: mv s0, a2
466
- ; RV32I-NEXT: lui a1, 16
437
+ ; RV32I-NEXT: lui a1, 8
467
438
; RV32I-NEXT: addi a1, a1, -1
468
439
; RV32I-NEXT: and a0, a0, a1
469
- ; RV32I-NEXT: call __gnu_h2f_ieee@plt
470
440
; RV32I-NEXT: lui a1, 524288
471
- ; RV32I-NEXT: and a2, s0, a1
472
- ; RV32I-NEXT: addi a1, a1, -1
473
- ; RV32I-NEXT: and a0, a0, a1
474
- ; RV32I-NEXT: or a0, a0, a2
475
- ; RV32I-NEXT: call __gnu_f2h_ieee@plt
476
- ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
477
- ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
478
- ; RV32I-NEXT: addi sp, sp, 16
441
+ ; RV32I-NEXT: and a1, a2, a1
442
+ ; RV32I-NEXT: srli a1, a1, 16
443
+ ; RV32I-NEXT: or a0, a0, a1
479
444
; RV32I-NEXT: ret
480
445
;
481
446
; RV64I-LABEL: fold_demote_h_d:
482
447
; RV64I: # %bb.0:
483
- ; RV64I-NEXT: addi sp, sp, -16
484
- ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
485
- ; RV64I-NEXT: sd s0, 0(sp) # 8-byte Folded Spill
486
- ; RV64I-NEXT: mv s0, a1
487
- ; RV64I-NEXT: lui a1, 16
488
- ; RV64I-NEXT: addiw a1, a1, -1
489
- ; RV64I-NEXT: and a0, a0, a1
490
- ; RV64I-NEXT: call __gnu_h2f_ieee@plt
491
- ; RV64I-NEXT: lui a1, 524288
492
- ; RV64I-NEXT: addiw a1, a1, -1
493
- ; RV64I-NEXT: and a0, a0, a1
494
- ; RV64I-NEXT: addi a1, zero, -1
495
- ; RV64I-NEXT: slli a1, a1, 63
496
- ; RV64I-NEXT: and a1, s0, a1
497
- ; RV64I-NEXT: srli a1, a1, 32
448
+ ; RV64I-NEXT: lui a2, 8
449
+ ; RV64I-NEXT: addiw a2, a2, -1
450
+ ; RV64I-NEXT: and a0, a0, a2
451
+ ; RV64I-NEXT: addi a2, zero, -1
452
+ ; RV64I-NEXT: slli a2, a2, 63
453
+ ; RV64I-NEXT: and a1, a1, a2
454
+ ; RV64I-NEXT: srli a1, a1, 48
498
455
; RV64I-NEXT: or a0, a0, a1
499
- ; RV64I-NEXT: call __gnu_f2h_ieee@plt
500
- ; RV64I-NEXT: ld s0, 0(sp) # 8-byte Folded Reload
501
- ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
502
- ; RV64I-NEXT: addi sp, sp, 16
503
456
; RV64I-NEXT: ret
504
457
;
505
458
; RV32IF-LABEL: fold_demote_h_d:
506
459
; RV32IF: # %bb.0:
507
- ; RV32IF-NEXT: addi sp, sp, -16
508
- ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
509
- ; RV32IF-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
510
- ; RV32IF-NEXT: mv s0, a1
511
460
; RV32IF-NEXT: fmv.x.w a0, fa0
512
- ; RV32IF-NEXT: call __gnu_h2f_ieee@plt
513
- ; RV32IF-NEXT: fmv.w.x ft0, s0
514
- ; RV32IF-NEXT: fsgnj.s fa0, fa0, ft0
515
- ; RV32IF-NEXT: call __gnu_f2h_ieee@plt
461
+ ; RV32IF-NEXT: lui a2, 8
462
+ ; RV32IF-NEXT: addi a2, a2, -1
463
+ ; RV32IF-NEXT: and a0, a0, a2
464
+ ; RV32IF-NEXT: lui a2, 524288
465
+ ; RV32IF-NEXT: and a1, a1, a2
466
+ ; RV32IF-NEXT: srli a1, a1, 16
467
+ ; RV32IF-NEXT: or a0, a0, a1
516
468
; RV32IF-NEXT: lui a1, 1048560
517
469
; RV32IF-NEXT: or a0, a0, a1
518
470
; RV32IF-NEXT: fmv.w.x fa0, a0
519
- ; RV32IF-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
520
- ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
521
- ; RV32IF-NEXT: addi sp, sp, 16
522
471
; RV32IF-NEXT: ret
523
472
;
524
473
; RV32IFD-LABEL: fold_demote_h_d:
525
474
; RV32IFD: # %bb.0:
526
475
; RV32IFD-NEXT: addi sp, sp, -16
527
- ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
528
- ; RV32IFD-NEXT: fsd fs0, 0(sp) # 8-byte Folded Spill
529
- ; RV32IFD-NEXT: fmv.d fs0, fa1
476
+ ; RV32IFD-NEXT: fsd fa1, 8(sp)
530
477
; RV32IFD-NEXT: fmv.x.w a0, fa0
531
- ; RV32IFD-NEXT: call __gnu_h2f_ieee@plt
532
- ; RV32IFD-NEXT: fcvt.s.d ft0, fs0
533
- ; RV32IFD-NEXT: fsgnj.s fa0, fa0, ft0
534
- ; RV32IFD-NEXT: call __gnu_f2h_ieee@plt
478
+ ; RV32IFD-NEXT: lw a1, 12(sp)
479
+ ; RV32IFD-NEXT: lui a2, 8
480
+ ; RV32IFD-NEXT: addi a2, a2, -1
481
+ ; RV32IFD-NEXT: and a0, a0, a2
482
+ ; RV32IFD-NEXT: lui a2, 524288
483
+ ; RV32IFD-NEXT: and a1, a1, a2
484
+ ; RV32IFD-NEXT: srli a1, a1, 16
485
+ ; RV32IFD-NEXT: or a0, a0, a1
535
486
; RV32IFD-NEXT: lui a1, 1048560
536
487
; RV32IFD-NEXT: or a0, a0, a1
537
488
; RV32IFD-NEXT: fmv.w.x fa0, a0
538
- ; RV32IFD-NEXT: fld fs0, 0(sp) # 8-byte Folded Reload
539
- ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
540
489
; RV32IFD-NEXT: addi sp, sp, 16
541
490
; RV32IFD-NEXT: ret
542
491
;
543
492
; RV64IFD-LABEL: fold_demote_h_d:
544
493
; RV64IFD: # %bb.0:
545
- ; RV64IFD-NEXT: addi sp, sp, -16
546
- ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
547
- ; RV64IFD-NEXT: fsd fs0, 0(sp) # 8-byte Folded Spill
548
- ; RV64IFD-NEXT: fmv.d fs0, fa1
549
- ; RV64IFD-NEXT: fmv.x.w a0, fa0
550
- ; RV64IFD-NEXT: call __gnu_h2f_ieee@plt
551
- ; RV64IFD-NEXT: fcvt.s.d ft0, fs0
552
- ; RV64IFD-NEXT: fsgnj.s fa0, fa0, ft0
553
- ; RV64IFD-NEXT: call __gnu_f2h_ieee@plt
494
+ ; RV64IFD-NEXT: fmv.x.d a0, fa1
495
+ ; RV64IFD-NEXT: fmv.x.w a1, fa0
496
+ ; RV64IFD-NEXT: lui a2, 8
497
+ ; RV64IFD-NEXT: addiw a2, a2, -1
498
+ ; RV64IFD-NEXT: and a1, a1, a2
499
+ ; RV64IFD-NEXT: addi a2, zero, -1
500
+ ; RV64IFD-NEXT: slli a2, a2, 63
501
+ ; RV64IFD-NEXT: and a0, a0, a2
502
+ ; RV64IFD-NEXT: srli a0, a0, 48
503
+ ; RV64IFD-NEXT: or a0, a1, a0
554
504
; RV64IFD-NEXT: lui a1, 1048560
555
505
; RV64IFD-NEXT: or a0, a0, a1
556
506
; RV64IFD-NEXT: fmv.w.x fa0, a0
557
- ; RV64IFD-NEXT: fld fs0, 0(sp) # 8-byte Folded Reload
558
- ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
559
- ; RV64IFD-NEXT: addi sp, sp, 16
560
507
; RV64IFD-NEXT: ret
561
508
;
562
509
; RV32IFZFH-LABEL: fold_demote_h_d:
0 commit comments