@@ -877,6 +877,12 @@ let Uses = [RM] in {
877
877
"xxsldwi $XT, $XA, $XB, $SHW", IIC_VecPerm,
878
878
[(set v4i32:$XT, (PPCvecshl v4i32:$XA, v4i32:$XB,
879
879
imm32SExt16:$SHW))]>;
880
+
881
+ let isCodeGenOnly = 1 in
882
+ def XXSLDWIs : XX3Form_2s<60, 2,
883
+ (outs vsrc:$XT), (ins vsfrc:$XA, u2imm:$SHW),
884
+ "xxsldwi $XT, $XA, $XA, $SHW", IIC_VecPerm, []>;
885
+
880
886
def XXSPLTW : XX2Form_2<60, 164,
881
887
(outs vsrc:$XT), (ins vsrc:$XB, u2imm:$UIM),
882
888
"xxspltw $XT, $XB, $UIM", IIC_VecPerm,
@@ -886,6 +892,7 @@ let Uses = [RM] in {
886
892
def XXSPLTWs : XX2Form_2<60, 164,
887
893
(outs vsrc:$XT), (ins vfrc:$XB, u2imm:$UIM),
888
894
"xxspltw $XT, $XB, $UIM", IIC_VecPerm, []>;
895
+
889
896
} // hasSideEffects
890
897
} // UseVSXReg = 1
891
898
@@ -1466,8 +1473,6 @@ let AddedComplexity = 400 in { // Prefer VSX patterns over non-VSX patterns.
1466
1473
(f64 (PPCmtvsra (i64 (vector_extract v2i64:$S, 1)))))),
1467
1474
(f32 (XSCVUXDSP (COPY_TO_REGCLASS (XXPERMDI $S, $S, 2), VSFRC)))>;
1468
1475
}
1469
- def : Pat<(v4i32 (scalar_to_vector ScalarLoads.Li32)),
1470
- (v4i32 (XXSPLTWs (LIWAX xoaddr:$src), 1))>;
1471
1476
1472
1477
// Instructions for converting float to i64 feeding a store.
1473
1478
let Predicates = [NoP9Vector] in {
@@ -3050,13 +3055,47 @@ let AddedComplexity = 400, Predicates = [HasP9Vector] in {
3050
3055
(STXVX $rS, xoaddr:$dst)>;
3051
3056
def : Pat<(int_ppc_vsx_stxvd2x v2f64:$rS, xoaddr:$dst),
3052
3057
(STXVX $rS, xoaddr:$dst)>;
3053
- def : Pat<(v4i32 (scalar_to_vector (i32 (load xoaddr:$src)))),
3054
- (v4i32 (LXVWSX xoaddr:$src))>;
3055
- def : Pat<(v4f32 (scalar_to_vector (f32 (load xoaddr:$src)))),
3056
- (v4f32 (LXVWSX xoaddr:$src))>;
3057
- def : Pat<(v4f32 (scalar_to_vector
3058
- (f32 (fpround (f64 (extloadf32 xoaddr:$src)))))),
3059
- (v4f32 (LXVWSX xoaddr:$src))>;
3058
+
3059
+ let AddedComplexity = 400 in {
3060
+ // LIWAX - This instruction is used for sign extending i32 -> i64.
3061
+ // LIWZX - This instruction will be emitted for i32, f32, and when
3062
+ // zero-extending i32 to i64 (zext i32 -> i64).
3063
+ let Predicates = [IsLittleEndian] in {
3064
+
3065
+ def : Pat<(v2i64 (scalar_to_vector (i64 (sextloadi32 xoaddr:$src)))),
3066
+ (v2i64 (XXPERMDIs
3067
+ (COPY_TO_REGCLASS (LIWAX xoaddr:$src), VSRC), 2))>;
3068
+
3069
+ def : Pat<(v2i64 (scalar_to_vector (i64 (zextloadi32 xoaddr:$src)))),
3070
+ (v2i64 (XXPERMDIs
3071
+ (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSRC), 2))>;
3072
+
3073
+ def : Pat<(v4i32 (scalar_to_vector (i32 (load xoaddr:$src)))),
3074
+ (v4i32 (XXPERMDIs
3075
+ (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSRC), 2))>;
3076
+
3077
+ def : Pat<(v4f32 (scalar_to_vector (f32 (load xoaddr:$src)))),
3078
+ (v4f32 (XXPERMDIs
3079
+ (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSRC), 2))>;
3080
+ }
3081
+
3082
+ let Predicates = [IsBigEndian] in {
3083
+ def : Pat<(v2i64 (scalar_to_vector (i64 (sextloadi32 xoaddr:$src)))),
3084
+ (v2i64 (COPY_TO_REGCLASS (LIWAX xoaddr:$src), VSRC))>;
3085
+
3086
+ def : Pat<(v2i64 (scalar_to_vector (i64 (zextloadi32 xoaddr:$src)))),
3087
+ (v2i64 (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSRC))>;
3088
+
3089
+ def : Pat<(v4i32 (scalar_to_vector (i32 (load xoaddr:$src)))),
3090
+ (v4i32 (XXSLDWIs
3091
+ (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSRC), 1))>;
3092
+
3093
+ def : Pat<(v4f32 (scalar_to_vector (f32 (load xoaddr:$src)))),
3094
+ (v4f32 (XXSLDWIs
3095
+ (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSRC), 1))>;
3096
+ }
3097
+
3098
+ }
3060
3099
3061
3100
// Build vectors from i8 loads
3062
3101
def : Pat<(v16i8 (scalar_to_vector ScalarLoads.Li8)),
@@ -3218,6 +3257,39 @@ let AddedComplexity = 400, Predicates = [HasP9Vector] in {
3218
3257
def : Pat<(f32 (fpround (f64 (extloadf32 ixaddr:$src)))),
3219
3258
(f32 (DFLOADf32 ixaddr:$src))>;
3220
3259
3260
+
3261
+ let AddedComplexity = 400 in {
3262
+ // The following pseudoinstructions are used to ensure the utilization
3263
+ // of all 64 VSX registers.
3264
+ let Predicates = [IsLittleEndian, HasP9Vector] in {
3265
+ def : Pat<(v2i64 (scalar_to_vector (i64 (load ixaddr:$src)))),
3266
+ (v2i64 (XXPERMDIs
3267
+ (COPY_TO_REGCLASS (DFLOADf64 ixaddr:$src), VSRC), 2))>;
3268
+ def : Pat<(v2i64 (scalar_to_vector (i64 (load xaddr:$src)))),
3269
+ (v2i64 (XXPERMDIs
3270
+ (COPY_TO_REGCLASS (XFLOADf64 xaddr:$src), VSRC), 2))>;
3271
+
3272
+ def : Pat<(v2f64 (scalar_to_vector (f64 (load ixaddr:$src)))),
3273
+ (v2f64 (XXPERMDIs
3274
+ (COPY_TO_REGCLASS (DFLOADf64 ixaddr:$src), VSRC), 2))>;
3275
+ def : Pat<(v2f64 (scalar_to_vector (f64 (load xaddr:$src)))),
3276
+ (v2f64 (XXPERMDIs
3277
+ (COPY_TO_REGCLASS (XFLOADf64 xaddr:$src), VSRC), 2))>;
3278
+ }
3279
+
3280
+ let Predicates = [IsBigEndian, HasP9Vector] in {
3281
+ def : Pat<(v2i64 (scalar_to_vector (i64 (load ixaddr:$src)))),
3282
+ (v2i64 (COPY_TO_REGCLASS (DFLOADf64 ixaddr:$src), VSRC))>;
3283
+ def : Pat<(v2i64 (scalar_to_vector (i64 (load xaddr:$src)))),
3284
+ (v2i64 (COPY_TO_REGCLASS (XFLOADf64 xaddr:$src), VSRC))>;
3285
+
3286
+ def : Pat<(v2f64 (scalar_to_vector (f64 (load ixaddr:$src)))),
3287
+ (v2f64 (COPY_TO_REGCLASS (DFLOADf64 ixaddr:$src), VSRC))>;
3288
+ def : Pat<(v2f64 (scalar_to_vector (f64 (load xaddr:$src)))),
3289
+ (v2f64 (COPY_TO_REGCLASS (XFLOADf64 xaddr:$src), VSRC))>;
3290
+ }
3291
+ }
3292
+
3221
3293
let Predicates = [IsBigEndian, HasP9Vector] in {
3222
3294
3223
3295
// (Un)Signed DWord vector extract -> QP
@@ -3932,3 +4004,4 @@ let AddedComplexity = 400 in {
3932
4004
(v4i32 (VEXTSH2W $A))>;
3933
4005
}
3934
4006
}
4007
+
0 commit comments