@@ -142,8 +142,8 @@ foreach Ext = ZfhminExts in {
142
142
Ext.F32Ty, "fcvt.h.s">,
143
143
Sched<[WriteFCvtF32ToF16, ReadFCvtF32ToF16]>;
144
144
145
- defm FCVT_S_H : FPUnaryOp_r_m <0b0100000, 0b00010, 0b000, Ext, Ext.F32Ty,
146
- Ext.PrimaryTy, "fcvt.s.h">,
145
+ defm FCVT_S_H : FPUnaryOp_r_frmlegacy_m <0b0100000, 0b00010,Ext, Ext.F32Ty,
146
+ Ext.PrimaryTy, "fcvt.s.h">,
147
147
Sched<[WriteFCvtF16ToF32, ReadFCvtF16ToF32]>;
148
148
} // foreach Ext = ZfhminExts
149
149
@@ -191,8 +191,8 @@ foreach Ext = ZfhminDExts in {
191
191
Ext.F64Ty, "fcvt.h.d">,
192
192
Sched<[WriteFCvtF64ToF16, ReadFCvtF64ToF16]>;
193
193
194
- defm FCVT_D_H : FPUnaryOp_r_m <0b0100001, 0b00010, 0b000 , Ext, Ext.F64Ty,
195
- Ext.F16Ty, "fcvt.d.h">,
194
+ defm FCVT_D_H : FPUnaryOp_r_frmlegacy_m <0b0100001, 0b00010, Ext, Ext.F64Ty,
195
+ Ext.F16Ty, "fcvt.d.h">,
196
196
Sched<[WriteFCvtF16ToF64, ReadFCvtF16ToF64]>;
197
197
} // foreach Ext = ZfhminDExts
198
198
@@ -439,29 +439,29 @@ let Predicates = [HasStdExtZfhOrZfhmin] in {
439
439
440
440
// f32 -> f16, f16 -> f32
441
441
def : Pat<(f16 (any_fpround FPR32:$rs1)), (FCVT_H_S FPR32:$rs1, FRM_DYN)>;
442
- def : Pat<(any_fpextend (f16 FPR16:$rs1)), (FCVT_S_H FPR16:$rs1)>;
442
+ def : Pat<(any_fpextend (f16 FPR16:$rs1)), (FCVT_S_H FPR16:$rs1, FRM_RNE )>;
443
443
444
444
// Moves (no conversion)
445
445
def : Pat<(f16 (riscv_fmv_h_x GPR:$src)), (FMV_H_X GPR:$src)>;
446
446
def : Pat<(riscv_fmv_x_anyexth (f16 FPR16:$src)), (FMV_X_H FPR16:$src)>;
447
447
def : Pat<(riscv_fmv_x_signexth (f16 FPR16:$src)), (FMV_X_H FPR16:$src)>;
448
448
449
- def : Pat<(fcopysign FPR32:$rs1, (f16 FPR16:$rs2)), (FSGNJ_S $rs1, (FCVT_S_H $rs2))>;
449
+ def : Pat<(fcopysign FPR32:$rs1, (f16 FPR16:$rs2)), (FSGNJ_S $rs1, (FCVT_S_H $rs2, FRM_RNE ))>;
450
450
} // Predicates = [HasStdExtZfhOrZfhmin]
451
451
452
452
let Predicates = [HasStdExtZhinxOrZhinxmin] in {
453
453
/// Float conversion operations
454
454
455
455
// f32 -> f16, f16 -> f32
456
456
def : Pat<(any_fpround FPR32INX:$rs1), (FCVT_H_S_INX FPR32INX:$rs1, FRM_DYN)>;
457
- def : Pat<(any_fpextend FPR16INX:$rs1), (FCVT_S_H_INX FPR16INX:$rs1)>;
457
+ def : Pat<(any_fpextend FPR16INX:$rs1), (FCVT_S_H_INX FPR16INX:$rs1, FRM_RNE )>;
458
458
459
459
// Moves (no conversion)
460
460
def : Pat<(f16 (riscv_fmv_h_x GPR:$src)), (COPY_TO_REGCLASS GPR:$src, GPR)>;
461
461
def : Pat<(riscv_fmv_x_anyexth FPR16INX:$src), (COPY_TO_REGCLASS FPR16INX:$src, GPR)>;
462
462
def : Pat<(riscv_fmv_x_signexth FPR16INX:$src), (COPY_TO_REGCLASS FPR16INX:$src, GPR)>;
463
463
464
- def : Pat<(fcopysign FPR32INX:$rs1, FPR16INX:$rs2), (FSGNJ_S_INX $rs1, (FCVT_S_H_INX $rs2))>;
464
+ def : Pat<(fcopysign FPR32INX:$rs1, FPR16INX:$rs2), (FSGNJ_S_INX $rs1, (FCVT_S_H_INX $rs2, FRM_RNE ))>;
465
465
} // Predicates = [HasStdExtZhinxOrZhinxmin]
466
466
467
467
let Predicates = [HasStdExtZfh, IsRV32] in {
@@ -568,48 +568,48 @@ let Predicates = [HasStdExtZfhOrZfhmin, HasStdExtD] in {
568
568
/// Float conversion operations
569
569
// f64 -> f16, f16 -> f64
570
570
def : Pat<(f16 (any_fpround FPR64:$rs1)), (FCVT_H_D FPR64:$rs1, FRM_DYN)>;
571
- def : Pat<(any_fpextend (f16 FPR16:$rs1)), (FCVT_D_H FPR16:$rs1)>;
571
+ def : Pat<(any_fpextend (f16 FPR16:$rs1)), (FCVT_D_H FPR16:$rs1, FRM_RNE )>;
572
572
573
573
/// Float arithmetic operations
574
574
def : Pat<(f16 (fcopysign FPR16:$rs1, FPR64:$rs2)),
575
575
(FSGNJ_H $rs1, (FCVT_H_D $rs2, FRM_DYN))>;
576
- def : Pat<(fcopysign FPR64:$rs1, (f16 FPR16:$rs2)), (FSGNJ_D $rs1, (FCVT_D_H $rs2))>;
576
+ def : Pat<(fcopysign FPR64:$rs1, (f16 FPR16:$rs2)), (FSGNJ_D $rs1, (FCVT_D_H $rs2, FRM_RNE ))>;
577
577
} // Predicates = [HasStdExtZfhOrZfhmin, HasStdExtD]
578
578
579
579
let Predicates = [HasStdExtZhinxOrZhinxmin, HasStdExtZdinx, IsRV32] in {
580
580
/// Float conversion operations
581
581
// f64 -> f16, f16 -> f64
582
582
def : Pat<(any_fpround FPR64IN32X:$rs1), (FCVT_H_D_IN32X FPR64IN32X:$rs1, FRM_DYN)>;
583
- def : Pat<(any_fpextend FPR16INX:$rs1), (FCVT_D_H_IN32X FPR16INX:$rs1)>;
583
+ def : Pat<(any_fpextend FPR16INX:$rs1), (FCVT_D_H_IN32X FPR16INX:$rs1, FRM_RNE )>;
584
584
585
585
/// Float arithmetic operations
586
586
def : Pat<(fcopysign FPR16INX:$rs1, FPR64IN32X:$rs2),
587
587
(FSGNJ_H_INX $rs1, (FCVT_H_D_IN32X $rs2, 0b111))>;
588
- def : Pat<(fcopysign FPR64IN32X:$rs1, FPR16INX:$rs2), (FSGNJ_D_IN32X $rs1, (FCVT_D_H_IN32X $rs2))>;
588
+ def : Pat<(fcopysign FPR64IN32X:$rs1, FPR16INX:$rs2), (FSGNJ_D_IN32X $rs1, (FCVT_D_H_IN32X $rs2, FRM_RNE ))>;
589
589
} // Predicates = [HasStdExtZhinxOrZhinxmin, HasStdExtZdinx, IsRV32]
590
590
591
591
let Predicates = [HasStdExtZhinxOrZhinxmin, HasStdExtZdinx, IsRV64] in {
592
592
/// Float conversion operations
593
593
// f64 -> f16, f16 -> f64
594
594
def : Pat<(any_fpround FPR64INX:$rs1), (FCVT_H_D_INX FPR64INX:$rs1, FRM_DYN)>;
595
- def : Pat<(any_fpextend FPR16INX:$rs1), (FCVT_D_H_INX FPR16INX:$rs1)>;
595
+ def : Pat<(any_fpextend FPR16INX:$rs1), (FCVT_D_H_INX FPR16INX:$rs1, FRM_RNE )>;
596
596
597
597
/// Float arithmetic operations
598
598
def : Pat<(fcopysign FPR16INX:$rs1, FPR64INX:$rs2),
599
599
(FSGNJ_H_INX $rs1, (FCVT_H_D_INX $rs2, 0b111))>;
600
- def : Pat<(fcopysign FPR64INX:$rs1, FPR16INX:$rs2), (FSGNJ_D_INX $rs1, (FCVT_D_H_INX $rs2))>;
600
+ def : Pat<(fcopysign FPR64INX:$rs1, FPR16INX:$rs2), (FSGNJ_D_INX $rs1, (FCVT_D_H_INX $rs2, FRM_RNE ))>;
601
601
} // Predicates = [HasStdExtZhinxOrZhinxmin, HasStdExtZdinx, IsRV64]
602
602
603
603
let Predicates = [HasStdExtZfhmin, NoStdExtZfh, IsRV32] in {
604
604
// half->[u]int. Round-to-zero must be used.
605
- def : Pat<(i32 (any_fp_to_sint (f16 FPR16:$rs1))), (FCVT_W_S (FCVT_S_H $rs1), FRM_RTZ)>;
606
- def : Pat<(i32 (any_fp_to_uint (f16 FPR16:$rs1))), (FCVT_WU_S (FCVT_S_H $rs1), FRM_RTZ)>;
605
+ def : Pat<(i32 (any_fp_to_sint (f16 FPR16:$rs1))), (FCVT_W_S (FCVT_S_H $rs1, FRM_RNE ), FRM_RTZ)>;
606
+ def : Pat<(i32 (any_fp_to_uint (f16 FPR16:$rs1))), (FCVT_WU_S (FCVT_S_H $rs1, FRM_RNE ), FRM_RTZ)>;
607
607
608
608
// half->int32 with current rounding mode.
609
- def : Pat<(i32 (any_lrint (f16 FPR16:$rs1))), (FCVT_W_S (FCVT_S_H $rs1), FRM_DYN)>;
609
+ def : Pat<(i32 (any_lrint (f16 FPR16:$rs1))), (FCVT_W_S (FCVT_S_H $rs1, FRM_RNE ), FRM_DYN)>;
610
610
611
611
// half->int32 rounded to nearest with ties rounded away from zero.
612
- def : Pat<(i32 (any_lround (f16 FPR16:$rs1))), (FCVT_W_S (FCVT_S_H $rs1), FRM_RMM)>;
612
+ def : Pat<(i32 (any_lround (f16 FPR16:$rs1))), (FCVT_W_S (FCVT_S_H $rs1, FRM_RNE ), FRM_RMM)>;
613
613
614
614
// [u]int->half. Match GCC and default to using dynamic rounding mode.
615
615
def : Pat<(f16 (any_sint_to_fp (i32 GPR:$rs1))), (FCVT_H_S (FCVT_S_W $rs1, FRM_DYN), FRM_DYN)>;
@@ -618,14 +618,14 @@ def : Pat<(f16 (any_uint_to_fp (i32 GPR:$rs1))), (FCVT_H_S (FCVT_S_WU $rs1, FRM_
618
618
619
619
let Predicates = [HasStdExtZhinxmin, NoStdExtZhinx, IsRV32] in {
620
620
// half->[u]int. Round-to-zero must be used.
621
- def : Pat<(i32 (any_fp_to_sint FPR16INX:$rs1)), (FCVT_W_S_INX (FCVT_S_H_INX $rs1), FRM_RTZ)>;
622
- def : Pat<(i32 (any_fp_to_uint FPR16INX:$rs1)), (FCVT_WU_S_INX (FCVT_S_H_INX $rs1), FRM_RTZ)>;
621
+ def : Pat<(i32 (any_fp_to_sint FPR16INX:$rs1)), (FCVT_W_S_INX (FCVT_S_H_INX $rs1, FRM_RNE ), FRM_RTZ)>;
622
+ def : Pat<(i32 (any_fp_to_uint FPR16INX:$rs1)), (FCVT_WU_S_INX (FCVT_S_H_INX $rs1, FRM_RNE ), FRM_RTZ)>;
623
623
624
624
// half->int32 with current rounding mode.
625
- def : Pat<(i32 (any_lrint FPR16INX:$rs1)), (FCVT_W_S_INX (FCVT_S_H_INX $rs1), FRM_DYN)>;
625
+ def : Pat<(i32 (any_lrint FPR16INX:$rs1)), (FCVT_W_S_INX (FCVT_S_H_INX $rs1, FRM_RNE ), FRM_DYN)>;
626
626
627
627
// half->int32 rounded to nearest with ties rounded away from zero.
628
- def : Pat<(i32 (any_lround FPR16INX:$rs1)), (FCVT_W_S_INX (FCVT_S_H_INX $rs1), FRM_RMM)>;
628
+ def : Pat<(i32 (any_lround FPR16INX:$rs1)), (FCVT_W_S_INX (FCVT_S_H_INX $rs1, FRM_RNE ), FRM_RMM)>;
629
629
630
630
// [u]int->half. Match GCC and default to using dynamic rounding mode.
631
631
def : Pat<(any_sint_to_fp (i32 GPR:$rs1)), (FCVT_H_S_INX (FCVT_S_W_INX $rs1, FRM_DYN), FRM_DYN)>;
@@ -634,16 +634,16 @@ def : Pat<(any_uint_to_fp (i32 GPR:$rs1)), (FCVT_H_S_INX (FCVT_S_WU_INX $rs1, FR
634
634
635
635
let Predicates = [HasStdExtZfhmin, NoStdExtZfh, IsRV64] in {
636
636
// half->[u]int64. Round-to-zero must be used.
637
- def : Pat<(i64 (any_fp_to_sint (f16 FPR16:$rs1))), (FCVT_L_S (FCVT_S_H $rs1), FRM_RTZ)>;
638
- def : Pat<(i64 (any_fp_to_uint (f16 FPR16:$rs1))), (FCVT_LU_S (FCVT_S_H $rs1), FRM_RTZ)>;
637
+ def : Pat<(i64 (any_fp_to_sint (f16 FPR16:$rs1))), (FCVT_L_S (FCVT_S_H $rs1, FRM_RNE ), FRM_RTZ)>;
638
+ def : Pat<(i64 (any_fp_to_uint (f16 FPR16:$rs1))), (FCVT_LU_S (FCVT_S_H $rs1, FRM_RNE ), FRM_RTZ)>;
639
639
640
640
// half->int64 with current rounding mode.
641
- def : Pat<(i64 (any_lrint (f16 FPR16:$rs1))), (FCVT_L_S (FCVT_S_H $rs1), FRM_DYN)>;
642
- def : Pat<(i64 (any_llrint (f16 FPR16:$rs1))), (FCVT_L_S (FCVT_S_H $rs1), FRM_DYN)>;
641
+ def : Pat<(i64 (any_lrint (f16 FPR16:$rs1))), (FCVT_L_S (FCVT_S_H $rs1, FRM_RNE ), FRM_DYN)>;
642
+ def : Pat<(i64 (any_llrint (f16 FPR16:$rs1))), (FCVT_L_S (FCVT_S_H $rs1, FRM_RNE ), FRM_DYN)>;
643
643
644
644
// half->int64 rounded to nearest with ties rounded away from zero.
645
- def : Pat<(i64 (any_lround (f16 FPR16:$rs1))), (FCVT_L_S (FCVT_S_H $rs1), FRM_RMM)>;
646
- def : Pat<(i64 (any_llround (f16 FPR16:$rs1))), (FCVT_L_S (FCVT_S_H $rs1), FRM_RMM)>;
645
+ def : Pat<(i64 (any_lround (f16 FPR16:$rs1))), (FCVT_L_S (FCVT_S_H $rs1, FRM_RNE ), FRM_RMM)>;
646
+ def : Pat<(i64 (any_llround (f16 FPR16:$rs1))), (FCVT_L_S (FCVT_S_H $rs1, FRM_RNE ), FRM_RMM)>;
647
647
648
648
// [u]int->fp. Match GCC and default to using dynamic rounding mode.
649
649
def : Pat<(f16 (any_sint_to_fp (i64 GPR:$rs1))), (FCVT_H_S (FCVT_S_L $rs1, FRM_DYN), FRM_DYN)>;
@@ -652,16 +652,16 @@ def : Pat<(f16 (any_uint_to_fp (i64 GPR:$rs1))), (FCVT_H_S (FCVT_S_LU $rs1, FRM_
652
652
653
653
let Predicates = [HasStdExtZhinxmin, NoStdExtZhinx, IsRV64] in {
654
654
// half->[u]int64. Round-to-zero must be used.
655
- def : Pat<(i64 (any_fp_to_sint FPR16INX:$rs1)), (FCVT_L_S_INX (FCVT_S_H_INX $rs1), FRM_RTZ)>;
656
- def : Pat<(i64 (any_fp_to_uint FPR16INX:$rs1)), (FCVT_LU_S_INX (FCVT_S_H_INX $rs1), FRM_RTZ)>;
655
+ def : Pat<(i64 (any_fp_to_sint FPR16INX:$rs1)), (FCVT_L_S_INX (FCVT_S_H_INX $rs1, FRM_RNE ), FRM_RTZ)>;
656
+ def : Pat<(i64 (any_fp_to_uint FPR16INX:$rs1)), (FCVT_LU_S_INX (FCVT_S_H_INX $rs1, FRM_RNE ), FRM_RTZ)>;
657
657
658
658
// half->int64 with current rounding mode.
659
- def : Pat<(i64 (any_lrint FPR16INX:$rs1)), (FCVT_L_S_INX (FCVT_S_H_INX $rs1), FRM_DYN)>;
660
- def : Pat<(i64 (any_llrint FPR16INX:$rs1)), (FCVT_L_S_INX (FCVT_S_H_INX $rs1), FRM_DYN)>;
659
+ def : Pat<(i64 (any_lrint FPR16INX:$rs1)), (FCVT_L_S_INX (FCVT_S_H_INX $rs1, FRM_RNE ), FRM_DYN)>;
660
+ def : Pat<(i64 (any_llrint FPR16INX:$rs1)), (FCVT_L_S_INX (FCVT_S_H_INX $rs1, FRM_RNE ), FRM_DYN)>;
661
661
662
662
// half->int64 rounded to nearest with ties rounded away from zero.
663
- def : Pat<(i64 (any_lround FPR16INX:$rs1)), (FCVT_L_S_INX (FCVT_S_H_INX $rs1), FRM_RMM)>;
664
- def : Pat<(i64 (any_llround FPR16INX:$rs1)), (FCVT_L_S_INX (FCVT_S_H_INX $rs1), FRM_RMM)>;
663
+ def : Pat<(i64 (any_lround FPR16INX:$rs1)), (FCVT_L_S_INX (FCVT_S_H_INX $rs1, FRM_RNE ), FRM_RMM)>;
664
+ def : Pat<(i64 (any_llround FPR16INX:$rs1)), (FCVT_L_S_INX (FCVT_S_H_INX $rs1, FRM_RNE ), FRM_RMM)>;
665
665
666
666
// [u]int->fp. Match GCC and default to using dynamic rounding mode.
667
667
def : Pat<(any_sint_to_fp (i64 GPR:$rs1)), (FCVT_H_S_INX (FCVT_S_L_INX $rs1, FRM_DYN), FRM_DYN)>;
0 commit comments