[llvm] [AMDGPU] Add Wave Reduce Intrinsics for i32 type (PR #111342)

Pravin Jagtap via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 07:20:48 PDT 2024


================
@@ -4846,6 +4846,26 @@ static MachineBasicBlock *emitIndirectDst(MachineInstr &MI,
   return LoopBB;
 }
 
+static uint32_t getInitialValueForWaveReduction(unsigned Opc){
+  switch(Opc){
+      case AMDGPU::S_MIN_U32:
+        return std::numeric_limits<uint32_t>::max();
+      case AMDGPU::S_MIN_I32:
+        return std::numeric_limits<int32_t>::max();
+      case AMDGPU::S_MAX_U32:
+        return 0;
+      case AMDGPU::S_MAX_I32:
+        return std::numeric_limits<int32_t>::min();
+      case AMDGPU::S_ADD_I32:
+      case AMDGPU::S_SUB_I32:
+      case AMDGPU::S_OR_B32:
+      case AMDGPU::S_XOR_B32:
+        return 0x00000000;
----------------
pravinjagtap wrote:

Literal values are not consistent form here (0, 0x00000000, 0xFFFFFFFF). Can we not query this using std::numeric_limits here also?

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


More information about the llvm-commits mailing list