@@ -4389,8 +4389,6 @@ enum class TypeClass { VECTOR_OF_TWO, SCALAR, NONE_OF_LISTED };
4389
4389
4390
4390
static TypeClass isVectorOfTwoOrScalar (const MachineOperand *Op,
4391
4391
const MachineRegisterInfo &MRI) {
4392
- if (!Op->isReg () || Op->getReg ().isPhysical ())
4393
- return TypeClass::NONE_OF_LISTED;
4394
4392
LLT OpTy = MRI.getType (Op->getReg ());
4395
4393
if (OpTy.isScalar ())
4396
4394
return TypeClass::SCALAR;
@@ -4414,7 +4412,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
4414
4412
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
4415
4413
// [SrcHi, SrcLo] = [-OpHi, -OpLo]
4416
4414
return SrcStatus::IS_BOTH_NEG;
4417
- } else if (NegType == TypeClass::SCALAR) {
4415
+ }
4416
+ if (NegType == TypeClass::SCALAR) {
4418
4417
// Scalar:
4419
4418
// [SrcHi, SrcLo] = [CurrHi, CurrLo]
4420
4419
// [CurrHi, CurrLo] = neg [OpHi, OpLo](Type)
@@ -4431,7 +4430,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
4431
4430
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
4432
4431
// [SrcHi, SrcLo] = [-(-OpHi), -OpLo] = [OpHi, -OpLo]
4433
4432
return SrcStatus::IS_LO_NEG;
4434
- } else if (NegType == TypeClass::SCALAR) {
4433
+ }
4434
+ if (NegType == TypeClass::SCALAR) {
4435
4435
// Scalar:
4436
4436
// [SrcHi, SrcLo] = [-CurrHi, CurrLo]
4437
4437
// [CurrHi, CurrLo] = neg [OpHi, OpLo](Type)
@@ -4448,7 +4448,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
4448
4448
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
4449
4449
// [SrcHi, SrcLo] = [-OpHi, -(-OpLo)] = [-OpHi, OpLo]
4450
4450
return SrcStatus::IS_HI_NEG;
4451
- } else if (NegType == TypeClass::SCALAR) {
4451
+ }
4452
+ if (NegType == TypeClass::SCALAR) {
4452
4453
// Scalar:
4453
4454
// [SrcHi, SrcLo] = [CurrHi, -CurrLo]
4454
4455
// [CurrHi, CurrLo] = fneg [OpHi, OpLo](Type)
@@ -4465,7 +4466,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
4465
4466
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
4466
4467
// [SrcHi, SrcLo] = [OpHi, OpLo]
4467
4468
return SrcStatus::IS_SAME;
4468
- } else if (NegType == TypeClass::SCALAR) {
4469
+ }
4470
+ if (NegType == TypeClass::SCALAR) {
4469
4471
// Scalar:
4470
4472
// [SrcHi, SrcLo] = [-CurrHi, -CurrLo]
4471
4473
// [CurrHi, CurrLo] = fneg [OpHi, OpLo](Type)
@@ -4498,7 +4500,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
4498
4500
// [CurrUpper, CurrLower] = [-OpUpper, -OpLower](2 x Type)
4499
4501
// Src = -OpLower
4500
4502
return SrcStatus::IS_LOWER_HALF_NEG;
4501
- } else if (NegType == TypeClass::SCALAR) {
4503
+ }
4504
+ if (NegType == TypeClass::SCALAR) {
4502
4505
// Scalar:
4503
4506
// Src = CurrLower
4504
4507
// Curr = [CurrUpper, CurrLower]
@@ -4532,7 +4535,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
4532
4535
// [CurrUpper, CurrLower] = [-OpUpper, -OpLower](2 x Type)
4533
4536
// Src = -(-OpLower) = OpLower
4534
4537
return SrcStatus::IS_LOWER_HALF;
4535
- } else if (NegType == TypeClass::SCALAR) {
4538
+ }
4539
+ if (NegType == TypeClass::SCALAR) {
4536
4540
// Scalar:
4537
4541
// Src = -CurrLower
4538
4542
// Curr = [CurrUpper, CurrLower]
@@ -4561,9 +4565,10 @@ calcNextStatus(std::pair<const MachineOperand *, SrcStatus> Curr,
4561
4565
4562
4566
// Handle general Opc cases.
4563
4567
switch (Opc) {
4564
- case AMDGPU::G_BITCAST:
4565
4568
case AMDGPU::G_CONSTANT:
4566
4569
case AMDGPU::G_FCONSTANT:
4570
+ return retOpStat (&MI->getOperand (1 ), Curr.second , Curr);
4571
+ case AMDGPU::G_BITCAST:
4567
4572
case AMDGPU::COPY:
4568
4573
return retOpStat (&MI->getOperand (1 ), Curr.second , Curr);
4569
4574
case AMDGPU::G_FNEG:
0 commit comments