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

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 19 11:04:56 PST 2024


================
@@ -1949,6 +1952,23 @@ bool SPIRVInstructionSelector::selectSign(Register ResVReg,
   return Result;
 }
 
+bool SPIRVInstructionSelector::selectWaveActiveAnyTrue(Register ResVReg,
+                                                       const SPIRVType *ResType,
+                                                       MachineInstr &I) const {
+  assert(I.getNumOperands() == 3);
+  assert(I.getOperand(2).isReg());
+
+  MachineBasicBlock &BB = *I.getParent();
+  SPIRVType *IntTy = GR.getOrCreateSPIRVIntegerType(32, I, TII);
+
+  return BuildMI(BB, I, I.getDebugLoc(), TII.get(SPIRV::OpGroupNonUniformAny))
----------------
farzonl wrote:

I'm looking at `selectWaveReadLaneAt` and they share a lot of code. Maybe we should look to do a more general selection emitter like for spirv opcodes the way that `selectExtInst` does it for opencl or opengl  extension opcodes?

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


More information about the cfe-commits mailing list