@@ -1486,14 +1486,10 @@ let Predicates = [HasVSX, HasP9Vector] in {
1486
1486
1487
1487
// Truncate & Convert QP -> (Un)Signed (D)Word (dword[1] is set to zero)
1488
1488
let mayRaiseFPException = 1 in {
1489
- def XSCVQPSDZ : X_VT5_XO5_VB5<63, 25, 836, "xscvqpsdz",
1490
- [(set f128:$RST, (PPCany_fctidz f128:$RB))]>;
1491
- def XSCVQPSWZ : X_VT5_XO5_VB5<63, 9, 836, "xscvqpswz",
1492
- [(set f128:$RST, (PPCany_fctiwz f128:$RB))]>;
1493
- def XSCVQPUDZ : X_VT5_XO5_VB5<63, 17, 836, "xscvqpudz",
1494
- [(set f128:$RST, (PPCany_fctiduz f128:$RB))]>;
1495
- def XSCVQPUWZ : X_VT5_XO5_VB5<63, 1, 836, "xscvqpuwz",
1496
- [(set f128:$RST, (PPCany_fctiwuz f128:$RB))]>;
1489
+ def XSCVQPSDZ : X_VT5_XO5_VB5<63, 25, 836, "xscvqpsdz", []>;
1490
+ def XSCVQPSWZ : X_VT5_XO5_VB5<63, 9, 836, "xscvqpswz", []>;
1491
+ def XSCVQPUDZ : X_VT5_XO5_VB5<63, 17, 836, "xscvqpudz", []>;
1492
+ def XSCVQPUWZ : X_VT5_XO5_VB5<63, 1, 836, "xscvqpuwz", []>;
1497
1493
}
1498
1494
1499
1495
// Convert (Un)Signed DWord -> QP.
@@ -2913,10 +2909,6 @@ def:Pat<(vmrglw_swapped_shuffle v16i8:$vA, v16i8:$vB),
2913
2909
def:Pat<(vmrghw_swapped_shuffle v16i8:$vA, v16i8:$vB),
2914
2910
(COPY_TO_REGCLASS (XXMRGHW (COPY_TO_REGCLASS $vB, VSRC),
2915
2911
(COPY_TO_REGCLASS $vA, VSRC)), VRRC)>;
2916
- def : Pat<(PPCstore_scal_int_from_vsr f64:$src, XForm:$dst, 8),
2917
- (STXSDX $src, XForm:$dst)>;
2918
- def : Pat<(PPCstore_scal_int_from_vsr f128:$src, XForm:$dst, 8),
2919
- (STXSDX (COPY_TO_REGCLASS $src, VSFRC), XForm:$dst)>;
2920
2912
} // HasVSX
2921
2913
2922
2914
// Any big endian VSX subtarget.
@@ -3159,10 +3151,12 @@ def : Pat<(v2f64 (insertelt v2f64:$A, f64:$B, 1)),
3159
3151
3160
3152
// Any pre-Power9 VSX subtarget.
3161
3153
let Predicates = [HasVSX, NoP9Vector] in {
3162
- def : Pat<(PPCstore_scal_int_from_vsr f64:$src, ForceXForm:$dst, 8),
3163
- (STXSDX $src, ForceXForm:$dst)>;
3164
- def : Pat<(PPCstore_scal_int_from_vsr f128:$src, ForceXForm:$dst, 8),
3165
- (STXSDX (COPY_TO_REGCLASS $src, VSFRC), ForceXForm:$dst)>;
3154
+ def : Pat<(PPCstore_scal_int_from_vsr
3155
+ (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), ForceXForm:$dst, 8),
3156
+ (STXSDX (XSCVDPSXDS f64:$src), ForceXForm:$dst)>;
3157
+ def : Pat<(PPCstore_scal_int_from_vsr
3158
+ (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), ForceXForm:$dst, 8),
3159
+ (STXSDX (XSCVDPUXDS f64:$src), ForceXForm:$dst)>;
3166
3160
3167
3161
// Load-and-splat with fp-to-int conversion (using X-Form VSX/FP loads).
3168
3162
defm : ScalToVecWPermute<
@@ -3309,15 +3303,12 @@ def : Pat<(f32 (fneg f32:$S)),
3309
3303
(COPY_TO_REGCLASS $S, VSFRC)), VSSRC))>;
3310
3304
3311
3305
// Instructions for converting float to i32 feeding a store.
3312
- def : Pat<(PPCstore_scal_int_from_vsr f64:$src, ForceXForm:$dst, 4),
3313
- (STIWX $src, ForceXForm:$dst)>;
3314
- def : Pat<(PPCstore_scal_int_from_vsr f128:$src, ForceXForm:$dst, 4),
3315
- (STIWX (COPY_TO_REGCLASS $src, VSFRC), ForceXForm:$dst)>;
3316
-
3317
- def : Pat<(PPCstore_scal_int_from_vsr f64:$src, ForceXForm:$dst, 4),
3318
- (STXSIWX $src, ForceXForm:$dst)>;
3319
- def : Pat<(PPCstore_scal_int_from_vsr f128:$src, ForceXForm:$dst, 4),
3320
- (STXSIWX (COPY_TO_REGCLASS $src, VSFRC), ForceXForm:$dst)>;
3306
+ def : Pat<(PPCstore_scal_int_from_vsr
3307
+ (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), ForceXForm:$dst, 4),
3308
+ (STIWX (XSCVDPSXWS f64:$src), ForceXForm:$dst)>;
3309
+ def : Pat<(PPCstore_scal_int_from_vsr
3310
+ (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), ForceXForm:$dst, 4),
3311
+ (STIWX (XSCVDPUXWS f64:$src), ForceXForm:$dst)>;
3321
3312
3322
3313
def : Pat<(v2i64 (smax v2i64:$src1, v2i64:$src2)),
3323
3314
(v2i64 (VMAXSD (COPY_TO_REGCLASS $src1, VRRC),
@@ -4051,19 +4042,67 @@ def : Pat<(i32 (any_fp_to_uint f128:$src)),
4051
4042
(i32 (MFVSRWZ (COPY_TO_REGCLASS (XSCVQPUWZ $src), VFRC)))>;
4052
4043
4053
4044
// Instructions for store(fptosi).
4054
- def : Pat<(PPCstore_scal_int_from_vsr f64:$src, DSForm:$dst, 8),
4055
- (STXSD $src, DSForm:$dst)>;
4056
- def : Pat<(PPCstore_scal_int_from_vsr f64:$src, ForceXForm:$dst, 2),
4057
- (STXSIHX $src, ForceXForm:$dst)>;
4058
- def : Pat<(PPCstore_scal_int_from_vsr f64:$src, ForceXForm:$dst, 1),
4059
- (STXSIBX $src, ForceXForm:$dst)>;
4060
-
4061
- def : Pat<(PPCstore_scal_int_from_vsr f128:$src, DSForm:$dst, 8),
4062
- (STXSD (COPY_TO_REGCLASS $src, VFRC), DSForm:$dst)>;
4063
- def : Pat<(PPCstore_scal_int_from_vsr f128:$src, ForceXForm:$dst, 2),
4064
- (STXSIHX (COPY_TO_REGCLASS $src, VSFRC), ForceXForm:$dst)>;
4065
- def : Pat<(PPCstore_scal_int_from_vsr f128:$src, ForceXForm:$dst, 1),
4066
- (STXSIBX (COPY_TO_REGCLASS $src, VSFRC), ForceXForm:$dst)>;
4045
+ // The 8-byte version is repeated here due to availability of D-Form STXSD.
4046
+ def : Pat<(PPCstore_scal_int_from_vsr
4047
+ (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), XForm:$dst, 8),
4048
+ (STXSDX (COPY_TO_REGCLASS (XSCVQPSDZ f128:$src), VFRC),
4049
+ XForm:$dst)>;
4050
+ def : Pat<(PPCstore_scal_int_from_vsr
4051
+ (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), DSForm:$dst, 8),
4052
+ (STXSD (COPY_TO_REGCLASS (XSCVQPSDZ f128:$src), VFRC),
4053
+ DSForm:$dst)>;
4054
+ def : Pat<(PPCstore_scal_int_from_vsr
4055
+ (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), ForceXForm:$dst, 4),
4056
+ (STXSIWX (COPY_TO_REGCLASS (XSCVQPSWZ $src), VFRC), ForceXForm:$dst)>;
4057
+ def : Pat<(PPCstore_scal_int_from_vsr
4058
+ (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), ForceXForm:$dst, 2),
4059
+ (STXSIHX (COPY_TO_REGCLASS (XSCVQPSWZ $src), VFRC), ForceXForm:$dst)>;
4060
+ def : Pat<(PPCstore_scal_int_from_vsr
4061
+ (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), ForceXForm:$dst, 1),
4062
+ (STXSIBX (COPY_TO_REGCLASS (XSCVQPSWZ $src), VFRC), ForceXForm:$dst)>;
4063
+ def : Pat<(PPCstore_scal_int_from_vsr
4064
+ (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), XForm:$dst, 8),
4065
+ (STXSDX (XSCVDPSXDS f64:$src), XForm:$dst)>;
4066
+ def : Pat<(PPCstore_scal_int_from_vsr
4067
+ (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), DSForm:$dst, 8),
4068
+ (STXSD (XSCVDPSXDS f64:$src), DSForm:$dst)>;
4069
+ def : Pat<(PPCstore_scal_int_from_vsr
4070
+ (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), ForceXForm:$dst, 2),
4071
+ (STXSIHX (XSCVDPSXWS f64:$src), ForceXForm:$dst)>;
4072
+ def : Pat<(PPCstore_scal_int_from_vsr
4073
+ (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), ForceXForm:$dst, 1),
4074
+ (STXSIBX (XSCVDPSXWS f64:$src), ForceXForm:$dst)>;
4075
+
4076
+ // Instructions for store(fptoui).
4077
+ def : Pat<(PPCstore_scal_int_from_vsr
4078
+ (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), XForm:$dst, 8),
4079
+ (STXSDX (COPY_TO_REGCLASS (XSCVQPUDZ f128:$src), VFRC),
4080
+ XForm:$dst)>;
4081
+ def : Pat<(PPCstore_scal_int_from_vsr
4082
+ (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), DSForm:$dst, 8),
4083
+ (STXSD (COPY_TO_REGCLASS (XSCVQPUDZ f128:$src), VFRC),
4084
+ DSForm:$dst)>;
4085
+ def : Pat<(PPCstore_scal_int_from_vsr
4086
+ (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), ForceXForm:$dst, 4),
4087
+ (STXSIWX (COPY_TO_REGCLASS (XSCVQPUWZ $src), VFRC), ForceXForm:$dst)>;
4088
+ def : Pat<(PPCstore_scal_int_from_vsr
4089
+ (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), ForceXForm:$dst, 2),
4090
+ (STXSIHX (COPY_TO_REGCLASS (XSCVQPUWZ $src), VFRC), ForceXForm:$dst)>;
4091
+ def : Pat<(PPCstore_scal_int_from_vsr
4092
+ (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), ForceXForm:$dst, 1),
4093
+ (STXSIBX (COPY_TO_REGCLASS (XSCVQPUWZ $src), VFRC), ForceXForm:$dst)>;
4094
+ def : Pat<(PPCstore_scal_int_from_vsr
4095
+ (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), XForm:$dst, 8),
4096
+ (STXSDX (XSCVDPUXDS f64:$src), XForm:$dst)>;
4097
+ def : Pat<(PPCstore_scal_int_from_vsr
4098
+ (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), DSForm:$dst, 8),
4099
+ (STXSD (XSCVDPUXDS f64:$src), DSForm:$dst)>;
4100
+ def : Pat<(PPCstore_scal_int_from_vsr
4101
+ (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), ForceXForm:$dst, 2),
4102
+ (STXSIHX (XSCVDPUXWS f64:$src), ForceXForm:$dst)>;
4103
+ def : Pat<(PPCstore_scal_int_from_vsr
4104
+ (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), ForceXForm:$dst, 1),
4105
+ (STXSIBX (XSCVDPUXWS f64:$src), ForceXForm:$dst)>;
4067
4106
4068
4107
// Round & Convert QP -> DP/SP
4069
4108
def : Pat<(f64 (any_fpround f128:$src)), (f64 (XSCVQPDP $src))>;
0 commit comments