@@ -1509,17 +1509,18 @@ multiclass MIMG_Gather <mimgopc op, AMDGPUSampleVariant sample, bit wqm = 0,
15091509multiclass MIMG_Gather_WQM <mimgopc op, AMDGPUSampleVariant sample>
15101510 : MIMG_Gather<op, sample, 1>;
15111511
1512- class MIMG_IntersectRay_Helper<bit Is64, bit IsA16> {
1512+ class MIMG_IntersectRay_Helper<bit Is64, bit IsA16, bit isDual > {
15131513 int num_addrs = !if(Is64, !if(IsA16, 9, 12), !if(IsA16, 8, 11));
15141514 RegisterClass RegClass = MIMGAddrSize<num_addrs, 0>.RegClass;
15151515 int VAddrDwords = !srl(RegClass.Size, 5);
15161516
15171517 int GFX11PlusNSAAddrs = !if(IsA16, 4, 5);
15181518 RegisterClass node_ptr_type = !if(Is64, VReg_64, VGPR_32);
15191519 list<RegisterClass> GFX11PlusAddrTypes =
1520- !if(IsA16,
1520+ !if(isDual, [VReg_64, VReg_64, VReg_96, VReg_96, VReg_64],
1521+ !if(IsA16,
15211522 [node_ptr_type, VGPR_32, VReg_96, VReg_96],
1522- [node_ptr_type, VGPR_32, VReg_96, VReg_96, VReg_96]);
1523+ [node_ptr_type, VGPR_32, VReg_96, VReg_96, VReg_96])) ;
15231524}
15241525
15251526class MIMG_IntersectRay_gfx10<mimgopc op, string opcode, RegisterClass AddrRC>
@@ -1553,15 +1554,26 @@ class MIMG_IntersectRay_nsa_gfx11<mimgopc op, string opcode, int num_addrs,
15531554}
15541555
15551556class VIMAGE_IntersectRay_gfx12<mimgopc op, string opcode, int num_addrs,
1557+ bit isDual,
15561558 list<RegisterClass> addr_types>
1557- : VIMAGE_gfx12<op.GFX12, (outs VReg_128:$vdata),
1559+ : VIMAGE_gfx12<op.GFX12, !if(isDual,
1560+ (outs VReg_320:$vdata, VReg_96:$ray_origin_out,
1561+ VReg_96:$ray_dir_out),
1562+ (outs VReg_128:$vdata)),
15581563 num_addrs, "GFX12", addr_types> {
1559- let InOperandList = !con(nsah.AddrIns, (ins SReg_128_XNULL:$rsrc, A16:$a16));
1560- let AsmString = opcode#" $vdata, "#nsah.AddrAsm#", $rsrc$a16";
1561- }
1562-
1563- multiclass MIMG_IntersectRay<mimgopc op, string opcode, bit Is64, bit IsA16> {
1564- defvar info = MIMG_IntersectRay_Helper<Is64, IsA16>;
1564+ let Constraints = !if(isDual,
1565+ "$ray_origin_out = $vaddr2, $ray_dir_out = $vaddr3", "");
1566+ let InOperandList = !con(nsah.AddrIns, (ins SReg_128_XNULL:$rsrc),
1567+ !if(isDual, (ins), (ins A16:$a16)));
1568+ let AsmString = opcode#" $vdata, "#nsah.AddrAsm#", $rsrc"#
1569+ !if(isDual, "", "$a16");
1570+ let SchedRW = !if(isDual,
1571+ [WriteVMEM, WriteVMEM, WriteVMEM], [WriteVMEM]);
1572+ }
1573+
1574+ multiclass MIMG_IntersectRay<mimgopc op, string opcode, bit Is64, bit IsA16,
1575+ bit isDual> {
1576+ defvar info = MIMG_IntersectRay_Helper<Is64, IsA16, isDual>;
15651577 def "" : MIMGBaseOpcode {
15661578 let BVH = 1;
15671579 let A16 = IsA16;
@@ -1599,7 +1611,8 @@ multiclass MIMG_IntersectRay<mimgopc op, string opcode, bit Is64, bit IsA16> {
15991611 }
16001612 }
16011613 def _gfx12 : VIMAGE_IntersectRay_gfx12<op, opcode, info.GFX11PlusNSAAddrs,
1602- info.GFX11PlusAddrTypes> {
1614+ isDual, info.GFX11PlusAddrTypes> {
1615+ let VDataDwords = !if(isDual, 10, 4);
16031616 let VAddrDwords = info.num_addrs;
16041617 }
16051618 }
@@ -1771,15 +1784,18 @@ defm IMAGE_MSAA_LOAD_X : MIMG_NoSampler <mimgopc<MIMG.NOP, MIMG.NOP, 0x80>, "ima
17711784let OtherPredicates = [HasImageInsts, HasGFX10_AEncoding] in {
17721785defm IMAGE_MSAA_LOAD : MIMG_MSAA_Load <mimgopc<0x18, 0x18, MIMG.NOP>, "image_msaa_load">;
17731786
1774- defm IMAGE_BVH_INTERSECT_RAY : MIMG_IntersectRay<mimgopc<0x19, 0x19, 0xe6>, "image_bvh_intersect_ray", 0, 0>;
1775- defm IMAGE_BVH_INTERSECT_RAY_a16 : MIMG_IntersectRay<mimgopc<0x19, 0x19, 0xe6>, "image_bvh_intersect_ray", 0, 1>;
1776- defm IMAGE_BVH64_INTERSECT_RAY : MIMG_IntersectRay<mimgopc<0x1a, 0x1a, 0xe7>, "image_bvh64_intersect_ray", 1, 0>;
1777- defm IMAGE_BVH64_INTERSECT_RAY_a16 : MIMG_IntersectRay<mimgopc<0x1a, 0x1a, 0xe7>, "image_bvh64_intersect_ray", 1, 1>;
1787+ defm IMAGE_BVH_INTERSECT_RAY : MIMG_IntersectRay<mimgopc<0x19, 0x19, 0xe6>, "image_bvh_intersect_ray", 0, 0, 0 >;
1788+ defm IMAGE_BVH_INTERSECT_RAY_a16 : MIMG_IntersectRay<mimgopc<0x19, 0x19, 0xe6>, "image_bvh_intersect_ray", 0, 1, 0 >;
1789+ defm IMAGE_BVH64_INTERSECT_RAY : MIMG_IntersectRay<mimgopc<0x1a, 0x1a, 0xe7>, "image_bvh64_intersect_ray", 1, 0, 0 >;
1790+ defm IMAGE_BVH64_INTERSECT_RAY_a16 : MIMG_IntersectRay<mimgopc<0x1a, 0x1a, 0xe7>, "image_bvh64_intersect_ray", 1, 1, 0 >;
17781791} // End OtherPredicates = [HasImageInsts, HasGFX10_AEncoding]
17791792
1793+ defm IMAGE_BVH_DUAL_INTERSECT_RAY : MIMG_IntersectRay<mimgopc<0x80, MIMG.NOP, MIMG.NOP>, "image_bvh_dual_intersect_ray", 1, 0, 1>;
1794+
17801795let SubtargetPredicate = isGFX12Plus in {
17811796 def : AMDGPUMnemonicAlias<"bvh_intersect_ray", "image_bvh_intersect_ray">;
17821797 def : AMDGPUMnemonicAlias<"bvh64_intersect_ray", "image_bvh64_intersect_ray">;
1798+ def : AMDGPUMnemonicAlias<"bvh_dual_intersect_ray", "image_bvh_dual_intersect_ray">;
17831799}
17841800
17851801} // End let OtherPredicates = [HasImageInsts]
0 commit comments