Skip to content

Commit c1b7fad

Browse files
committed
Address comments
1 parent 2c0e216 commit c1b7fad

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,13 +3220,13 @@ bool SPIRVInstructionSelector::selectFirstBitSet64Overflow(
32203220
Register ResVReg, const SPIRVType *ResType, MachineInstr &I,
32213221
Register SrcReg, unsigned BitSetOpcode, bool SwapPrimarySide) const {
32223222

3223-
// SPIR-V allow vectors of size 2,3,4 only. Calling with a larger vectors requires
3224-
// creating a param register and return register with an invalid vector size. If that is
3225-
// resolved, then this function can be used for vectors of any component size.
3223+
// SPIR-V allow vectors of size 2,3,4 only. Calling with a larger vectors
3224+
// requires creating a param register and return register with an invalid
3225+
// vector size. If that is resolved, then this function can be used for
3226+
// vectors of any component size.
32263227
unsigned ComponentCount = GR.getScalarOrVectorComponentCount(ResType);
32273228
assert(ComponentCount < 5 && "Vec 5+ will generate invalid SPIR-V ops");
32283229

3229-
bool ZeroAsNull = STI.isOpenCLEnv();
32303230
MachineIRBuilder MIRBuilder(I);
32313231
SPIRVType *BaseType = GR.retrieveScalarOrVectorIntType(ResType);
32323232
SPIRVType *I64Type = GR.getOrCreateSPIRVIntegerType(64, MIRBuilder);
@@ -3249,11 +3249,9 @@ bool SPIRVInstructionSelector::selectFirstBitSet64Overflow(
32493249
.addDef(BitSetResult)
32503250
.addUse(GR.getSPIRVTypeID(I64x2Type))
32513251
.addUse(SrcReg)
3252-
// Per the spec, repeat the vector if only one vec is needed
3253-
.addUse(SrcReg);
3254-
3255-
MIB.addImm(CurrentComponent);
3256-
MIB.addImm(CurrentComponent + 1);
3252+
.addUse(SrcReg)
3253+
.addImm(CurrentComponent)
3254+
.addImm(CurrentComponent + 1);
32573255

32583256
if (!MIB.constrainAllUses(TII, TRI, RBI))
32593257
return false;
@@ -3270,6 +3268,7 @@ bool SPIRVInstructionSelector::selectFirstBitSet64Overflow(
32703268

32713269
// On odd component counts we need to handle one more component
32723270
if (CurrentComponent != ComponentCount) {
3271+
bool ZeroAsNull = STI.isOpenCLEnv();
32733272
Register FinalElemReg = MRI->createVirtualRegister(GR.getRegClass(I64Type));
32743273
Register ConstIntLastIdx = GR.getOrCreateConstInt(
32753274
ComponentCount - 1, I, BaseType, TII, ZeroAsNull);

0 commit comments

Comments
 (0)