@@ -3346,6 +3346,8 @@ def : GCNPat <
3346
3346
(COPY_TO_REGCLASS SReg_32:$src0, SReg_32)
3347
3347
>;
3348
3348
3349
+ foreach p = [NotHasTrue16BitInsts, UseFakeTrue16Insts] in
3350
+ let True16Predicate = p in {
3349
3351
def : GCNPat <
3350
3352
(vecTy (DivergentBinFrag<build_vector> (Ty VGPR_32:$src0), (Ty undef))),
3351
3353
(COPY_TO_REGCLASS VGPR_32:$src0, VGPR_32)
@@ -3355,6 +3357,7 @@ def : GCNPat <
3355
3357
(vecTy (UniformBinFrag<build_vector> (Ty undef), (Ty SReg_32:$src1))),
3356
3358
(S_LSHL_B32 SReg_32:$src1, (i32 16))
3357
3359
>;
3360
+ }
3358
3361
3359
3362
def : GCNPat <
3360
3363
(vecTy (DivergentBinFrag<build_vector> (Ty undef), (Ty VGPR_32:$src1))),
@@ -3364,6 +3367,8 @@ def : GCNPat <
3364
3367
}
3365
3368
3366
3369
let SubtargetPredicate = HasVOP3PInsts in {
3370
+ foreach p = [NotHasTrue16BitInsts, UseFakeTrue16Insts] in
3371
+ let True16Predicate = p in
3367
3372
def : GCNPat <
3368
3373
(v2i16 (DivergentBinFrag<build_vector> (i16 VGPR_32:$src0), (i16 VGPR_32:$src1))),
3369
3374
(v2i16 (V_LSHL_OR_B32_e64 $src1, (i32 16), (i32 (V_AND_B32_e64 (i32 (V_MOV_B32_e32 (i32 0xffff))), $src0))))
@@ -3393,12 +3398,25 @@ def : GCNPat <
3393
3398
(S_PACK_LL_B32_B16 SReg_32:$src0, SReg_32:$src1)
3394
3399
>;
3395
3400
3401
+ foreach p = [NotHasTrue16BitInsts, UseFakeTrue16Insts] in
3402
+ let True16Predicate = p in
3396
3403
// Take the lower 16 bits from each VGPR_32 and concat them
3397
3404
def : GCNPat <
3398
3405
(vecTy (DivergentBinFrag<build_vector> (Ty VGPR_32:$a), (Ty VGPR_32:$b))),
3399
3406
(V_PERM_B32_e64 VGPR_32:$b, VGPR_32:$a, (S_MOV_B32 (i32 0x05040100)))
3400
3407
>;
3401
3408
3409
+ let True16Predicate = UseRealTrue16Insts in {
3410
+ def : GCNPat <
3411
+ (vecTy (DivergentBinFrag<build_vector> (Ty VGPR_16:$a), (Ty VGPR_16:$b))),
3412
+ (REG_SEQUENCE VGPR_32, VGPR_16:$a, lo16, VGPR_16:$b, hi16)
3413
+ >;
3414
+ // GISel ignores this Pat, but the equivalent is done in selectG_BUILD_VECTOR
3415
+ def : GCNPat <
3416
+ (vecTy (build_vector (Ty VGPR_16:$src0), (Ty undef))),
3417
+ (REG_SEQUENCE VGPR_32, $src0, lo16, (IMPLICIT_DEF), hi16)
3418
+ >;
3419
+ }
3402
3420
3403
3421
// Take the lower 16 bits from V[0] and the upper 16 bits from V[1]
3404
3422
// Special case, can use V_BFI (0xffff literal likely more reusable than 0x70601000)
@@ -3424,6 +3442,8 @@ def : GCNPat <
3424
3442
3425
3443
// Take the upper 16 bits from V[0] and the lower 16 bits from V[1]
3426
3444
// Special case, can use V_ALIGNBIT (always uses encoded literal)
3445
+ foreach p = [NotHasTrue16BitInsts, UseFakeTrue16Insts] in
3446
+ let True16Predicate = p in
3427
3447
def : GCNPat <
3428
3448
(vecTy (DivergentBinFrag<build_vector>
3429
3449
(Ty !if(!eq(Ty, i16),
0 commit comments