@@ -4709,7 +4709,7 @@ defm FCVTZS : FPToIntegerScaled<0b11, 0b000, "fcvtzs", any_fp_to_sint>;
4709
4709
defm FCVTZU : FPToIntegerScaled<0b11, 0b001, "fcvtzu", any_fp_to_uint>;
4710
4710
4711
4711
// AArch64's FCVT instructions saturate when out of range.
4712
- multiclass FPToIntegerSatPats<SDNode to_int_sat, string INST> {
4712
+ multiclass FPToIntegerSatPats<SDNode to_int_sat, SDNode to_int_sat_gi, string INST> {
4713
4713
let Predicates = [HasFullFP16] in {
4714
4714
def : Pat<(i32 (to_int_sat f16:$Rn, i32)),
4715
4715
(!cast<Instruction>(INST # UWHr) f16:$Rn)>;
@@ -4725,6 +4725,21 @@ multiclass FPToIntegerSatPats<SDNode to_int_sat, string INST> {
4725
4725
def : Pat<(i64 (to_int_sat f64:$Rn, i64)),
4726
4726
(!cast<Instruction>(INST # UXDr) f64:$Rn)>;
4727
4727
4728
+ let Predicates = [HasFullFP16] in {
4729
+ def : Pat<(i32 (to_int_sat_gi f16:$Rn)),
4730
+ (!cast<Instruction>(INST # UWHr) f16:$Rn)>;
4731
+ def : Pat<(i64 (to_int_sat_gi f16:$Rn)),
4732
+ (!cast<Instruction>(INST # UXHr) f16:$Rn)>;
4733
+ }
4734
+ def : Pat<(i32 (to_int_sat_gi f32:$Rn)),
4735
+ (!cast<Instruction>(INST # UWSr) f32:$Rn)>;
4736
+ def : Pat<(i64 (to_int_sat_gi f32:$Rn)),
4737
+ (!cast<Instruction>(INST # UXSr) f32:$Rn)>;
4738
+ def : Pat<(i32 (to_int_sat_gi f64:$Rn)),
4739
+ (!cast<Instruction>(INST # UWDr) f64:$Rn)>;
4740
+ def : Pat<(i64 (to_int_sat_gi f64:$Rn)),
4741
+ (!cast<Instruction>(INST # UXDr) f64:$Rn)>;
4742
+
4728
4743
let Predicates = [HasFullFP16] in {
4729
4744
def : Pat<(i32 (to_int_sat (fmul f16:$Rn, fixedpoint_f16_i32:$scale), i32)),
4730
4745
(!cast<Instruction>(INST # SWHri) $Rn, $scale)>;
@@ -4739,10 +4754,25 @@ multiclass FPToIntegerSatPats<SDNode to_int_sat, string INST> {
4739
4754
(!cast<Instruction>(INST # SWDri) $Rn, $scale)>;
4740
4755
def : Pat<(i64 (to_int_sat (fmul f64:$Rn, fixedpoint_f64_i64:$scale), i64)),
4741
4756
(!cast<Instruction>(INST # SXDri) $Rn, $scale)>;
4757
+
4758
+ let Predicates = [HasFullFP16] in {
4759
+ def : Pat<(i32 (to_int_sat_gi (fmul f16:$Rn, fixedpoint_f16_i32:$scale))),
4760
+ (!cast<Instruction>(INST # SWHri) $Rn, $scale)>;
4761
+ def : Pat<(i64 (to_int_sat_gi (fmul f16:$Rn, fixedpoint_f16_i64:$scale))),
4762
+ (!cast<Instruction>(INST # SXHri) $Rn, $scale)>;
4763
+ }
4764
+ def : Pat<(i32 (to_int_sat_gi (fmul f32:$Rn, fixedpoint_f32_i32:$scale))),
4765
+ (!cast<Instruction>(INST # SWSri) $Rn, $scale)>;
4766
+ def : Pat<(i64 (to_int_sat_gi (fmul f32:$Rn, fixedpoint_f32_i64:$scale))),
4767
+ (!cast<Instruction>(INST # SXSri) $Rn, $scale)>;
4768
+ def : Pat<(i32 (to_int_sat_gi (fmul f64:$Rn, fixedpoint_f64_i32:$scale))),
4769
+ (!cast<Instruction>(INST # SWDri) $Rn, $scale)>;
4770
+ def : Pat<(i64 (to_int_sat_gi (fmul f64:$Rn, fixedpoint_f64_i64:$scale))),
4771
+ (!cast<Instruction>(INST # SXDri) $Rn, $scale)>;
4742
4772
}
4743
4773
4744
- defm : FPToIntegerSatPats<fp_to_sint_sat, "FCVTZS">;
4745
- defm : FPToIntegerSatPats<fp_to_uint_sat, "FCVTZU">;
4774
+ defm : FPToIntegerSatPats<fp_to_sint_sat, fp_to_sint_sat_gi, "FCVTZS">;
4775
+ defm : FPToIntegerSatPats<fp_to_uint_sat, fp_to_uint_sat_gi, "FCVTZU">;
4746
4776
4747
4777
multiclass FPToIntegerIntPats<Intrinsic round, string INST> {
4748
4778
let Predicates = [HasFullFP16] in {
0 commit comments