@@ -3220,13 +3220,13 @@ bool SPIRVInstructionSelector::selectFirstBitSet64Overflow(
3220
3220
Register ResVReg, const SPIRVType *ResType, MachineInstr &I,
3221
3221
Register SrcReg, unsigned BitSetOpcode, bool SwapPrimarySide) const {
3222
3222
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.
3226
3227
unsigned ComponentCount = GR.getScalarOrVectorComponentCount (ResType);
3227
3228
assert (ComponentCount < 5 && " Vec 5+ will generate invalid SPIR-V ops" );
3228
3229
3229
- bool ZeroAsNull = STI.isOpenCLEnv ();
3230
3230
MachineIRBuilder MIRBuilder (I);
3231
3231
SPIRVType *BaseType = GR.retrieveScalarOrVectorIntType (ResType);
3232
3232
SPIRVType *I64Type = GR.getOrCreateSPIRVIntegerType (64 , MIRBuilder);
@@ -3249,11 +3249,9 @@ bool SPIRVInstructionSelector::selectFirstBitSet64Overflow(
3249
3249
.addDef (BitSetResult)
3250
3250
.addUse (GR.getSPIRVTypeID (I64x2Type))
3251
3251
.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 );
3257
3255
3258
3256
if (!MIB.constrainAllUses (TII, TRI, RBI))
3259
3257
return false ;
@@ -3270,6 +3268,7 @@ bool SPIRVInstructionSelector::selectFirstBitSet64Overflow(
3270
3268
3271
3269
// On odd component counts we need to handle one more component
3272
3270
if (CurrentComponent != ComponentCount) {
3271
+ bool ZeroAsNull = STI.isOpenCLEnv ();
3273
3272
Register FinalElemReg = MRI->createVirtualRegister (GR.getRegClass (I64Type));
3274
3273
Register ConstIntLastIdx = GR.getOrCreateConstInt (
3275
3274
ComponentCount - 1 , I, BaseType, TII, ZeroAsNull);
0 commit comments