Skip to content

Commit 6d746f3

Browse files
committed
fix comments
1 parent a9678cb commit 6d746f3

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
@@ -4389,8 +4389,6 @@ enum class TypeClass { VECTOR_OF_TWO, SCALAR, NONE_OF_LISTED };
43894389

43904390
static TypeClass isVectorOfTwoOrScalar(const MachineOperand *Op,
43914391
const MachineRegisterInfo &MRI) {
4392-
if (!Op->isReg() || Op->getReg().isPhysical())
4393-
return TypeClass::NONE_OF_LISTED;
43944392
LLT OpTy = MRI.getType(Op->getReg());
43954393
if (OpTy.isScalar())
43964394
return TypeClass::SCALAR;
@@ -4414,7 +4412,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
44144412
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
44154413
// [SrcHi, SrcLo] = [-OpHi, -OpLo]
44164414
return SrcStatus::IS_BOTH_NEG;
4417-
} else if (NegType == TypeClass::SCALAR) {
4415+
}
4416+
if (NegType == TypeClass::SCALAR) {
44184417
// Scalar:
44194418
// [SrcHi, SrcLo] = [CurrHi, CurrLo]
44204419
// [CurrHi, CurrLo] = neg [OpHi, OpLo](Type)
@@ -4431,7 +4430,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
44314430
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
44324431
// [SrcHi, SrcLo] = [-(-OpHi), -OpLo] = [OpHi, -OpLo]
44334432
return SrcStatus::IS_LO_NEG;
4434-
} else if (NegType == TypeClass::SCALAR) {
4433+
}
4434+
if (NegType == TypeClass::SCALAR) {
44354435
// Scalar:
44364436
// [SrcHi, SrcLo] = [-CurrHi, CurrLo]
44374437
// [CurrHi, CurrLo] = neg [OpHi, OpLo](Type)
@@ -4448,7 +4448,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
44484448
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
44494449
// [SrcHi, SrcLo] = [-OpHi, -(-OpLo)] = [-OpHi, OpLo]
44504450
return SrcStatus::IS_HI_NEG;
4451-
} else if (NegType == TypeClass::SCALAR) {
4451+
}
4452+
if (NegType == TypeClass::SCALAR) {
44524453
// Scalar:
44534454
// [SrcHi, SrcLo] = [CurrHi, -CurrLo]
44544455
// [CurrHi, CurrLo] = fneg [OpHi, OpLo](Type)
@@ -4465,7 +4466,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
44654466
// [CurrHi, CurrLo] = [-OpHi, -OpLo](2 x Type)
44664467
// [SrcHi, SrcLo] = [OpHi, OpLo]
44674468
return SrcStatus::IS_SAME;
4468-
} else if (NegType == TypeClass::SCALAR) {
4469+
}
4470+
if (NegType == TypeClass::SCALAR) {
44694471
// Scalar:
44704472
// [SrcHi, SrcLo] = [-CurrHi, -CurrLo]
44714473
// [CurrHi, CurrLo] = fneg [OpHi, OpLo](Type)
@@ -4498,7 +4500,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
44984500
// [CurrUpper, CurrLower] = [-OpUpper, -OpLower](2 x Type)
44994501
// Src = -OpLower
45004502
return SrcStatus::IS_LOWER_HALF_NEG;
4501-
} else if (NegType == TypeClass::SCALAR) {
4503+
}
4504+
if (NegType == TypeClass::SCALAR) {
45024505
// Scalar:
45034506
// Src = CurrLower
45044507
// Curr = [CurrUpper, CurrLower]
@@ -4532,7 +4535,8 @@ static SrcStatus getNegStatus(const MachineOperand *Op, SrcStatus S,
45324535
// [CurrUpper, CurrLower] = [-OpUpper, -OpLower](2 x Type)
45334536
// Src = -(-OpLower) = OpLower
45344537
return SrcStatus::IS_LOWER_HALF;
4535-
} else if (NegType == TypeClass::SCALAR) {
4538+
}
4539+
if (NegType == TypeClass::SCALAR) {
45364540
// Scalar:
45374541
// Src = -CurrLower
45384542
// Curr = [CurrUpper, CurrLower]
@@ -4561,9 +4565,10 @@ calcNextStatus(std::pair<const MachineOperand *, SrcStatus> Curr,
45614565

45624566
// Handle general Opc cases.
45634567
switch (Opc) {
4564-
case AMDGPU::G_BITCAST:
45654568
case AMDGPU::G_CONSTANT:
45664569
case AMDGPU::G_FCONSTANT:
4570+
return retOpStat(&MI->getOperand(1), Curr.second, Curr);
4571+
case AMDGPU::G_BITCAST:
45674572
case AMDGPU::COPY:
45684573
return retOpStat(&MI->getOperand(1), Curr.second, Curr);
45694574
case AMDGPU::G_FNEG:

0 commit comments

Comments
 (0)