@@ -281,56 +281,10 @@ def SIfptrunc_round_downward : SDNode<"AMDGPUISD::FPTRUNC_ROUND_DOWNWARD",
281
281
// ValueType helpers
282
282
//===----------------------------------------------------------------------===//
283
283
284
- // Returns 1 if the source arguments have modifiers, 0 if they do not.
285
- class isFloatType<ValueType SrcVT> {
286
- bit ret = !or(!eq(SrcVT.Value, f16.Value),
287
- !eq(SrcVT.Value, bf16.Value),
288
- !eq(SrcVT.Value, f32.Value),
289
- !eq(SrcVT.Value, f64.Value),
290
- !eq(SrcVT.Value, v2f16.Value),
291
- !eq(SrcVT.Value, v2bf16.Value),
292
- !eq(SrcVT.Value, v4f16.Value),
293
- !eq(SrcVT.Value, v4bf16.Value),
294
- !eq(SrcVT.Value, v8f16.Value),
295
- !eq(SrcVT.Value, v8bf16.Value),
296
- !eq(SrcVT.Value, v16f16.Value),
297
- !eq(SrcVT.Value, v16bf16.Value),
298
- !eq(SrcVT.Value, v2f32.Value),
299
- !eq(SrcVT.Value, v4f32.Value),
300
- !eq(SrcVT.Value, v8f32.Value),
301
- !eq(SrcVT.Value, v2f64.Value),
302
- !eq(SrcVT.Value, v4f64.Value));
303
- }
304
-
305
- // XXX - do v2i16 instructions?
306
284
class isIntType<ValueType SrcVT> {
307
- bit ret = !or(!eq(SrcVT.Value, i8.Value),
308
- !eq(SrcVT.Value, i16.Value),
309
- !eq(SrcVT.Value, i32.Value),
310
- !eq(SrcVT.Value, i64.Value),
311
- !eq(SrcVT.Value, v4i16.Value),
312
- !eq(SrcVT.Value, v8i16.Value),
313
- !eq(SrcVT.Value, v16i16.Value),
314
- !eq(SrcVT.Value, v2i32.Value),
315
- !eq(SrcVT.Value, v4i32.Value),
316
- !eq(SrcVT.Value, v8i32.Value));
285
+ bit ret = !and(SrcVT.isInteger, !ne(SrcVT.Value, i1.Value));
317
286
}
318
287
319
- class isPackedType<ValueType SrcVT> {
320
- bit ret = !or(!eq(SrcVT.Value, v2i16.Value),
321
- !eq(SrcVT.Value, v2f16.Value),
322
- !eq(SrcVT.Value, v2bf16.Value),
323
- !eq(SrcVT.Value, v4f16.Value),
324
- !eq(SrcVT.Value, v4bf16.Value),
325
- !eq(SrcVT.Value, v2i32.Value),
326
- !eq(SrcVT.Value, v2f32.Value),
327
- !eq(SrcVT.Value, v4i32.Value),
328
- !eq(SrcVT.Value, v4f32.Value),
329
- !eq(SrcVT.Value, v8i32.Value),
330
- !eq(SrcVT.Value, v8f32.Value));
331
- }
332
-
333
-
334
288
//===----------------------------------------------------------------------===//
335
289
// PatFrags for global memory operations
336
290
//===----------------------------------------------------------------------===//
@@ -1003,7 +957,7 @@ def ExpSrc3 : RegisterOperand<VGPR_32> {
1003
957
1004
958
class SDWASrc<ValueType vt> : RegisterOperand<VS_32> {
1005
959
let OperandNamespace = "AMDGPU";
1006
- string Type = !if(isFloatType<vt>.ret , "FP", "INT");
960
+ string Type = !if(vt.isFP , "FP", "INT");
1007
961
let OperandType = "OPERAND_REG_INLINE_C_"#Type#vt.Size;
1008
962
let DecoderMethod = "decodeSDWASrc"#vt.Size;
1009
963
let EncoderMethod = "getSDWASrcEncoding";
@@ -1499,10 +1453,8 @@ class getSDWADstForVT<ValueType VT> {
1499
1453
// Returns the register class to use for source 0 of VOP[12C]
1500
1454
// instructions for the given VT.
1501
1455
class getVOPSrc0ForVT<ValueType VT, bit IsTrue16, bit IsFake16 = 1> {
1502
- bit isFP = isFloatType<VT>.ret;
1503
-
1504
1456
RegisterOperand ret =
1505
- !if(isFP,
1457
+ !if(VT. isFP,
1506
1458
!if(!eq(VT.Size, 64),
1507
1459
VSrc_f64,
1508
1460
!if(!or(!eq(VT.Value, f16.Value), !eq(VT.Value, bf16.Value)),
@@ -1562,21 +1514,19 @@ class getVregSrcForVT_t16<ValueType VT, bit IsFake16 = 1> {
1562
1514
}
1563
1515
1564
1516
class getSDWASrcForVT <ValueType VT> {
1565
- bit isFP = isFloatType<VT>.ret;
1566
1517
RegisterOperand retFlt = !if(!eq(VT.Size, 16), SDWASrc_f16, SDWASrc_f32);
1567
1518
RegisterOperand retInt = !if(!eq(VT.Size, 16), SDWASrc_i16, SDWASrc_i32);
1568
- RegisterOperand ret = !if(isFP, retFlt, retInt);
1519
+ RegisterOperand ret = !if(VT. isFP, retFlt, retInt);
1569
1520
}
1570
1521
1571
1522
// Returns the register class to use for sources of VOP3 instructions for the
1572
1523
// given VT.
1573
1524
class getVOP3SrcForVT<ValueType VT, bit IsTrue16 = 0> {
1574
- bit isFP = isFloatType<VT>.ret;
1575
1525
RegisterOperand ret =
1576
1526
!if(!eq(VT.Size, 128),
1577
1527
VRegSrc_128,
1578
1528
!if(!eq(VT.Size, 64),
1579
- !if(isFP,
1529
+ !if(VT. isFP,
1580
1530
!if(!eq(VT.Value, v2f32.Value),
1581
1531
VSrc_v2f32,
1582
1532
VSrc_f64),
@@ -1585,7 +1535,7 @@ class getVOP3SrcForVT<ValueType VT, bit IsTrue16 = 0> {
1585
1535
VSrc_b64)),
1586
1536
!if(!eq(VT.Value, i1.Value),
1587
1537
SSrc_i1,
1588
- !if(isFP,
1538
+ !if(VT. isFP,
1589
1539
!if(!or(!eq(VT.Value, f16.Value), !eq(VT.Value, bf16.Value)),
1590
1540
!if(IsTrue16, VSrcT_f16, VSrc_f16),
1591
1541
!if(!or(!eq(VT.Value, v2f16.Value), !eq(VT.Value, v2bf16.Value)),
@@ -1611,10 +1561,9 @@ class getVOP3SrcForVT<ValueType VT, bit IsTrue16 = 0> {
1611
1561
1612
1562
// Src2 of VOP3 DPP instructions cannot be a literal
1613
1563
class getVOP3DPPSrcForVT<ValueType VT> {
1614
- bit isFP = isFloatType<VT>.ret;
1615
1564
RegisterOperand ret =
1616
1565
!if (!eq(VT.Value, i1.Value), SSrc_i1,
1617
- !if (isFP,
1566
+ !if (VT. isFP,
1618
1567
!if (!or(!eq(VT.Value, f16.Value), !eq(VT.Value, bf16.Value)), VCSrc_f16,
1619
1568
!if (!or(!eq(VT.Value, v2f16.Value), !eq(VT.Value, v2bf16.Value)), VCSrc_v2f16, VCSrc_f32)),
1620
1569
!if (!eq(VT.Value, i16.Value), VCSrc_b16,
@@ -1650,14 +1599,12 @@ class isModifierType<ValueType SrcVT> {
1650
1599
1651
1600
// Return type of input modifiers operand for specified input operand
1652
1601
class getSrcMod <ValueType VT, bit IsTrue16 = 0> {
1653
- bit isFP = isFloatType<VT>.ret;
1654
- bit isPacked = isPackedType<VT>.ret;
1655
1602
Operand ret = !if(!eq(VT.Size, 64),
1656
- !if(isFP, FP64InputMods, Int64InputMods),
1603
+ !if(VT. isFP, FP64InputMods, Int64InputMods),
1657
1604
!if(!eq(VT.Size, 16),
1658
- !if(isFP, !if(IsTrue16, FPT16InputMods, FP16InputMods),
1659
- !if(IsTrue16, IntT16InputMods, IntOpSelMods)),
1660
- !if(isFP, FP32InputMods, Int32InputMods)));
1605
+ !if(VT. isFP, !if(IsTrue16, FPT16InputMods, FP16InputMods),
1606
+ !if(IsTrue16, IntT16InputMods, IntOpSelMods)),
1607
+ !if(VT. isFP, FP32InputMods, Int32InputMods)));
1661
1608
}
1662
1609
1663
1610
class getOpSelMod <ValueType VT> {
@@ -1667,14 +1614,12 @@ class getOpSelMod <ValueType VT> {
1667
1614
1668
1615
// Return type of input modifiers operand specified input operand for DPP
1669
1616
class getSrcModDPP <ValueType VT> {
1670
- bit isFP = isFloatType<VT>.ret;
1671
- Operand ret = !if(isFP, FPVRegInputMods, IntVRegInputMods);
1617
+ Operand ret = !if(VT.isFP, FPVRegInputMods, IntVRegInputMods);
1672
1618
}
1673
1619
1674
1620
class getSrcModDPP_t16 <ValueType VT> {
1675
- bit isFP = isFloatType<VT>.ret;
1676
1621
Operand ret =
1677
- !if (isFP,
1622
+ !if (VT. isFP,
1678
1623
!if (!or(!eq(VT.Value, f16.Value), !eq(VT.Value, bf16.Value)),
1679
1624
FPT16VRegInputMods, FPVRegInputMods),
1680
1625
!if (!eq(VT.Value, i16.Value), IntT16VRegInputMods,
@@ -1683,10 +1628,8 @@ class getSrcModDPP_t16 <ValueType VT> {
1683
1628
1684
1629
// Return type of input modifiers operand for specified input operand for DPP
1685
1630
class getSrcModVOP3DPP <ValueType VT> {
1686
- bit isFP = isFloatType<VT>.ret;
1687
- bit isPacked = isPackedType<VT>.ret;
1688
1631
Operand ret =
1689
- !if (isFP,
1632
+ !if (VT. isFP,
1690
1633
!if (!or(!eq(VT.Value, f16.Value), !eq(VT.Value, bf16.Value)),
1691
1634
FP16VCSrcInputMods, FP32VCSrcInputMods),
1692
1635
Int32VCSrcInputMods);
@@ -2330,26 +2273,26 @@ class VOPProfile <list<ValueType> _ArgVT, bit _EnableClamp = 0> {
2330
2273
field bit HasSrc1 = !ne(Src1VT.Value, untyped.Value);
2331
2274
field bit HasSrc2 = !ne(Src2VT.Value, untyped.Value);
2332
2275
2333
- field bit HasSrc0FloatMods = isFloatType< Src0VT>.ret ;
2334
- field bit HasSrc1FloatMods = isFloatType< Src1VT>.ret ;
2335
- field bit HasSrc2FloatMods = isFloatType< Src2VT>.ret ;
2276
+ field bit HasSrc0FloatMods = Src0VT.isFP ;
2277
+ field bit HasSrc1FloatMods = Src1VT.isFP ;
2278
+ field bit HasSrc2FloatMods = Src2VT.isFP ;
2336
2279
2337
2280
field bit HasSrc0IntMods = isIntType<Src0VT>.ret;
2338
2281
field bit HasSrc1IntMods = isIntType<Src1VT>.ret;
2339
2282
field bit HasSrc2IntMods = isIntType<Src2VT>.ret;
2340
2283
2341
2284
field bit HasClamp = !or(isModifierType<Src0VT>.ret, EnableClamp);
2342
2285
field bit HasSDWAClamp = EmitDst;
2343
- field bit HasFPClamp = !and(isFloatType< DstVT>.ret , HasClamp);
2344
- field bit HasIntClamp = !if(isFloatType< DstVT>.ret , 0, HasClamp);
2286
+ field bit HasFPClamp = !and(DstVT.isFP , HasClamp);
2287
+ field bit HasIntClamp = !if(DstVT.isFP , 0, HasClamp);
2345
2288
field bit HasClampLo = HasClamp;
2346
- field bit HasClampHi = !and(isPackedType< DstVT>.ret , HasClamp);
2289
+ field bit HasClampHi = !and(DstVT.isVector , HasClamp);
2347
2290
field bit HasHigh = 0;
2348
2291
2349
- field bit IsPacked = isPackedType< Src0VT>.ret ;
2292
+ field bit IsPacked = Src0VT.isVector ;
2350
2293
field bit HasOpSel = IsPacked;
2351
- field bit HasOMod = !if(IsVOP3P, 0, isFloatType< DstVT>.ret );
2352
- field bit HasSDWAOMod = isFloatType< DstVT>.ret ;
2294
+ field bit HasOMod = !if(IsVOP3P, 0, DstVT.isFP );
2295
+ field bit HasSDWAOMod = DstVT.isFP ;
2353
2296
2354
2297
field bit HasModifiers = !or(isModifierType<Src0VT>.ret,
2355
2298
isModifierType<Src1VT>.ret,
0 commit comments