[llvm] [AMDGPU] Add wave reduce intrinsics for float types - 2 (PR #168859)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 10:57:48 PST 2025


================
@@ -5480,6 +5480,13 @@ static uint32_t getIdentityValueFor32BitWaveReduction(unsigned Opc) {
     return std::numeric_limits<uint32_t>::min();
   case AMDGPU::S_MAX_I32:
     return std::numeric_limits<int32_t>::min();
+  case AMDGPU::V_ADD_F32_e64:   // -0.0
+  case AMDGPU::V_SUB_F32_e64: { // +0.0
+    float AsFloat = Opc == AMDGPU::V_ADD_F32_e64 ? -0.0f : +0.0f;
+    uint32_t AsInt;
+    memcpy(&AsInt, &AsFloat, sizeof(AsInt));
+    return AsInt;
----------------
arsenm wrote:

```suggestion
    return Opc == AMDGPU::V_ADD_F32_e64 ? 0x80000000 : 0x0;
```

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


More information about the llvm-commits mailing list