; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx1200 < %s | FileCheck -check-prefixes=GFX12-SDAG %s ; RUN: llc -global-isel=1 -new-reg-bank-select -mtriple=amdgcn -mcpu=gfx1200 < %s | FileCheck -check-prefixes=GFX12-GISEL %s declare {<10 x i32>, <3 x float>, <3 x float>} @llvm.amdgcn.image.bvh8.intersect.ray(i64, float, i8, <3 x float>, <3 x float>, i32, <4 x i32>) define amdgpu_ps <10 x float> @image_bvh8_intersect_ray(i64 %node_ptr, float %ray_extent, float %ray_origin_x, float %ray_origin_y, float %ray_origin_z, float %ray_dir_x, float %ray_dir_y, float %ray_dir_z, i32 %offset, <4 x i32> inreg %tdescr, ptr addrspace(1) %origin, ptr addrspace(1) %dir) { ; GFX12-SDAG-LABEL: image_bvh8_intersect_ray: ; GFX12-SDAG: ; %bb.0: ; %main_body ; GFX12-SDAG-NEXT: v_dual_mov_b32 v21, v8 :: v_dual_mov_b32 v20, v7 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v19, v6 :: v_dual_mov_b32 v18, v5 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v17, v4 :: v_dual_mov_b32 v16, v3 ; GFX12-SDAG-NEXT: v_mov_b32_e32 v3, 0 ; GFX12-SDAG-NEXT: image_bvh8_intersect_ray v[0:9], [v[0:1], v[2:3], v[16:18], v[19:21], v9], s[0:3] ; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0 ; GFX12-SDAG-NEXT: global_store_b96 v[10:11], v[16:18], off ; GFX12-SDAG-NEXT: global_store_b96 v[12:13], v[19:21], off ; GFX12-SDAG-NEXT: ; return to shader part epilog ; ; GFX12-GISEL-LABEL: image_bvh8_intersect_ray: ; GFX12-GISEL: ; %bb.0: ; %main_body ; GFX12-GISEL-NEXT: v_dual_mov_b32 v14, v3 :: v_dual_mov_b32 v15, v4 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v16, v5 :: v_dual_mov_b32 v17, v6 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v18, v7 :: v_dual_mov_b32 v19, v8 ; GFX12-GISEL-NEXT: v_mov_b32_e32 v3, 0 ; GFX12-GISEL-NEXT: image_bvh8_intersect_ray v[0:9], [v[0:1], v[2:3], v[14:16], v[17:19], v9], s[0:3] ; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0 ; GFX12-GISEL-NEXT: global_store_b96 v[10:11], v[14:16], off ; GFX12-GISEL-NEXT: global_store_b96 v[12:13], v[17:19], off ; GFX12-GISEL-NEXT: ; return to shader part epilog main_body: %ray_origin0 = insertelement <3 x float> poison, float %ray_origin_x, i32 0 %ray_origin1 = insertelement <3 x float> %ray_origin0, float %ray_origin_y, i32 1 %ray_origin = insertelement <3 x float> %ray_origin1, float %ray_origin_z, i32 2 %ray_dir0 = insertelement <3 x float> poison, float %ray_dir_x, i32 0 %ray_dir1 = insertelement <3 x float> %ray_dir0, float %ray_dir_y, i32 1 %ray_dir = insertelement <3 x float> %ray_dir1, float %ray_dir_z, i32 2 %v = call {<10 x i32>, <3 x float>, <3 x float>} @llvm.amdgcn.image.bvh8.intersect.ray(i64 %node_ptr, float %ray_extent, i8 0, <3 x float> %ray_origin, <3 x float> %ray_dir, i32 %offset, <4 x i32> %tdescr) %a = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 0 %r = bitcast <10 x i32> %a to <10 x float> %o = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 1 store <3 x float> %o, ptr addrspace(1) %origin %d = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 2 store <3 x float> %d, ptr addrspace(1) %dir ret <10 x float> %r } define amdgpu_ps <10 x float> @image_bvh8_intersect_ray_1(i64 %node_ptr, float %ray_extent, float %ray_origin_x, float %ray_origin_y, float %ray_origin_z, float %ray_dir_x, float %ray_dir_y, float %ray_dir_z, i32 %offset, <4 x i32> inreg %tdescr, ptr addrspace(1) %origin, ptr addrspace(1) %dir) { ; GFX12-SDAG-LABEL: image_bvh8_intersect_ray_1: ; GFX12-SDAG: ; %bb.0: ; %main_body ; GFX12-SDAG-NEXT: v_dual_mov_b32 v21, v8 :: v_dual_mov_b32 v20, v7 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v19, v6 :: v_dual_mov_b32 v18, v5 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v17, v4 :: v_dual_mov_b32 v16, v3 ; GFX12-SDAG-NEXT: v_mov_b32_e32 v3, 1 ; GFX12-SDAG-NEXT: image_bvh8_intersect_ray v[0:9], [v[0:1], v[2:3], v[16:18], v[19:21], v9], s[0:3] ; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0 ; GFX12-SDAG-NEXT: global_store_b96 v[10:11], v[16:18], off ; GFX12-SDAG-NEXT: global_store_b96 v[12:13], v[19:21], off ; GFX12-SDAG-NEXT: ; return to shader part epilog ; ; GFX12-GISEL-LABEL: image_bvh8_intersect_ray_1: ; GFX12-GISEL: ; %bb.0: ; %main_body ; GFX12-GISEL-NEXT: v_dual_mov_b32 v14, v3 :: v_dual_mov_b32 v15, v4 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v16, v5 :: v_dual_mov_b32 v17, v6 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v18, v7 :: v_dual_mov_b32 v19, v8 ; GFX12-GISEL-NEXT: v_mov_b32_e32 v3, 1 ; GFX12-GISEL-NEXT: image_bvh8_intersect_ray v[0:9], [v[0:1], v[2:3], v[14:16], v[17:19], v9], s[0:3] ; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0 ; GFX12-GISEL-NEXT: global_store_b96 v[10:11], v[14:16], off ; GFX12-GISEL-NEXT: global_store_b96 v[12:13], v[17:19], off ; GFX12-GISEL-NEXT: ; return to shader part epilog main_body: %ray_origin0 = insertelement <3 x float> poison, float %ray_origin_x, i32 0 %ray_origin1 = insertelement <3 x float> %ray_origin0, float %ray_origin_y, i32 1 %ray_origin = insertelement <3 x float> %ray_origin1, float %ray_origin_z, i32 2 %ray_dir0 = insertelement <3 x float> poison, float %ray_dir_x, i32 0 %ray_dir1 = insertelement <3 x float> %ray_dir0, float %ray_dir_y, i32 1 %ray_dir = insertelement <3 x float> %ray_dir1, float %ray_dir_z, i32 2 %v = call {<10 x i32>, <3 x float>, <3 x float>} @llvm.amdgcn.image.bvh8.intersect.ray(i64 %node_ptr, float %ray_extent, i8 1, <3 x float> %ray_origin, <3 x float> %ray_dir, i32 %offset, <4 x i32> %tdescr) %a = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 0 %r = bitcast <10 x i32> %a to <10 x float> %o = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 1 store <3 x float> %o, ptr addrspace(1) %origin %d = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 2 store <3 x float> %d, ptr addrspace(1) %dir ret <10 x float> %r } define amdgpu_ps <10 x float> @image_bvh8_intersect_ray_ssssss(i64 inreg %node_ptr, float inreg %ray_extent, <3 x float> inreg %ray_origin, <3 x float> inreg %ray_dir, i32 inreg %offset, <4 x i32> inreg %tdescr, ptr addrspace(1) %origin, ptr addrspace(1) %dir) { ; GFX12-SDAG-LABEL: image_bvh8_intersect_ray_ssssss: ; GFX12-SDAG: ; %bb.0: ; GFX12-SDAG-NEXT: v_dual_mov_b32 v11, v3 :: v_dual_mov_b32 v10, v2 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v13, v1 :: v_dual_mov_b32 v12, v0 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v14, s6 :: v_dual_mov_b32 v15, s7 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v16, s8 :: v_dual_mov_b32 v17, s3 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v18, s4 :: v_dual_mov_b32 v19, s5 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, 0 ; GFX12-SDAG-NEXT: v_mov_b32_e32 v4, s9 ; GFX12-SDAG-NEXT: s_mov_b32 s15, s13 ; GFX12-SDAG-NEXT: s_mov_b32 s14, s12 ; GFX12-SDAG-NEXT: s_mov_b32 s13, s11 ; GFX12-SDAG-NEXT: s_mov_b32 s12, s10 ; GFX12-SDAG-NEXT: image_bvh8_intersect_ray v[0:9], [v[0:1], v[2:3], v[17:19], v[14:16], v4], s[12:15] ; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0 ; GFX12-SDAG-NEXT: global_store_b96 v[12:13], v[17:19], off ; GFX12-SDAG-NEXT: global_store_b96 v[10:11], v[14:16], off ; GFX12-SDAG-NEXT: ; return to shader part epilog ; ; GFX12-GISEL-LABEL: image_bvh8_intersect_ray_ssssss: ; GFX12-GISEL: ; %bb.0: ; GFX12-GISEL-NEXT: s_mov_b32 s16, s3 ; GFX12-GISEL-NEXT: s_mov_b32 s18, s5 ; GFX12-GISEL-NEXT: s_mov_b32 s20, s6 ; GFX12-GISEL-NEXT: s_mov_b32 s17, s4 ; GFX12-GISEL-NEXT: s_mov_b32 s21, s7 ; GFX12-GISEL-NEXT: s_mov_b32 s22, s8 ; GFX12-GISEL-NEXT: s_mov_b32 s3, 0 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v14, s16 :: v_dual_mov_b32 v15, s17 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v16, s18 :: v_dual_mov_b32 v17, s20 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v10, v0 :: v_dual_mov_b32 v11, v1 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v12, v2 :: v_dual_mov_b32 v13, v3 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v18, s21 :: v_dual_mov_b32 v19, s22 ; GFX12-GISEL-NEXT: v_mov_b32_e32 v4, s9 ; GFX12-GISEL-NEXT: s_mov_b32 s4, s10 ; GFX12-GISEL-NEXT: s_mov_b32 s5, s11 ; GFX12-GISEL-NEXT: s_mov_b32 s6, s12 ; GFX12-GISEL-NEXT: s_mov_b32 s7, s13 ; GFX12-GISEL-NEXT: image_bvh8_intersect_ray v[0:9], [v[0:1], v[2:3], v[14:16], v[17:19], v4], s[4:7] ; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0 ; GFX12-GISEL-NEXT: global_store_b96 v[10:11], v[14:16], off ; GFX12-GISEL-NEXT: global_store_b96 v[12:13], v[17:19], off ; GFX12-GISEL-NEXT: ; return to shader part epilog %v = call {<10 x i32>, <3 x float>, <3 x float>} @llvm.amdgcn.image.bvh8.intersect.ray(i64 %node_ptr, float %ray_extent, i8 0, <3 x float> %ray_origin, <3 x float> %ray_dir, i32 %offset, <4 x i32> %tdescr) %a = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 0 %r = bitcast <10 x i32> %a to <10 x float> %o = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 1 store <3 x float> %o, ptr addrspace(1) %origin %d = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 2 store <3 x float> %d, ptr addrspace(1) %dir ret <10 x float> %r } define amdgpu_ps <10 x float> @image_bvh8_intersect_ray_vvvvvv(i64 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, i32 %offset, <4 x i32> %tdescr, ptr addrspace(1) %origin, ptr addrspace(1) %dir) { ; GFX12-SDAG-LABEL: image_bvh8_intersect_ray_vvvvvv: ; GFX12-SDAG: ; %bb.0: ; GFX12-SDAG-NEXT: v_dual_mov_b32 v28, v9 :: v_dual_mov_b32 v19, v7 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v20, v8 :: v_dual_mov_b32 v23, v5 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v18, v6 :: v_dual_mov_b32 v21, v3 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v22, v4 :: v_dual_mov_b32 v25, v1 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v26, v2 :: v_dual_mov_b32 v27, 0 ; GFX12-SDAG-NEXT: v_mov_b32_e32 v24, v0 ; GFX12-SDAG-NEXT: s_mov_b32 s1, exec_lo ; GFX12-SDAG-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1 ; GFX12-SDAG-NEXT: v_readfirstlane_b32 s4, v10 ; GFX12-SDAG-NEXT: v_readfirstlane_b32 s5, v11 ; GFX12-SDAG-NEXT: v_readfirstlane_b32 s6, v12 ; GFX12-SDAG-NEXT: v_readfirstlane_b32 s7, v13 ; GFX12-SDAG-NEXT: s_wait_alu depctr_va_sdst(0) ; GFX12-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2) ; GFX12-SDAG-NEXT: v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[10:11] ; GFX12-SDAG-NEXT: v_cmp_eq_u64_e64 s0, s[6:7], v[12:13] ; GFX12-SDAG-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-SDAG-NEXT: s_delay_alu instid0(SALU_CYCLE_1) ; GFX12-SDAG-NEXT: s_and_saveexec_b32 s0, s0 ; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0 ; GFX12-SDAG-NEXT: image_bvh8_intersect_ray v[0:9], [v[24:25], v[26:27], v[21:23], v[18:20], v28], s[4:7] ; GFX12-SDAG-NEXT: ; implicit-def: $vgpr10_vgpr11_vgpr12_vgpr13 ; GFX12-SDAG-NEXT: ; implicit-def: $vgpr24_vgpr25 ; GFX12-SDAG-NEXT: ; implicit-def: $vgpr26_vgpr27 ; GFX12-SDAG-NEXT: ; implicit-def: $vgpr28 ; GFX12-SDAG-NEXT: s_xor_b32 exec_lo, exec_lo, s0 ; GFX12-SDAG-NEXT: s_cbranch_execnz .LBB3_1 ; GFX12-SDAG-NEXT: ; %bb.2: ; GFX12-SDAG-NEXT: s_mov_b32 exec_lo, s1 ; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0 ; GFX12-SDAG-NEXT: global_store_b96 v[14:15], v[21:23], off ; GFX12-SDAG-NEXT: global_store_b96 v[16:17], v[18:20], off ; GFX12-SDAG-NEXT: ; return to shader part epilog ; ; GFX12-GISEL-LABEL: image_bvh8_intersect_ray_vvvvvv: ; GFX12-GISEL: ; %bb.0: ; GFX12-GISEL-NEXT: v_dual_mov_b32 v24, v0 :: v_dual_mov_b32 v25, v1 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v26, v2 :: v_dual_mov_b32 v19, v4 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v18, v3 :: v_dual_mov_b32 v21, v6 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v20, v5 :: v_dual_mov_b32 v23, v8 ; GFX12-GISEL-NEXT: v_dual_mov_b32 v22, v7 :: v_dual_mov_b32 v27, 0 ; GFX12-GISEL-NEXT: v_mov_b32_e32 v28, v9 ; GFX12-GISEL-NEXT: s_mov_b32 s1, exec_lo ; GFX12-GISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1 ; GFX12-GISEL-NEXT: v_readfirstlane_b32 s4, v10 ; GFX12-GISEL-NEXT: v_readfirstlane_b32 s5, v11 ; GFX12-GISEL-NEXT: v_readfirstlane_b32 s6, v12 ; GFX12-GISEL-NEXT: v_readfirstlane_b32 s7, v13 ; GFX12-GISEL-NEXT: s_wait_alu depctr_va_sdst(0) ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2) ; GFX12-GISEL-NEXT: v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[10:11] ; GFX12-GISEL-NEXT: v_cmp_eq_u64_e64 s0, s[6:7], v[12:13] ; GFX12-GISEL-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) ; GFX12-GISEL-NEXT: s_and_saveexec_b32 s0, s0 ; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0 ; GFX12-GISEL-NEXT: image_bvh8_intersect_ray v[0:9], [v[24:25], v[26:27], v[18:20], v[21:23], v28], s[4:7] ; GFX12-GISEL-NEXT: ; implicit-def: $vgpr10 ; GFX12-GISEL-NEXT: ; implicit-def: $vgpr24_vgpr25 ; GFX12-GISEL-NEXT: ; implicit-def: $vgpr26_vgpr27 ; GFX12-GISEL-NEXT: ; implicit-def: $vgpr28 ; GFX12-GISEL-NEXT: ; implicit-def: $vgpr12_vgpr13 ; GFX12-GISEL-NEXT: s_xor_b32 exec_lo, exec_lo, s0 ; GFX12-GISEL-NEXT: s_cbranch_execnz .LBB3_1 ; GFX12-GISEL-NEXT: ; %bb.2: ; GFX12-GISEL-NEXT: s_mov_b32 exec_lo, s1 ; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0 ; GFX12-GISEL-NEXT: global_store_b96 v[14:15], v[18:20], off ; GFX12-GISEL-NEXT: global_store_b96 v[16:17], v[21:23], off ; GFX12-GISEL-NEXT: ; return to shader part epilog %v = call {<10 x i32>, <3 x float>, <3 x float>} @llvm.amdgcn.image.bvh8.intersect.ray(i64 %node_ptr, float %ray_extent, i8 0, <3 x float> %ray_origin, <3 x float> %ray_dir, i32 %offset, <4 x i32> %tdescr) %a = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 0 %r = bitcast <10 x i32> %a to <10 x float> %o = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 1 store <3 x float> %o, ptr addrspace(1) %origin %d = extractvalue {<10 x i32>, <3 x float>, <3 x float>} %v, 2 store <3 x float> %d, ptr addrspace(1) %dir ret <10 x float> %r }