diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp index eb781cbd1c8da..441fb5730a6d8 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp @@ -3567,7 +3567,8 @@ bool AMDGPUInstructionSelector::selectGlobalLoadLds(MachineInstr &MI) const{ return constrainSelectedInstRegOperands(*MIB, TII, TRI, RBI); } -bool AMDGPUInstructionSelector::selectBVHIntrinsic(MachineInstr &MI) const{ +bool AMDGPUInstructionSelector::selectBVHIntersectRayIntrinsic( + MachineInstr &MI) const { MI.setDesc(TII.get(MI.getOperand(1).getImm())); MI.removeOperand(1); MI.addImplicitDefUseOperands(*MI.getParent()->getParent()); @@ -4085,8 +4086,8 @@ bool AMDGPUInstructionSelector::select(MachineInstr &I) { assert(Intr && "not an image intrinsic with image pseudo"); return selectImageIntrinsic(I, Intr); } - case AMDGPU::G_AMDGPU_INTRIN_BVH_INTERSECT_RAY: - return selectBVHIntrinsic(I); + case AMDGPU::G_AMDGPU_BVH_INTERSECT_RAY: + return selectBVHIntersectRayIntrinsic(I); case AMDGPU::G_SBFX: case AMDGPU::G_UBFX: return selectG_SBFX_UBFX(I); diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h index e006d5140848f..cc7552868a056 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h @@ -146,7 +146,7 @@ class AMDGPUInstructionSelector final : public InstructionSelector { bool selectG_INSERT_VECTOR_ELT(MachineInstr &I) const; bool selectBufferLoadLds(MachineInstr &MI) const; bool selectGlobalLoadLds(MachineInstr &MI) const; - bool selectBVHIntrinsic(MachineInstr &I) const; + bool selectBVHIntersectRayIntrinsic(MachineInstr &I) const; bool selectSMFMACIntrin(MachineInstr &I) const; bool selectPermlaneSwapIntrin(MachineInstr &I, Intrinsic::ID IntrID) const; bool selectWaveAddress(MachineInstr &I) const; diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp index 664b181153340..b3a8183beeacf 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp @@ -7030,8 +7030,8 @@ bool AMDGPULegalizerInfo::legalizeDebugTrap(MachineInstr &MI, return true; } -bool AMDGPULegalizerInfo::legalizeBVHIntrinsic(MachineInstr &MI, - MachineIRBuilder &B) const { +bool AMDGPULegalizerInfo::legalizeBVHIntersectRayIntrinsic( + MachineInstr &MI, MachineIRBuilder &B) const { MachineRegisterInfo &MRI = *B.getMRI(); const LLT S16 = LLT::scalar(16); const LLT S32 = LLT::scalar(32); @@ -7167,9 +7167,9 @@ bool AMDGPULegalizerInfo::legalizeBVHIntrinsic(MachineInstr &MI, Ops.push_back(MergedOps); } - auto MIB = B.buildInstr(AMDGPU::G_AMDGPU_INTRIN_BVH_INTERSECT_RAY) - .addDef(DstReg) - .addImm(Opcode); + auto MIB = B.buildInstr(AMDGPU::G_AMDGPU_BVH_INTERSECT_RAY) + .addDef(DstReg) + .addImm(Opcode); for (Register R : Ops) { MIB.addUse(R); @@ -7530,7 +7530,7 @@ bool AMDGPULegalizerInfo::legalizeIntrinsic(LegalizerHelper &Helper, case Intrinsic::amdgcn_rsq_clamp: return legalizeRsqClampIntrinsic(MI, MRI, B); case Intrinsic::amdgcn_image_bvh_intersect_ray: - return legalizeBVHIntrinsic(MI, B); + return legalizeBVHIntersectRayIntrinsic(MI, B); case Intrinsic::amdgcn_swmmac_f16_16x16x32_f16: case Intrinsic::amdgcn_swmmac_bf16_16x16x32_bf16: case Intrinsic::amdgcn_swmmac_f32_16x16x32_bf16: diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.h b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.h index 03b7c36fc450f..a98e8ba7aaaf1 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.h +++ b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.h @@ -205,6 +205,9 @@ class AMDGPULegalizerInfo final : public LegalizerInfo { bool legalizeBufferAtomic(MachineInstr &MI, MachineIRBuilder &B, Intrinsic::ID IID) const; + bool legalizeBVHIntersectRayIntrinsic(MachineInstr &MI, + MachineIRBuilder &B) const; + bool legalizeLaneOp(LegalizerHelper &Helper, MachineInstr &MI, Intrinsic::ID IID) const; diff --git a/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp index d79200c319b65..efe92e0fecc12 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp @@ -3217,7 +3217,7 @@ void AMDGPURegisterBankInfo::applyMappingImpl( applyMappingImage(B, MI, OpdMapper, RSrcIntrin->RsrcArg); return; } - case AMDGPU::G_AMDGPU_INTRIN_BVH_INTERSECT_RAY: { + case AMDGPU::G_AMDGPU_BVH_INTERSECT_RAY: { unsigned N = MI.getNumExplicitOperands() - 2; applyDefaultMapping(OpdMapper); executeInWaterfallLoop(B, MI, {N}); @@ -5010,7 +5010,7 @@ AMDGPURegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { assert(RSrcIntrin->IsImage); return getImageMapping(MRI, MI, RSrcIntrin->RsrcArg); } - case AMDGPU::G_AMDGPU_INTRIN_BVH_INTERSECT_RAY: { + 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); diff --git a/llvm/lib/Target/AMDGPU/SIInstructions.td b/llvm/lib/Target/AMDGPU/SIInstructions.td index 63f66023837a2..cd5d3e3d31ab4 100644 --- a/llvm/lib/Target/AMDGPU/SIInstructions.td +++ b/llvm/lib/Target/AMDGPU/SIInstructions.td @@ -4341,7 +4341,7 @@ def G_AMDGPU_INTRIN_IMAGE_STORE_D16 : AMDGPUGenericInstruction { let mayStore = 1; } -def G_AMDGPU_INTRIN_BVH_INTERSECT_RAY : AMDGPUGenericInstruction { +def G_AMDGPU_BVH_INTERSECT_RAY : AMDGPUGenericInstruction { let OutOperandList = (outs type0:$dst); let InOperandList = (ins unknown:$intrin, variable_ops); let hasSideEffects = 0;