Skip to content

Commit 06e273a

Browse files
committed
fix comments
1 parent ddbf86b commit 06e273a

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4394,8 +4394,6 @@ enum class TypeClass { VECTOR_OF_TWO, SCALAR, NONE_OF_LISTED };
43944394

43954395
static TypeClass isVectorOfTwoOrScalar(const MachineOperand *Op,
43964396
const MachineRegisterInfo &MRI) {
4397-
if (!Op->isReg() || Op->getReg().isPhysical())
4398-
return TypeClass::NONE_OF_LISTED;
43994397
LLT OpTy = MRI.getType(Op->getReg());
44004398
if (OpTy.isScalar())
44014399
return TypeClass::SCALAR;
@@ -4419,7 +4417,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
44194417
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
44204418
// [SrcHi, SrcLo] = [-OpHi, -OpLo]
44214419
return SrcStatus::IS_BOTH_NEG;
4422-
} else if (NegType == TypeClass::SCALAR) {
4420+
}
4421+
if (NegType == TypeClass::SCALAR) {
44234422
// Scalar:
44244423
// [SrcHi, SrcLo] = [CurrHi, CurrLo]
44254424
// [CurrHi, CurrLo] = neg [OpHi, OpLo](Type)
@@ -4436,7 +4435,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
44364435
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
44374436
// [SrcHi, SrcLo] = [-(-OpHi), -OpLo] = [OpHi, -OpLo]
44384437
return SrcStatus::IS_LO_NEG;
4439-
} else if (NegType == TypeClass::SCALAR) {
4438+
}
4439+
if (NegType == TypeClass::SCALAR) {
44404440
// Scalar:
44414441
// [SrcHi, SrcLo] = [-CurrHi, CurrLo]
44424442
// [CurrHi, CurrLo] = neg [OpHi, OpLo](Type)
@@ -4453,7 +4453,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
44534453
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
44544454
// [SrcHi, SrcLo] = [-OpHi, -(-OpLo)] = [-OpHi, OpLo]
44554455
return SrcStatus::IS_HI_NEG;
4456-
} else if (NegType == TypeClass::SCALAR) {
4456+
}
4457+
if (NegType == TypeClass::SCALAR) {
44574458
// Scalar:
44584459
// [SrcHi, SrcLo] = [CurrHi, -CurrLo]
44594460
// [CurrHi, CurrLo] = fneg [OpHi, OpLo](Type)
@@ -4470,7 +4471,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
44704471
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
44714472
// [SrcHi, SrcLo] = [OpHi, OpLo]
44724473
return SrcStatus::IS_SAME;
4473-
} else if (NegType == TypeClass::SCALAR) {
4474+
}
4475+
if (NegType == TypeClass::SCALAR) {
44744476
// Scalar:
44754477
// [SrcHi, SrcLo] = [-CurrHi, -CurrLo]
44764478
// [CurrHi, CurrLo] = fneg [OpHi, OpLo](Type)
@@ -4503,7 +4505,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
45034505
// [CurrUpper, CurrLower] = [-OpUpper, -OpLower](2 x Type)
45044506
// Src = -OpLower
45054507
return SrcStatus::IS_LOWER_HALF_NEG;
4506-
} else if (NegType == TypeClass::SCALAR) {
4508+
}
4509+
if (NegType == TypeClass::SCALAR) {
45074510
// Scalar:
45084511
// Src = CurrLower
45094512
// Curr = [CurrUpper, CurrLower]
@@ -4537,7 +4540,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
45374540
// [CurrUpper, CurrLower] = [-OpUpper, -OpLower](2 x Type)
45384541
// Src = -(-OpLower) = OpLower
45394542
return SrcStatus::IS_LOWER_HALF;
4540-
} else if (NegType == TypeClass::SCALAR) {
4543+
}
4544+
if (NegType == TypeClass::SCALAR) {
45414545
// Scalar:
45424546
// Src = -CurrLower
45434547
// Curr = [CurrUpper, CurrLower]
@@ -4566,9 +4570,10 @@ calcNextStatus(std::pair<const MachineOperand *, SrcStatus> Curr,
45664570

45674571
// Handle general Opc cases.
45684572
switch (Opc) {
4569-
case AMDGPU::G_BITCAST:
45704573
case AMDGPU::G_CONSTANT:
45714574
case AMDGPU::G_FCONSTANT:
4575+
return retOpStat(&MI->getOperand(1), Curr.second, Curr);
4576+
case AMDGPU::G_BITCAST:
45724577
case AMDGPU::COPY:
45734578
return retOpStat(&MI->getOperand(1), Curr.second, Curr);
45744579
case AMDGPU::G_FNEG:

0 commit comments

Comments
 (0)