@@ -3359,6 +3359,8 @@ def : GCNPat <
3359
3359
(COPY_TO_REGCLASS SReg_32:$src0, SReg_32)
3360
3360
>;
3361
3361
3362
+ foreach p = [NotHasTrue16BitInsts, UseFakeTrue16Insts] in
3363
+ let True16Predicate = p in {
3362
3364
def : GCNPat <
3363
3365
(vecTy (DivergentBinFrag<build_vector> (Ty VGPR_32:$src0), (Ty undef))),
3364
3366
(COPY_TO_REGCLASS VGPR_32:$src0, VGPR_32)
@@ -3368,6 +3370,7 @@ def : GCNPat <
3368
3370
(vecTy (UniformBinFrag<build_vector> (Ty undef), (Ty SReg_32:$src1))),
3369
3371
(S_LSHL_B32 SReg_32:$src1, (i32 16))
3370
3372
>;
3373
+ }
3371
3374
3372
3375
def : GCNPat <
3373
3376
(vecTy (DivergentBinFrag<build_vector> (Ty undef), (Ty VGPR_32:$src1))),
@@ -3377,6 +3380,8 @@ def : GCNPat <
3377
3380
}
3378
3381
3379
3382
let SubtargetPredicate = HasVOP3PInsts in {
3383
+ foreach p = [NotHasTrue16BitInsts, UseFakeTrue16Insts] in
3384
+ let True16Predicate = p in
3380
3385
def : GCNPat <
3381
3386
(v2i16 (DivergentBinFrag<build_vector> (i16 VGPR_32:$src0), (i16 VGPR_32:$src1))),
3382
3387
(v2i16 (V_LSHL_OR_B32_e64 $src1, (i32 16), (i32 (V_AND_B32_e64 (i32 (V_MOV_B32_e32 (i32 0xffff))), $src0))))
@@ -3406,12 +3411,25 @@ def : GCNPat <
3406
3411
(S_PACK_LL_B32_B16 SReg_32:$src0, SReg_32:$src1)
3407
3412
>;
3408
3413
3414
+ foreach p = [NotHasTrue16BitInsts, UseFakeTrue16Insts] in
3415
+ let True16Predicate = p in
3409
3416
// Take the lower 16 bits from each VGPR_32 and concat them
3410
3417
def : GCNPat <
3411
3418
(vecTy (DivergentBinFrag<build_vector> (Ty VGPR_32:$a), (Ty VGPR_32:$b))),
3412
3419
(V_PERM_B32_e64 VGPR_32:$b, VGPR_32:$a, (S_MOV_B32 (i32 0x05040100)))
3413
3420
>;
3414
3421
3422
+ let True16Predicate = UseRealTrue16Insts in {
3423
+ def : GCNPat <
3424
+ (vecTy (DivergentBinFrag<build_vector> (Ty VGPR_16:$a), (Ty VGPR_16:$b))),
3425
+ (REG_SEQUENCE VGPR_32, VGPR_16:$a, lo16, VGPR_16:$b, hi16)
3426
+ >;
3427
+ // GISel ignores this Pat, but the equivalent is done in selectG_BUILD_VECTOR
3428
+ def : GCNPat <
3429
+ (vecTy (build_vector (Ty VGPR_16:$src0), (Ty undef))),
3430
+ (REG_SEQUENCE VGPR_32, $src0, lo16, (IMPLICIT_DEF), hi16)
3431
+ >;
3432
+ }
3415
3433
3416
3434
// Take the lower 16 bits from V[0] and the upper 16 bits from V[1]
3417
3435
// Special case, can use V_BFI (0xffff literal likely more reusable than 0x70601000)
@@ -3437,6 +3455,8 @@ def : GCNPat <
3437
3455
3438
3456
// Take the upper 16 bits from V[0] and the lower 16 bits from V[1]
3439
3457
// Special case, can use V_ALIGNBIT (always uses encoded literal)
3458
+ foreach p = [NotHasTrue16BitInsts, UseFakeTrue16Insts] in
3459
+ let True16Predicate = p in
3440
3460
def : GCNPat <
3441
3461
(vecTy (DivergentBinFrag<build_vector>
3442
3462
(Ty !if(!eq(Ty, i16),
0 commit comments