@@ -2127,8 +2127,9 @@ multiclass VPseudoBinary<VReg RetClass,
2127
2127
LMULInfo MInfo,
2128
2128
string Constraint = "",
2129
2129
int sew = 0,
2130
- int TargetConstraintType = 1> {
2131
- let VLMul = MInfo.value, SEW=sew in {
2130
+ int TargetConstraintType = 1,
2131
+ bit Commutable = 0> {
2132
+ let VLMul = MInfo.value, SEW=sew, isCommutable = Commutable in {
2132
2133
defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX);
2133
2134
def suffix : VPseudoBinaryNoMaskTU<RetClass, Op1Class, Op2Class,
2134
2135
Constraint, TargetConstraintType>;
@@ -2167,8 +2168,9 @@ multiclass VPseudoBinaryM<VReg RetClass,
2167
2168
DAGOperand Op2Class,
2168
2169
LMULInfo MInfo,
2169
2170
string Constraint = "",
2170
- int TargetConstraintType = 1> {
2171
- let VLMul = MInfo.value in {
2171
+ int TargetConstraintType = 1,
2172
+ bit Commutable = 0> {
2173
+ let VLMul = MInfo.value, isCommutable = Commutable in {
2172
2174
def "_" # MInfo.MX : VPseudoBinaryMOutNoMask<RetClass, Op1Class, Op2Class,
2173
2175
Constraint, TargetConstraintType>;
2174
2176
let ForceTailAgnostic = true in
@@ -2226,8 +2228,8 @@ multiclass VPseudoTiedBinaryRoundingMode<VReg RetClass,
2226
2228
}
2227
2229
2228
2230
2229
- multiclass VPseudoBinaryV_VV<LMULInfo m, string Constraint = "", int sew = 0> {
2230
- defm _VV : VPseudoBinary<m.vrclass, m.vrclass, m.vrclass, m, Constraint, sew>;
2231
+ multiclass VPseudoBinaryV_VV<LMULInfo m, string Constraint = "", int sew = 0, bit Commutable = 0 > {
2232
+ defm _VV : VPseudoBinary<m.vrclass, m.vrclass, m.vrclass, m, Constraint, sew, Commutable=Commutable >;
2231
2233
}
2232
2234
2233
2235
multiclass VPseudoBinaryV_VV_RM<LMULInfo m, string Constraint = ""> {
@@ -2331,9 +2333,10 @@ multiclass VPseudoVALU_MM<bit Commutable = 0> {
2331
2333
// * The destination EEW is greater than the source EEW, the source EMUL is
2332
2334
// at least 1, and the overlap is in the highest-numbered part of the
2333
2335
// destination register group is legal. Otherwise, it is illegal.
2334
- multiclass VPseudoBinaryW_VV<LMULInfo m> {
2336
+ multiclass VPseudoBinaryW_VV<LMULInfo m, bit Commutable = 0 > {
2335
2337
defm _VV : VPseudoBinary<m.wvrclass, m.vrclass, m.vrclass, m,
2336
- "@earlyclobber $rd", TargetConstraintType=3>;
2338
+ "@earlyclobber $rd", TargetConstraintType=3,
2339
+ Commutable=Commutable>;
2337
2340
}
2338
2341
2339
2342
multiclass VPseudoBinaryW_VV_RM<LMULInfo m, int sew = 0> {
@@ -2453,7 +2456,9 @@ multiclass VPseudoBinaryV_VM<LMULInfo m, bit CarryOut = 0, bit CarryIn = 1,
2453
2456
m.vrclass, m.vrclass, m, CarryIn, Constraint, TargetConstraintType>;
2454
2457
}
2455
2458
2456
- multiclass VPseudoTiedBinaryV_VM<LMULInfo m, int TargetConstraintType = 1> {
2459
+ multiclass VPseudoTiedBinaryV_VM<LMULInfo m, int TargetConstraintType = 1,
2460
+ bit Commutable = 0> {
2461
+ let isCommutable = Commutable in
2457
2462
def "_VVM" # "_" # m.MX:
2458
2463
VPseudoTiedBinaryCarryIn<GetVRegNoV0<m.vrclass>.R,
2459
2464
m.vrclass, m.vrclass, m, 1, "",
@@ -2667,9 +2672,11 @@ multiclass PseudoVEXT_VF8 {
2667
2672
// lowest-numbered part of the source register group".
2668
2673
// With LMUL<=1 the source and dest occupy a single register so any overlap
2669
2674
// is in the lowest-numbered part.
2670
- multiclass VPseudoBinaryM_VV<LMULInfo m, int TargetConstraintType = 1> {
2675
+ multiclass VPseudoBinaryM_VV<LMULInfo m, int TargetConstraintType = 1,
2676
+ bit Commutable = 0> {
2671
2677
defm _VV : VPseudoBinaryM<VR, m.vrclass, m.vrclass, m,
2672
- !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>;
2678
+ !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""),
2679
+ TargetConstraintType, Commutable=Commutable>;
2673
2680
}
2674
2681
2675
2682
multiclass VPseudoBinaryM_VX<LMULInfo m, int TargetConstraintType = 1> {
@@ -2751,10 +2758,11 @@ multiclass VPseudoVSSHT_VV_VX_VI_RM<Operand ImmType = simm5, string Constraint =
2751
2758
}
2752
2759
}
2753
2760
2754
- multiclass VPseudoVALU_VV_VX_VI<Operand ImmType = simm5, string Constraint = ""> {
2761
+ multiclass VPseudoVALU_VV_VX_VI<Operand ImmType = simm5, string Constraint = "",
2762
+ bit Commutable = 0> {
2755
2763
foreach m = MxList in {
2756
2764
defvar mx = m.MX;
2757
- defm "" : VPseudoBinaryV_VV<m, Constraint>,
2765
+ defm "" : VPseudoBinaryV_VV<m, Constraint, Commutable=Commutable >,
2758
2766
SchedBinary<"WriteVIALUV", "ReadVIALUV", "ReadVIALUV", mx,
2759
2767
forceMergeOpRead=true>;
2760
2768
defm "" : VPseudoBinaryV_VX<m, Constraint>,
@@ -2804,17 +2812,17 @@ multiclass VPseudoVAALU_VV_VX_RM {
2804
2812
multiclass VPseudoVMINMAX_VV_VX {
2805
2813
foreach m = MxList in {
2806
2814
defvar mx = m.MX;
2807
- defm "" : VPseudoBinaryV_VV<m>,
2815
+ defm "" : VPseudoBinaryV_VV<m, Commutable=1 >,
2808
2816
SchedBinary<"WriteVIMinMaxV", "ReadVIMinMaxV", "ReadVIMinMaxV", mx>;
2809
2817
defm "" : VPseudoBinaryV_VX<m>,
2810
2818
SchedBinary<"WriteVIMinMaxX", "ReadVIMinMaxV", "ReadVIMinMaxX", mx>;
2811
2819
}
2812
2820
}
2813
2821
2814
- multiclass VPseudoVMUL_VV_VX {
2822
+ multiclass VPseudoVMUL_VV_VX<bit Commutable = 0> {
2815
2823
foreach m = MxList in {
2816
2824
defvar mx = m.MX;
2817
- defm "" : VPseudoBinaryV_VV<m>,
2825
+ defm "" : VPseudoBinaryV_VV<m, Commutable=Commutable >,
2818
2826
SchedBinary<"WriteVIMulV", "ReadVIMulV", "ReadVIMulV", mx>;
2819
2827
defm "" : VPseudoBinaryV_VX<m>,
2820
2828
SchedBinary<"WriteVIMulX", "ReadVIMulV", "ReadVIMulX", mx>;
@@ -2964,10 +2972,10 @@ multiclass VPseudoVALU_VX_VI<Operand ImmType = simm5> {
2964
2972
}
2965
2973
}
2966
2974
2967
- multiclass VPseudoVWALU_VV_VX {
2975
+ multiclass VPseudoVWALU_VV_VX<bit Commutable = 0> {
2968
2976
foreach m = MxListW in {
2969
2977
defvar mx = m.MX;
2970
- defm "" : VPseudoBinaryW_VV<m>,
2978
+ defm "" : VPseudoBinaryW_VV<m, Commutable=Commutable >,
2971
2979
SchedBinary<"WriteVIWALUV", "ReadVIWALUV", "ReadVIWALUV", mx,
2972
2980
forceMergeOpRead=true>;
2973
2981
defm "" : VPseudoBinaryW_VX<m>,
@@ -2976,10 +2984,10 @@ multiclass VPseudoVWALU_VV_VX {
2976
2984
}
2977
2985
}
2978
2986
2979
- multiclass VPseudoVWMUL_VV_VX {
2987
+ multiclass VPseudoVWMUL_VV_VX<bit Commutable = 0> {
2980
2988
foreach m = MxListW in {
2981
2989
defvar mx = m.MX;
2982
- defm "" : VPseudoBinaryW_VV<m>,
2990
+ defm "" : VPseudoBinaryW_VV<m, Commutable=Commutable >,
2983
2991
SchedBinary<"WriteVIWMulV", "ReadVIWMulV", "ReadVIWMulV", mx,
2984
2992
forceMergeOpRead=true>;
2985
2993
defm "" : VPseudoBinaryW_VX<m>,
@@ -3074,7 +3082,7 @@ multiclass VPseudoVMRG_VM_XM_IM {
3074
3082
multiclass VPseudoVCALU_VM_XM_IM {
3075
3083
foreach m = MxList in {
3076
3084
defvar mx = m.MX;
3077
- defm "" : VPseudoTiedBinaryV_VM<m>,
3085
+ defm "" : VPseudoTiedBinaryV_VM<m, Commutable=1 >,
3078
3086
SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx,
3079
3087
forceMergeOpRead=true>;
3080
3088
defm "" : VPseudoTiedBinaryV_XM<m>,
@@ -3287,10 +3295,10 @@ multiclass VPseudoTernaryV_VF_AAXA_RM<LMULInfo m, FPR_Info f,
3287
3295
sew, Commutable=1>;
3288
3296
}
3289
3297
3290
- multiclass VPseudoTernaryW_VV<LMULInfo m> {
3298
+ multiclass VPseudoTernaryW_VV<LMULInfo m, bit Commutable = 0 > {
3291
3299
defvar constraint = "@earlyclobber $rd";
3292
3300
defm _VV : VPseudoTernaryWithPolicy<m.wvrclass, m.vrclass, m.vrclass, m,
3293
- constraint, /* Commutable*/ 0 , TargetConstraintType=3>;
3301
+ constraint, Commutable=Commutable , TargetConstraintType=3>;
3294
3302
}
3295
3303
3296
3304
multiclass VPseudoTernaryW_VV_RM<LMULInfo m, int sew = 0> {
@@ -3380,10 +3388,10 @@ multiclass VPseudoVSLD_VX_VI<Operand ImmType = simm5, string Constraint = ""> {
3380
3388
}
3381
3389
}
3382
3390
3383
- multiclass VPseudoVWMAC_VV_VX {
3391
+ multiclass VPseudoVWMAC_VV_VX<bit Commutable = 0> {
3384
3392
foreach m = MxListW in {
3385
3393
defvar mx = m.MX;
3386
- defm "" : VPseudoTernaryW_VV<m>,
3394
+ defm "" : VPseudoTernaryW_VV<m, Commutable=Commutable >,
3387
3395
SchedTernary<"WriteVIWMulAddV", "ReadVIWMulAddV", "ReadVIWMulAddV",
3388
3396
"ReadVIWMulAddV", mx>;
3389
3397
defm "" : VPseudoTernaryW_VX<m>,
@@ -3436,10 +3444,10 @@ multiclass VPseudoVWMAC_VV_VF_BF_RM {
3436
3444
}
3437
3445
}
3438
3446
3439
- multiclass VPseudoVCMPM_VV_VX_VI {
3447
+ multiclass VPseudoVCMPM_VV_VX_VI<bit Commutable = 0> {
3440
3448
foreach m = MxList in {
3441
3449
defvar mx = m.MX;
3442
- defm "" : VPseudoBinaryM_VV<m, TargetConstraintType=2>,
3450
+ defm "" : VPseudoBinaryM_VV<m, TargetConstraintType=2, Commutable=Commutable >,
3443
3451
SchedBinary<"WriteVICmpV", "ReadVICmpV", "ReadVICmpV", mx>;
3444
3452
defm "" : VPseudoBinaryM_VX<m, TargetConstraintType=2>,
3445
3453
SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>;
@@ -6248,7 +6256,7 @@ defm PseudoVLSEG : VPseudoUSSegLoadFF;
6248
6256
//===----------------------------------------------------------------------===//
6249
6257
// 11.1. Vector Single-Width Integer Add and Subtract
6250
6258
//===----------------------------------------------------------------------===//
6251
- defm PseudoVADD : VPseudoVALU_VV_VX_VI;
6259
+ defm PseudoVADD : VPseudoVALU_VV_VX_VI<Commutable=1> ;
6252
6260
defm PseudoVSUB : VPseudoVALU_VV_VX;
6253
6261
defm PseudoVRSUB : VPseudoVALU_VX_VI;
6254
6262
@@ -6313,9 +6321,9 @@ foreach vti = AllIntegerVectors in {
6313
6321
//===----------------------------------------------------------------------===//
6314
6322
// 11.2. Vector Widening Integer Add/Subtract
6315
6323
//===----------------------------------------------------------------------===//
6316
- defm PseudoVWADDU : VPseudoVWALU_VV_VX;
6324
+ defm PseudoVWADDU : VPseudoVWALU_VV_VX<Commutable=1> ;
6317
6325
defm PseudoVWSUBU : VPseudoVWALU_VV_VX;
6318
- defm PseudoVWADD : VPseudoVWALU_VV_VX;
6326
+ defm PseudoVWADD : VPseudoVWALU_VV_VX<Commutable=1> ;
6319
6327
defm PseudoVWSUB : VPseudoVWALU_VV_VX;
6320
6328
defm PseudoVWADDU : VPseudoVWALU_WV_WX;
6321
6329
defm PseudoVWSUBU : VPseudoVWALU_WV_WX;
@@ -6346,9 +6354,9 @@ defm PseudoVMSBC : VPseudoVCALUM_V_X<"@earlyclobber $rd">;
6346
6354
//===----------------------------------------------------------------------===//
6347
6355
// 11.5. Vector Bitwise Logical Instructions
6348
6356
//===----------------------------------------------------------------------===//
6349
- defm PseudoVAND : VPseudoVALU_VV_VX_VI;
6350
- defm PseudoVOR : VPseudoVALU_VV_VX_VI;
6351
- defm PseudoVXOR : VPseudoVALU_VV_VX_VI;
6357
+ defm PseudoVAND : VPseudoVALU_VV_VX_VI<Commutable=1> ;
6358
+ defm PseudoVOR : VPseudoVALU_VV_VX_VI<Commutable=1> ;
6359
+ defm PseudoVXOR : VPseudoVALU_VV_VX_VI<Commutable=1> ;
6352
6360
6353
6361
//===----------------------------------------------------------------------===//
6354
6362
// 11.6. Vector Single-Width Bit Shift Instructions
@@ -6366,8 +6374,8 @@ defm PseudoVNSRA : VPseudoVNSHT_WV_WX_WI;
6366
6374
//===----------------------------------------------------------------------===//
6367
6375
// 11.8. Vector Integer Comparison Instructions
6368
6376
//===----------------------------------------------------------------------===//
6369
- defm PseudoVMSEQ : VPseudoVCMPM_VV_VX_VI;
6370
- defm PseudoVMSNE : VPseudoVCMPM_VV_VX_VI;
6377
+ defm PseudoVMSEQ : VPseudoVCMPM_VV_VX_VI<Commutable=1> ;
6378
+ defm PseudoVMSNE : VPseudoVCMPM_VV_VX_VI<Commutable=1> ;
6371
6379
defm PseudoVMSLTU : VPseudoVCMPM_VV_VX;
6372
6380
defm PseudoVMSLT : VPseudoVCMPM_VV_VX;
6373
6381
defm PseudoVMSLEU : VPseudoVCMPM_VV_VX_VI;
@@ -6386,9 +6394,9 @@ defm PseudoVMAX : VPseudoVMINMAX_VV_VX;
6386
6394
//===----------------------------------------------------------------------===//
6387
6395
// 11.10. Vector Single-Width Integer Multiply Instructions
6388
6396
//===----------------------------------------------------------------------===//
6389
- defm PseudoVMUL : VPseudoVMUL_VV_VX;
6390
- defm PseudoVMULH : VPseudoVMUL_VV_VX;
6391
- defm PseudoVMULHU : VPseudoVMUL_VV_VX;
6397
+ defm PseudoVMUL : VPseudoVMUL_VV_VX<Commutable=1> ;
6398
+ defm PseudoVMULH : VPseudoVMUL_VV_VX<Commutable=1> ;
6399
+ defm PseudoVMULHU : VPseudoVMUL_VV_VX<Commutable=1> ;
6392
6400
defm PseudoVMULHSU : VPseudoVMUL_VV_VX;
6393
6401
6394
6402
//===----------------------------------------------------------------------===//
@@ -6402,8 +6410,8 @@ defm PseudoVREM : VPseudoVDIV_VV_VX;
6402
6410
//===----------------------------------------------------------------------===//
6403
6411
// 11.12. Vector Widening Integer Multiply Instructions
6404
6412
//===----------------------------------------------------------------------===//
6405
- defm PseudoVWMUL : VPseudoVWMUL_VV_VX;
6406
- defm PseudoVWMULU : VPseudoVWMUL_VV_VX;
6413
+ defm PseudoVWMUL : VPseudoVWMUL_VV_VX<Commutable=1> ;
6414
+ defm PseudoVWMULU : VPseudoVWMUL_VV_VX<Commutable=1> ;
6407
6415
defm PseudoVWMULSU : VPseudoVWMUL_VV_VX;
6408
6416
6409
6417
//===----------------------------------------------------------------------===//
@@ -6417,8 +6425,8 @@ defm PseudoVNMSUB : VPseudoVMAC_VV_VX_AAXA;
6417
6425
//===----------------------------------------------------------------------===//
6418
6426
// 11.14. Vector Widening Integer Multiply-Add Instructions
6419
6427
//===----------------------------------------------------------------------===//
6420
- defm PseudoVWMACCU : VPseudoVWMAC_VV_VX;
6421
- defm PseudoVWMACC : VPseudoVWMAC_VV_VX;
6428
+ defm PseudoVWMACCU : VPseudoVWMAC_VV_VX<Commutable=1> ;
6429
+ defm PseudoVWMACC : VPseudoVWMAC_VV_VX<Commutable=1> ;
6422
6430
defm PseudoVWMACCSU : VPseudoVWMAC_VV_VX;
6423
6431
defm PseudoVWMACCUS : VPseudoVWMAC_VX;
6424
6432
0 commit comments