[llvm] [AMDGPU] Add intrinsic and MI for image_bvh_dual_intersect_ray (PR #130038)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 7 07:58:20 PST 2025


================
@@ -5010,19 +5013,33 @@ AMDGPURegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
     assert(RSrcIntrin->IsImage);
     return getImageMapping(MRI, MI, RSrcIntrin->RsrcArg);
   }
-  case AMDGPU::G_AMDGPU_BVH_INTERSECT_RAY: {
-    unsigned N = MI.getNumExplicitOperands() - 2;
-    OpdsMapping[0] = AMDGPU::getValueMapping(AMDGPU::VGPRRegBankID, 128);
-    OpdsMapping[N] = getSGPROpMapping(MI.getOperand(N).getReg(), MRI, *TRI);
-    if (N == 3) {
+  case AMDGPU::G_AMDGPU_BVH_INTERSECT_RAY:
+  case AMDGPU::G_AMDGPU_BVH_DUAL_INTERSECT_RAY: {
+    bool IsDual = MI.getOpcode() == AMDGPU::G_AMDGPU_BVH_DUAL_INTERSECT_RAY;
+    unsigned NumMods = !IsDual ? 1 : 0; // Has A16 modifier
+    unsigned LastRegOpIdx = (MI.getNumExplicitOperands() - 1) - NumMods;
----------------
jayfoad wrote:

```suggestion
    unsigned NumMods = IsDual ? 0 : 1; // Has A16 modifier
    unsigned LastRegOpIdx = MI.getNumExplicitOperands() - 1 - NumMods;
```

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


More information about the llvm-commits mailing list