[clang] [llvm] [HLSL] Implement WaveActiveAnyTrue intrinsic (PR #115902)

Steven Perron via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 06:37:44 PST 2024


================
@@ -1949,24 +1949,36 @@ bool SPIRVInstructionSelector::selectSign(Register ResVReg,
   return Result;
 }
 
+bool SPIRVInstructionSelector::selectWaveOpInst(Register ResVReg,
+                                                const SPIRVType *ResType,
+                                                MachineInstr &I,
+                                                unsigned Opcode) const {
+  MachineBasicBlock &BB = *I.getParent();
+  SPIRVType *IntTy = GR.getOrCreateSPIRVIntegerType(32, I, TII);
+
+  auto BMI = BuildMI(BB, I, I.getDebugLoc(), TII.get(Opcode))
+                 .addDef(ResVReg)
+                 .addUse(GR.getSPIRVTypeID(ResType))
+                 .addUse(GR.getOrCreateConstInt(SPIRV::Scope::Subgroup, I,
+                                                IntTy, TII));
+
+  for (unsigned j = 2; j < I.getNumOperands(); j++) {
----------------
s-perron wrote:

I don't know for sure, but I believe the variable name should be upper case.

```suggestion
  for (unsigned J = 2; J < I.getNumOperands(); J++) {
```

https://github.com/llvm/llvm-project/pull/115902


More information about the cfe-commits mailing list