[MachineScheduler] Fix physreg dependencies of ExitSU (#123541)
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / GlobalISel / llvm.amdgcn.intersect_ray.ll
blobb26ddbdd7a342ed9ad4bf34679329fc4e2e9039d
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel -mtriple=amdgcn -mcpu=gfx1030 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX10,GFX1030 %s
3 ; RUN: llc -global-isel -mtriple=amdgcn -mcpu=gfx1013 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX10,GFX1013 %s
4 ; RUN: llc -global-isel -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX11 %s
5 ; RUN: not --crash llc -global-isel -mtriple=amdgcn -mcpu=gfx1012 -verify-machineinstrs < %s -o /dev/null 2>&1 | FileCheck -check-prefix=ERR %s
7 ; uint4 llvm.amdgcn.image.bvh.intersect.ray.i32.v4f32(uint node_ptr, float ray_extent, float3 ray_origin, float3 ray_dir, float3 ray_inv_dir, uint4 texture_descr)
8 ; uint4 llvm.amdgcn.image.bvh.intersect.ray.i32.v4f16(uint node_ptr, float ray_extent, float3 ray_origin, half3 ray_dir, half3 ray_inv_dir, uint4 texture_descr)
9 ; uint4 llvm.amdgcn.image.bvh.intersect.ray.i64.v4f32(ulong node_ptr, float ray_extent, float3 ray_origin, float3 ray_dir, float3 ray_inv_dir, uint4 texture_descr)
10 ; uint4 llvm.amdgcn.image.bvh.intersect.ray.i64.v4f16(ulong node_ptr, float ray_extent, float3 ray_origin, half3 ray_dir, half3 ray_inv_dir, uint4 texture_descr)
12 declare <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f32(i32, float, <3 x float>, <3 x float>, <3 x float>, <4 x i32>)
13 declare <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f16(i32, float, <3 x float>, <3 x half>, <3 x half>, <4 x i32>)
14 declare <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f32(i64, float, <3 x float>, <3 x float>, <3 x float>, <4 x i32>)
15 declare <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f16(i64, float, <3 x float>, <3 x half>, <3 x half>, <4 x i32>)
16 declare i32 @llvm.amdgcn.workitem.id.x()
18 define amdgpu_ps <4 x float> @image_bvh_intersect_ray(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> inreg %tdescr) {
19 ; GCN-LABEL: image_bvh_intersect_ray:
20 ; GCN:       ; %bb.0:
21 ; GCN-NEXT:    image_bvh_intersect_ray v[0:3], v[0:10], s[0:3]
22 ; GCN-NEXT:    s_waitcnt vmcnt(0)
23 ; GCN-NEXT:    ; return to shader part epilog
24 ; ERR: in function image_bvh_intersect_ray{{.*}}intrinsic not supported on subtarget
25   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f32(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> %tdescr)
26   %r = bitcast <4 x i32> %v to <4 x float>
27   ret <4 x float> %r
30 define amdgpu_ps <4 x float> @image_bvh_intersect_ray_flat(i32 %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, float %ray_inv_dir_x, float %ray_inv_dir_y, float %ray_inv_dir_z, <4 x i32> inreg %tdescr) {
31 ; GCN-LABEL: image_bvh_intersect_ray_flat:
32 ; GCN:       ; %bb.0:
33 ; GCN-NEXT:    image_bvh_intersect_ray v[0:3], v[0:10], s[0:3]
34 ; GCN-NEXT:    s_waitcnt vmcnt(0)
35 ; GCN-NEXT:    ; return to shader part epilog
36   %ray_origin0 = insertelement <3 x float> undef, float %ray_origin_x, i32 0
37   %ray_origin1 = insertelement <3 x float> %ray_origin0, float %ray_origin_y, i32 1
38   %ray_origin = insertelement <3 x float> %ray_origin1, float %ray_origin_z, i32 2
39   %ray_dir0 = insertelement <3 x float> undef, float %ray_dir_x, i32 0
40   %ray_dir1 = insertelement <3 x float> %ray_dir0, float %ray_dir_y, i32 1
41   %ray_dir = insertelement <3 x float> %ray_dir1, float %ray_dir_z, i32 2
42   %ray_inv_dir0 = insertelement <3 x float> undef, float %ray_inv_dir_x, i32 0
43   %ray_inv_dir1 = insertelement <3 x float> %ray_inv_dir0, float %ray_inv_dir_y, i32 1
44   %ray_inv_dir = insertelement <3 x float> %ray_inv_dir1, float %ray_inv_dir_z, i32 2
45   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f32(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> %tdescr)
46  %r = bitcast <4 x i32> %v to <4 x float>
47  ret <4 x float> %r
50 define amdgpu_ps <4 x float> @image_bvh_intersect_ray_a16(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x half> %ray_dir, <3 x half> %ray_inv_dir, <4 x i32> inreg %tdescr) {
51 ; GFX10-LABEL: image_bvh_intersect_ray_a16:
52 ; GFX10:       ; %bb.0:
53 ; GFX10-NEXT:    v_lshrrev_b32_e32 v9, 16, v5
54 ; GFX10-NEXT:    v_and_b32_e32 v10, 0xffff, v7
55 ; GFX10-NEXT:    v_and_b32_e32 v8, 0xffff, v8
56 ; GFX10-NEXT:    v_lshlrev_b32_e32 v9, 16, v9
57 ; GFX10-NEXT:    v_lshlrev_b32_e32 v10, 16, v10
58 ; GFX10-NEXT:    v_alignbit_b32 v7, v8, v7, 16
59 ; GFX10-NEXT:    v_and_or_b32 v5, 0xffff, v5, v9
60 ; GFX10-NEXT:    v_and_or_b32 v6, 0xffff, v6, v10
61 ; GFX10-NEXT:    image_bvh_intersect_ray v[0:3], v[0:7], s[0:3] a16
62 ; GFX10-NEXT:    s_waitcnt vmcnt(0)
63 ; GFX10-NEXT:    ; return to shader part epilog
65 ; GFX11-LABEL: image_bvh_intersect_ray_a16:
66 ; GFX11:       ; %bb.0:
67 ; GFX11-NEXT:    v_and_b32_e32 v9, 0xffff, v7
68 ; GFX11-NEXT:    v_and_b32_e32 v10, 0xffff, v8
69 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
70 ; GFX11-NEXT:    v_lshl_or_b32 v8, v5, 16, v9
71 ; GFX11-NEXT:    v_perm_b32 v9, v5, v7, 0x7060302
72 ; GFX11-NEXT:    v_lshl_or_b32 v10, v6, 16, v10
73 ; GFX11-NEXT:    image_bvh_intersect_ray v[0:3], [v0, v1, v[2:4], v[8:10]], s[0:3] a16
74 ; GFX11-NEXT:    s_waitcnt vmcnt(0)
75 ; GFX11-NEXT:    ; return to shader part epilog
76   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f16(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x half> %ray_dir, <3 x half> %ray_inv_dir, <4 x i32> %tdescr)
77   %r = bitcast <4 x i32> %v to <4 x float>
78   ret <4 x float> %r
81 define amdgpu_ps <4 x float> @image_bvh64_intersect_ray(i64 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> inreg %tdescr) {
82 ; GCN-LABEL: image_bvh64_intersect_ray:
83 ; GCN:       ; %bb.0:
84 ; GCN-NEXT:    image_bvh64_intersect_ray v[0:3], v[0:11], s[0:3]
85 ; GCN-NEXT:    s_waitcnt vmcnt(0)
86 ; GCN-NEXT:    ; return to shader part epilog
87   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f32(i64 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> %tdescr)
88   %r = bitcast <4 x i32> %v to <4 x float>
89   ret <4 x float> %r
92 define amdgpu_ps <4 x float> @image_bvh64_intersect_ray_flat(<2 x i32> %node_ptr_vec, 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, float %ray_inv_dir_x, float %ray_inv_dir_y, float %ray_inv_dir_z, <4 x i32> inreg %tdescr) {
93 ; GCN-LABEL: image_bvh64_intersect_ray_flat:
94 ; GCN:       ; %bb.0:
95 ; GCN-NEXT:    image_bvh64_intersect_ray v[0:3], v[0:11], s[0:3]
96 ; GCN-NEXT:    s_waitcnt vmcnt(0)
97 ; GCN-NEXT:    ; return to shader part epilog
98   %node_ptr = bitcast <2 x i32> %node_ptr_vec to i64
99   %ray_origin0 = insertelement <3 x float> undef, float %ray_origin_x, i32 0
100   %ray_origin1 = insertelement <3 x float> %ray_origin0, float %ray_origin_y, i32 1
101   %ray_origin = insertelement <3 x float> %ray_origin1, float %ray_origin_z, i32 2
102   %ray_dir0 = insertelement <3 x float> undef, float %ray_dir_x, i32 0
103   %ray_dir1 = insertelement <3 x float> %ray_dir0, float %ray_dir_y, i32 1
104   %ray_dir = insertelement <3 x float> %ray_dir1, float %ray_dir_z, i32 2
105   %ray_inv_dir0 = insertelement <3 x float> undef, float %ray_inv_dir_x, i32 0
106   %ray_inv_dir1 = insertelement <3 x float> %ray_inv_dir0, float %ray_inv_dir_y, i32 1
107   %ray_inv_dir = insertelement <3 x float> %ray_inv_dir1, float %ray_inv_dir_z, i32 2
108   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f32(i64 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> %tdescr)
109  %r = bitcast <4 x i32> %v to <4 x float>
110  ret <4 x float> %r
113 define amdgpu_ps <4 x float> @image_bvh64_intersect_ray_a16(i64 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x half> %ray_dir, <3 x half> %ray_inv_dir, <4 x i32> inreg %tdescr) {
114 ; GFX10-LABEL: image_bvh64_intersect_ray_a16:
115 ; GFX10:       ; %bb.0:
116 ; GFX10-NEXT:    v_lshrrev_b32_e32 v10, 16, v6
117 ; GFX10-NEXT:    v_and_b32_e32 v11, 0xffff, v8
118 ; GFX10-NEXT:    v_and_b32_e32 v9, 0xffff, v9
119 ; GFX10-NEXT:    v_lshlrev_b32_e32 v10, 16, v10
120 ; GFX10-NEXT:    v_lshlrev_b32_e32 v11, 16, v11
121 ; GFX10-NEXT:    v_alignbit_b32 v8, v9, v8, 16
122 ; GFX10-NEXT:    v_and_or_b32 v6, 0xffff, v6, v10
123 ; GFX10-NEXT:    v_and_or_b32 v7, 0xffff, v7, v11
124 ; GFX10-NEXT:    image_bvh64_intersect_ray v[0:3], v[0:8], s[0:3] a16
125 ; GFX10-NEXT:    s_waitcnt vmcnt(0)
126 ; GFX10-NEXT:    ; return to shader part epilog
128 ; GFX11-LABEL: image_bvh64_intersect_ray_a16:
129 ; GFX11:       ; %bb.0:
130 ; GFX11-NEXT:    v_and_b32_e32 v10, 0xffff, v8
131 ; GFX11-NEXT:    v_and_b32_e32 v11, 0xffff, v9
132 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
133 ; GFX11-NEXT:    v_lshl_or_b32 v9, v6, 16, v10
134 ; GFX11-NEXT:    v_perm_b32 v10, v6, v8, 0x7060302
135 ; GFX11-NEXT:    v_lshl_or_b32 v11, v7, 16, v11
136 ; GFX11-NEXT:    image_bvh64_intersect_ray v[0:3], [v[0:1], v2, v[3:5], v[9:11]], s[0:3] a16
137 ; GFX11-NEXT:    s_waitcnt vmcnt(0)
138 ; GFX11-NEXT:    ; return to shader part epilog
139   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f16(i64 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x half> %ray_dir, <3 x half> %ray_inv_dir, <4 x i32> %tdescr)
140   %r = bitcast <4 x i32> %v to <4 x float>
141   ret <4 x float> %r
144 define amdgpu_ps <4 x float> @image_bvh_intersect_ray_vgpr_descr(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> %tdescr) {
145 ; GFX1030-LABEL: image_bvh_intersect_ray_vgpr_descr:
146 ; GFX1030:       ; %bb.0:
147 ; GFX1030-NEXT:    v_mov_b32_e32 v21, v0
148 ; GFX1030-NEXT:    v_mov_b32_e32 v22, v1
149 ; GFX1030-NEXT:    v_mov_b32_e32 v23, v2
150 ; GFX1030-NEXT:    v_mov_b32_e32 v24, v3
151 ; GFX1030-NEXT:    v_mov_b32_e32 v25, v4
152 ; GFX1030-NEXT:    v_mov_b32_e32 v26, v5
153 ; GFX1030-NEXT:    v_mov_b32_e32 v27, v6
154 ; GFX1030-NEXT:    v_mov_b32_e32 v28, v7
155 ; GFX1030-NEXT:    v_mov_b32_e32 v29, v8
156 ; GFX1030-NEXT:    v_mov_b32_e32 v30, v9
157 ; GFX1030-NEXT:    v_mov_b32_e32 v31, v10
158 ; GFX1030-NEXT:    v_mov_b32_e32 v19, v11
159 ; GFX1030-NEXT:    v_mov_b32_e32 v20, v12
160 ; GFX1030-NEXT:    s_mov_b32 s1, exec_lo
161 ; GFX1030-NEXT:  .LBB6_1: ; =>This Inner Loop Header: Depth=1
162 ; GFX1030-NEXT:    v_readfirstlane_b32 s4, v19
163 ; GFX1030-NEXT:    v_readfirstlane_b32 s5, v20
164 ; GFX1030-NEXT:    v_readfirstlane_b32 s6, v13
165 ; GFX1030-NEXT:    v_readfirstlane_b32 s7, v14
166 ; GFX1030-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[19:20]
167 ; GFX1030-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[13:14]
168 ; GFX1030-NEXT:    s_and_b32 s0, vcc_lo, s0
169 ; GFX1030-NEXT:    s_and_saveexec_b32 s0, s0
170 ; GFX1030-NEXT:    image_bvh_intersect_ray v[0:3], v[21:31], s[4:7]
171 ; GFX1030-NEXT:    ; implicit-def: $vgpr19
172 ; GFX1030-NEXT:    ; implicit-def: $vgpr21
173 ; GFX1030-NEXT:    ; implicit-def: $vgpr22
174 ; GFX1030-NEXT:    ; implicit-def: $vgpr23
175 ; GFX1030-NEXT:    ; implicit-def: $vgpr24
176 ; GFX1030-NEXT:    ; implicit-def: $vgpr25
177 ; GFX1030-NEXT:    ; implicit-def: $vgpr26
178 ; GFX1030-NEXT:    ; implicit-def: $vgpr27
179 ; GFX1030-NEXT:    ; implicit-def: $vgpr28
180 ; GFX1030-NEXT:    ; implicit-def: $vgpr29
181 ; GFX1030-NEXT:    ; implicit-def: $vgpr30
182 ; GFX1030-NEXT:    ; implicit-def: $vgpr31
183 ; GFX1030-NEXT:    ; implicit-def: $vgpr11_vgpr12_vgpr13_vgpr14
184 ; GFX1030-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
185 ; GFX1030-NEXT:    s_cbranch_execnz .LBB6_1
186 ; GFX1030-NEXT:  ; %bb.2:
187 ; GFX1030-NEXT:    s_mov_b32 exec_lo, s1
188 ; GFX1030-NEXT:    s_waitcnt vmcnt(0)
189 ; GFX1030-NEXT:    ; return to shader part epilog
191 ; GFX1013-LABEL: image_bvh_intersect_ray_vgpr_descr:
192 ; GFX1013:       ; %bb.0:
193 ; GFX1013-NEXT:    v_mov_b32_e32 v19, v11
194 ; GFX1013-NEXT:    v_mov_b32_e32 v20, v12
195 ; GFX1013-NEXT:    s_mov_b32 s1, exec_lo
196 ; GFX1013-NEXT:  .LBB6_1: ; =>This Inner Loop Header: Depth=1
197 ; GFX1013-NEXT:    v_readfirstlane_b32 s4, v19
198 ; GFX1013-NEXT:    v_readfirstlane_b32 s5, v20
199 ; GFX1013-NEXT:    v_readfirstlane_b32 s6, v13
200 ; GFX1013-NEXT:    v_readfirstlane_b32 s7, v14
201 ; GFX1013-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[19:20]
202 ; GFX1013-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[13:14]
203 ; GFX1013-NEXT:    s_and_b32 s0, vcc_lo, s0
204 ; GFX1013-NEXT:    s_and_saveexec_b32 s0, s0
205 ; GFX1013-NEXT:    image_bvh_intersect_ray v[15:18], v[0:10], s[4:7]
206 ; GFX1013-NEXT:    ; implicit-def: $vgpr19
207 ; GFX1013-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10
208 ; GFX1013-NEXT:    ; implicit-def: $vgpr11_vgpr12_vgpr13_vgpr14
209 ; GFX1013-NEXT:    s_waitcnt_depctr 0xffe3
210 ; GFX1013-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
211 ; GFX1013-NEXT:    s_cbranch_execnz .LBB6_1
212 ; GFX1013-NEXT:  ; %bb.2:
213 ; GFX1013-NEXT:    s_mov_b32 exec_lo, s1
214 ; GFX1013-NEXT:    s_waitcnt vmcnt(0)
215 ; GFX1013-NEXT:    v_mov_b32_e32 v0, v15
216 ; GFX1013-NEXT:    v_mov_b32_e32 v1, v16
217 ; GFX1013-NEXT:    v_mov_b32_e32 v2, v17
218 ; GFX1013-NEXT:    v_mov_b32_e32 v3, v18
219 ; GFX1013-NEXT:    ; return to shader part epilog
221 ; GFX11-LABEL: image_bvh_intersect_ray_vgpr_descr:
222 ; GFX11:       ; %bb.0:
223 ; GFX11-NEXT:    v_dual_mov_b32 v20, v0 :: v_dual_mov_b32 v21, v1
224 ; GFX11-NEXT:    v_dual_mov_b32 v15, v2 :: v_dual_mov_b32 v16, v3
225 ; GFX11-NEXT:    v_dual_mov_b32 v17, v4 :: v_dual_mov_b32 v18, v11
226 ; GFX11-NEXT:    v_mov_b32_e32 v19, v12
227 ; GFX11-NEXT:    s_mov_b32 s1, exec_lo
228 ; GFX11-NEXT:  .LBB6_1: ; =>This Inner Loop Header: Depth=1
229 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
230 ; GFX11-NEXT:    v_readfirstlane_b32 s4, v18
231 ; GFX11-NEXT:    v_readfirstlane_b32 s5, v19
232 ; GFX11-NEXT:    v_readfirstlane_b32 s6, v13
233 ; GFX11-NEXT:    v_readfirstlane_b32 s7, v14
234 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
235 ; GFX11-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[18:19]
236 ; GFX11-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[13:14]
237 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
238 ; GFX11-NEXT:    s_and_b32 s0, vcc_lo, s0
239 ; GFX11-NEXT:    s_and_saveexec_b32 s0, s0
240 ; GFX11-NEXT:    image_bvh_intersect_ray v[0:3], [v20, v21, v[15:17], v[5:7], v[8:10]], s[4:7]
241 ; GFX11-NEXT:    ; implicit-def: $vgpr18
242 ; GFX11-NEXT:    ; implicit-def: $vgpr20
243 ; GFX11-NEXT:    ; implicit-def: $vgpr21
244 ; GFX11-NEXT:    ; implicit-def: $vgpr15_vgpr16_vgpr17
245 ; GFX11-NEXT:    ; implicit-def: $vgpr5_vgpr6_vgpr7
246 ; GFX11-NEXT:    ; implicit-def: $vgpr8_vgpr9_vgpr10
247 ; GFX11-NEXT:    ; implicit-def: $vgpr11_vgpr12_vgpr13_vgpr14
248 ; GFX11-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
249 ; GFX11-NEXT:    s_cbranch_execnz .LBB6_1
250 ; GFX11-NEXT:  ; %bb.2:
251 ; GFX11-NEXT:    s_mov_b32 exec_lo, s1
252 ; GFX11-NEXT:    s_waitcnt vmcnt(0)
253 ; GFX11-NEXT:    ; return to shader part epilog
254   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f32(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> %tdescr)
255   %r = bitcast <4 x i32> %v to <4 x float>
256   ret <4 x float> %r
259 define amdgpu_ps <4 x float> @image_bvh_intersect_ray_a16_vgpr_descr(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x half> %ray_dir, <3 x half> %ray_inv_dir, <4 x i32> %tdescr) {
260 ; GFX1030-LABEL: image_bvh_intersect_ray_a16_vgpr_descr:
261 ; GFX1030:       ; %bb.0:
262 ; GFX1030-NEXT:    v_mov_b32_e32 v18, v0
263 ; GFX1030-NEXT:    v_mov_b32_e32 v19, v1
264 ; GFX1030-NEXT:    v_lshrrev_b32_e32 v0, 16, v5
265 ; GFX1030-NEXT:    v_and_b32_e32 v1, 0xffff, v7
266 ; GFX1030-NEXT:    v_mov_b32_e32 v20, v2
267 ; GFX1030-NEXT:    v_and_b32_e32 v2, 0xffff, v8
268 ; GFX1030-NEXT:    v_mov_b32_e32 v21, v3
269 ; GFX1030-NEXT:    v_lshlrev_b32_e32 v0, 16, v0
270 ; GFX1030-NEXT:    v_lshlrev_b32_e32 v1, 16, v1
271 ; GFX1030-NEXT:    v_mov_b32_e32 v22, v4
272 ; GFX1030-NEXT:    v_mov_b32_e32 v16, v9
273 ; GFX1030-NEXT:    v_mov_b32_e32 v17, v10
274 ; GFX1030-NEXT:    v_and_or_b32 v23, 0xffff, v5, v0
275 ; GFX1030-NEXT:    v_and_or_b32 v24, 0xffff, v6, v1
276 ; GFX1030-NEXT:    v_alignbit_b32 v25, v2, v7, 16
277 ; GFX1030-NEXT:    s_mov_b32 s1, exec_lo
278 ; GFX1030-NEXT:  .LBB7_1: ; =>This Inner Loop Header: Depth=1
279 ; GFX1030-NEXT:    v_readfirstlane_b32 s4, v16
280 ; GFX1030-NEXT:    v_readfirstlane_b32 s5, v17
281 ; GFX1030-NEXT:    v_readfirstlane_b32 s6, v11
282 ; GFX1030-NEXT:    v_readfirstlane_b32 s7, v12
283 ; GFX1030-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[16:17]
284 ; GFX1030-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[11:12]
285 ; GFX1030-NEXT:    s_and_b32 s0, vcc_lo, s0
286 ; GFX1030-NEXT:    s_and_saveexec_b32 s0, s0
287 ; GFX1030-NEXT:    image_bvh_intersect_ray v[0:3], v[18:25], s[4:7] a16
288 ; GFX1030-NEXT:    ; implicit-def: $vgpr16
289 ; GFX1030-NEXT:    ; implicit-def: $vgpr18
290 ; GFX1030-NEXT:    ; implicit-def: $vgpr19
291 ; GFX1030-NEXT:    ; implicit-def: $vgpr20
292 ; GFX1030-NEXT:    ; implicit-def: $vgpr21
293 ; GFX1030-NEXT:    ; implicit-def: $vgpr22
294 ; GFX1030-NEXT:    ; implicit-def: $vgpr23
295 ; GFX1030-NEXT:    ; implicit-def: $vgpr24
296 ; GFX1030-NEXT:    ; implicit-def: $vgpr25
297 ; GFX1030-NEXT:    ; implicit-def: $vgpr9_vgpr10_vgpr11_vgpr12
298 ; GFX1030-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
299 ; GFX1030-NEXT:    s_cbranch_execnz .LBB7_1
300 ; GFX1030-NEXT:  ; %bb.2:
301 ; GFX1030-NEXT:    s_mov_b32 exec_lo, s1
302 ; GFX1030-NEXT:    s_waitcnt vmcnt(0)
303 ; GFX1030-NEXT:    ; return to shader part epilog
305 ; GFX1013-LABEL: image_bvh_intersect_ray_a16_vgpr_descr:
306 ; GFX1013:       ; %bb.0:
307 ; GFX1013-NEXT:    v_mov_b32_e32 v17, v9
308 ; GFX1013-NEXT:    v_mov_b32_e32 v18, v10
309 ; GFX1013-NEXT:    v_lshrrev_b32_e32 v9, 16, v5
310 ; GFX1013-NEXT:    v_and_b32_e32 v10, 0xffff, v7
311 ; GFX1013-NEXT:    v_and_b32_e32 v8, 0xffff, v8
312 ; GFX1013-NEXT:    s_mov_b32 s1, exec_lo
313 ; GFX1013-NEXT:    v_lshlrev_b32_e32 v9, 16, v9
314 ; GFX1013-NEXT:    v_lshlrev_b32_e32 v10, 16, v10
315 ; GFX1013-NEXT:    v_alignbit_b32 v7, v8, v7, 16
316 ; GFX1013-NEXT:    v_and_or_b32 v5, 0xffff, v5, v9
317 ; GFX1013-NEXT:    v_and_or_b32 v6, 0xffff, v6, v10
318 ; GFX1013-NEXT:  .LBB7_1: ; =>This Inner Loop Header: Depth=1
319 ; GFX1013-NEXT:    v_readfirstlane_b32 s4, v17
320 ; GFX1013-NEXT:    v_readfirstlane_b32 s5, v18
321 ; GFX1013-NEXT:    v_readfirstlane_b32 s6, v11
322 ; GFX1013-NEXT:    v_readfirstlane_b32 s7, v12
323 ; GFX1013-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[17:18]
324 ; GFX1013-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[11:12]
325 ; GFX1013-NEXT:    s_and_b32 s0, vcc_lo, s0
326 ; GFX1013-NEXT:    s_and_saveexec_b32 s0, s0
327 ; GFX1013-NEXT:    image_bvh_intersect_ray v[13:16], v[0:7], s[4:7] a16
328 ; GFX1013-NEXT:    ; implicit-def: $vgpr17
329 ; GFX1013-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
330 ; GFX1013-NEXT:    ; implicit-def: $vgpr9_vgpr10_vgpr11_vgpr12
331 ; GFX1013-NEXT:    s_waitcnt_depctr 0xffe3
332 ; GFX1013-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
333 ; GFX1013-NEXT:    s_cbranch_execnz .LBB7_1
334 ; GFX1013-NEXT:  ; %bb.2:
335 ; GFX1013-NEXT:    s_mov_b32 exec_lo, s1
336 ; GFX1013-NEXT:    s_waitcnt vmcnt(0)
337 ; GFX1013-NEXT:    v_mov_b32_e32 v0, v13
338 ; GFX1013-NEXT:    v_mov_b32_e32 v1, v14
339 ; GFX1013-NEXT:    v_mov_b32_e32 v2, v15
340 ; GFX1013-NEXT:    v_mov_b32_e32 v3, v16
341 ; GFX1013-NEXT:    ; return to shader part epilog
343 ; GFX11-LABEL: image_bvh_intersect_ray_a16_vgpr_descr:
344 ; GFX11:       ; %bb.0:
345 ; GFX11-NEXT:    v_dual_mov_b32 v16, v0 :: v_dual_mov_b32 v17, v1
346 ; GFX11-NEXT:    v_dual_mov_b32 v19, v10 :: v_dual_and_b32 v0, 0xffff, v7
347 ; GFX11-NEXT:    v_and_b32_e32 v1, 0xffff, v8
348 ; GFX11-NEXT:    v_dual_mov_b32 v13, v2 :: v_dual_mov_b32 v14, v3
349 ; GFX11-NEXT:    v_dual_mov_b32 v15, v4 :: v_dual_mov_b32 v18, v9
350 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_4)
351 ; GFX11-NEXT:    v_lshl_or_b32 v4, v5, 16, v0
352 ; GFX11-NEXT:    v_perm_b32 v5, v5, v7, 0x7060302
353 ; GFX11-NEXT:    v_lshl_or_b32 v6, v6, 16, v1
354 ; GFX11-NEXT:    s_mov_b32 s1, exec_lo
355 ; GFX11-NEXT:  .LBB7_1: ; =>This Inner Loop Header: Depth=1
356 ; GFX11-NEXT:    v_readfirstlane_b32 s4, v18
357 ; GFX11-NEXT:    v_readfirstlane_b32 s5, v19
358 ; GFX11-NEXT:    v_readfirstlane_b32 s6, v11
359 ; GFX11-NEXT:    v_readfirstlane_b32 s7, v12
360 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
361 ; GFX11-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[18:19]
362 ; GFX11-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[11:12]
363 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
364 ; GFX11-NEXT:    s_and_b32 s0, vcc_lo, s0
365 ; GFX11-NEXT:    s_and_saveexec_b32 s0, s0
366 ; GFX11-NEXT:    image_bvh_intersect_ray v[0:3], [v16, v17, v[13:15], v[4:6]], s[4:7] a16
367 ; GFX11-NEXT:    ; implicit-def: $vgpr18
368 ; GFX11-NEXT:    ; implicit-def: $vgpr16
369 ; GFX11-NEXT:    ; implicit-def: $vgpr17
370 ; GFX11-NEXT:    ; implicit-def: $vgpr13_vgpr14_vgpr15
371 ; GFX11-NEXT:    ; implicit-def: $vgpr4_vgpr5_vgpr6
372 ; GFX11-NEXT:    ; implicit-def: $vgpr9_vgpr10_vgpr11_vgpr12
373 ; GFX11-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
374 ; GFX11-NEXT:    s_cbranch_execnz .LBB7_1
375 ; GFX11-NEXT:  ; %bb.2:
376 ; GFX11-NEXT:    s_mov_b32 exec_lo, s1
377 ; GFX11-NEXT:    s_waitcnt vmcnt(0)
378 ; GFX11-NEXT:    ; return to shader part epilog
379   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f16(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x half> %ray_dir, <3 x half> %ray_inv_dir, <4 x i32> %tdescr)
380   %r = bitcast <4 x i32> %v to <4 x float>
381   ret <4 x float> %r
384 define amdgpu_ps <4 x float> @image_bvh64_intersect_ray_vgpr_descr(i64 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> %tdescr) {
385 ; GFX1030-LABEL: image_bvh64_intersect_ray_vgpr_descr:
386 ; GFX1030:       ; %bb.0:
387 ; GFX1030-NEXT:    v_mov_b32_e32 v22, v0
388 ; GFX1030-NEXT:    v_mov_b32_e32 v23, v1
389 ; GFX1030-NEXT:    v_mov_b32_e32 v24, v2
390 ; GFX1030-NEXT:    v_mov_b32_e32 v25, v3
391 ; GFX1030-NEXT:    v_mov_b32_e32 v26, v4
392 ; GFX1030-NEXT:    v_mov_b32_e32 v27, v5
393 ; GFX1030-NEXT:    v_mov_b32_e32 v28, v6
394 ; GFX1030-NEXT:    v_mov_b32_e32 v29, v7
395 ; GFX1030-NEXT:    v_mov_b32_e32 v30, v8
396 ; GFX1030-NEXT:    v_mov_b32_e32 v31, v9
397 ; GFX1030-NEXT:    v_mov_b32_e32 v32, v10
398 ; GFX1030-NEXT:    v_mov_b32_e32 v33, v11
399 ; GFX1030-NEXT:    v_mov_b32_e32 v20, v12
400 ; GFX1030-NEXT:    v_mov_b32_e32 v21, v13
401 ; GFX1030-NEXT:    s_mov_b32 s1, exec_lo
402 ; GFX1030-NEXT:  .LBB8_1: ; =>This Inner Loop Header: Depth=1
403 ; GFX1030-NEXT:    v_readfirstlane_b32 s4, v20
404 ; GFX1030-NEXT:    v_readfirstlane_b32 s5, v21
405 ; GFX1030-NEXT:    v_readfirstlane_b32 s6, v14
406 ; GFX1030-NEXT:    v_readfirstlane_b32 s7, v15
407 ; GFX1030-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[20:21]
408 ; GFX1030-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[14:15]
409 ; GFX1030-NEXT:    s_and_b32 s0, vcc_lo, s0
410 ; GFX1030-NEXT:    s_and_saveexec_b32 s0, s0
411 ; GFX1030-NEXT:    image_bvh64_intersect_ray v[0:3], v[22:33], s[4:7]
412 ; GFX1030-NEXT:    ; implicit-def: $vgpr20
413 ; GFX1030-NEXT:    ; implicit-def: $vgpr22
414 ; GFX1030-NEXT:    ; implicit-def: $vgpr23
415 ; GFX1030-NEXT:    ; implicit-def: $vgpr24
416 ; GFX1030-NEXT:    ; implicit-def: $vgpr25
417 ; GFX1030-NEXT:    ; implicit-def: $vgpr26
418 ; GFX1030-NEXT:    ; implicit-def: $vgpr27
419 ; GFX1030-NEXT:    ; implicit-def: $vgpr28
420 ; GFX1030-NEXT:    ; implicit-def: $vgpr29
421 ; GFX1030-NEXT:    ; implicit-def: $vgpr30
422 ; GFX1030-NEXT:    ; implicit-def: $vgpr31
423 ; GFX1030-NEXT:    ; implicit-def: $vgpr32
424 ; GFX1030-NEXT:    ; implicit-def: $vgpr33
425 ; GFX1030-NEXT:    ; implicit-def: $vgpr12_vgpr13_vgpr14_vgpr15
426 ; GFX1030-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
427 ; GFX1030-NEXT:    s_cbranch_execnz .LBB8_1
428 ; GFX1030-NEXT:  ; %bb.2:
429 ; GFX1030-NEXT:    s_mov_b32 exec_lo, s1
430 ; GFX1030-NEXT:    s_waitcnt vmcnt(0)
431 ; GFX1030-NEXT:    ; return to shader part epilog
433 ; GFX1013-LABEL: image_bvh64_intersect_ray_vgpr_descr:
434 ; GFX1013:       ; %bb.0:
435 ; GFX1013-NEXT:    v_mov_b32_e32 v20, v12
436 ; GFX1013-NEXT:    v_mov_b32_e32 v21, v13
437 ; GFX1013-NEXT:    s_mov_b32 s1, exec_lo
438 ; GFX1013-NEXT:  .LBB8_1: ; =>This Inner Loop Header: Depth=1
439 ; GFX1013-NEXT:    v_readfirstlane_b32 s4, v20
440 ; GFX1013-NEXT:    v_readfirstlane_b32 s5, v21
441 ; GFX1013-NEXT:    v_readfirstlane_b32 s6, v14
442 ; GFX1013-NEXT:    v_readfirstlane_b32 s7, v15
443 ; GFX1013-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[20:21]
444 ; GFX1013-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[14:15]
445 ; GFX1013-NEXT:    s_and_b32 s0, vcc_lo, s0
446 ; GFX1013-NEXT:    s_and_saveexec_b32 s0, s0
447 ; GFX1013-NEXT:    image_bvh64_intersect_ray v[16:19], v[0:11], s[4:7]
448 ; GFX1013-NEXT:    ; implicit-def: $vgpr20
449 ; GFX1013-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11
450 ; GFX1013-NEXT:    ; implicit-def: $vgpr12_vgpr13_vgpr14_vgpr15
451 ; GFX1013-NEXT:    s_waitcnt_depctr 0xffe3
452 ; GFX1013-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
453 ; GFX1013-NEXT:    s_cbranch_execnz .LBB8_1
454 ; GFX1013-NEXT:  ; %bb.2:
455 ; GFX1013-NEXT:    s_mov_b32 exec_lo, s1
456 ; GFX1013-NEXT:    s_waitcnt vmcnt(0)
457 ; GFX1013-NEXT:    v_mov_b32_e32 v0, v16
458 ; GFX1013-NEXT:    v_mov_b32_e32 v1, v17
459 ; GFX1013-NEXT:    v_mov_b32_e32 v2, v18
460 ; GFX1013-NEXT:    v_mov_b32_e32 v3, v19
461 ; GFX1013-NEXT:    ; return to shader part epilog
463 ; GFX11-LABEL: image_bvh64_intersect_ray_vgpr_descr:
464 ; GFX11:       ; %bb.0:
465 ; GFX11-NEXT:    v_dual_mov_b32 v19, v0 :: v_dual_mov_b32 v20, v1
466 ; GFX11-NEXT:    v_dual_mov_b32 v21, v2 :: v_dual_mov_b32 v16, v3
467 ; GFX11-NEXT:    v_dual_mov_b32 v17, v4 :: v_dual_mov_b32 v18, v5
468 ; GFX11-NEXT:    v_dual_mov_b32 v4, v12 :: v_dual_mov_b32 v5, v13
469 ; GFX11-NEXT:    s_mov_b32 s1, exec_lo
470 ; GFX11-NEXT:  .LBB8_1: ; =>This Inner Loop Header: Depth=1
471 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
472 ; GFX11-NEXT:    v_readfirstlane_b32 s4, v4
473 ; GFX11-NEXT:    v_readfirstlane_b32 s5, v5
474 ; GFX11-NEXT:    v_readfirstlane_b32 s6, v14
475 ; GFX11-NEXT:    v_readfirstlane_b32 s7, v15
476 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
477 ; GFX11-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[4:5]
478 ; GFX11-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[14:15]
479 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
480 ; GFX11-NEXT:    s_and_b32 s0, vcc_lo, s0
481 ; GFX11-NEXT:    s_and_saveexec_b32 s0, s0
482 ; GFX11-NEXT:    image_bvh64_intersect_ray v[0:3], [v[19:20], v21, v[16:18], v[6:8], v[9:11]], s[4:7]
483 ; GFX11-NEXT:    ; implicit-def: $vgpr4
484 ; GFX11-NEXT:    ; implicit-def: $vgpr19_vgpr20
485 ; GFX11-NEXT:    ; implicit-def: $vgpr21
486 ; GFX11-NEXT:    ; implicit-def: $vgpr16_vgpr17_vgpr18
487 ; GFX11-NEXT:    ; implicit-def: $vgpr6_vgpr7_vgpr8
488 ; GFX11-NEXT:    ; implicit-def: $vgpr9_vgpr10_vgpr11
489 ; GFX11-NEXT:    ; implicit-def: $vgpr12_vgpr13_vgpr14_vgpr15
490 ; GFX11-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
491 ; GFX11-NEXT:    s_cbranch_execnz .LBB8_1
492 ; GFX11-NEXT:  ; %bb.2:
493 ; GFX11-NEXT:    s_mov_b32 exec_lo, s1
494 ; GFX11-NEXT:    s_waitcnt vmcnt(0)
495 ; GFX11-NEXT:    ; return to shader part epilog
496   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f32(i64 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> %tdescr)
497   %r = bitcast <4 x i32> %v to <4 x float>
498   ret <4 x float> %r
501 define amdgpu_ps <4 x float> @image_bvh64_intersect_ray_a16_vgpr_descr(i64 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x half> %ray_dir, <3 x half> %ray_inv_dir, <4 x i32> %tdescr) {
502 ; GFX1030-LABEL: image_bvh64_intersect_ray_a16_vgpr_descr:
503 ; GFX1030:       ; %bb.0:
504 ; GFX1030-NEXT:    v_mov_b32_e32 v19, v0
505 ; GFX1030-NEXT:    v_mov_b32_e32 v20, v1
506 ; GFX1030-NEXT:    v_lshrrev_b32_e32 v0, 16, v6
507 ; GFX1030-NEXT:    v_and_b32_e32 v1, 0xffff, v8
508 ; GFX1030-NEXT:    v_mov_b32_e32 v21, v2
509 ; GFX1030-NEXT:    v_and_b32_e32 v2, 0xffff, v9
510 ; GFX1030-NEXT:    v_mov_b32_e32 v22, v3
511 ; GFX1030-NEXT:    v_lshlrev_b32_e32 v0, 16, v0
512 ; GFX1030-NEXT:    v_lshlrev_b32_e32 v1, 16, v1
513 ; GFX1030-NEXT:    v_mov_b32_e32 v23, v4
514 ; GFX1030-NEXT:    v_mov_b32_e32 v24, v5
515 ; GFX1030-NEXT:    v_mov_b32_e32 v17, v10
516 ; GFX1030-NEXT:    v_mov_b32_e32 v18, v11
517 ; GFX1030-NEXT:    v_and_or_b32 v25, 0xffff, v6, v0
518 ; GFX1030-NEXT:    v_and_or_b32 v26, 0xffff, v7, v1
519 ; GFX1030-NEXT:    v_alignbit_b32 v27, v2, v8, 16
520 ; GFX1030-NEXT:    s_mov_b32 s1, exec_lo
521 ; GFX1030-NEXT:  .LBB9_1: ; =>This Inner Loop Header: Depth=1
522 ; GFX1030-NEXT:    v_readfirstlane_b32 s4, v17
523 ; GFX1030-NEXT:    v_readfirstlane_b32 s5, v18
524 ; GFX1030-NEXT:    v_readfirstlane_b32 s6, v12
525 ; GFX1030-NEXT:    v_readfirstlane_b32 s7, v13
526 ; GFX1030-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[17:18]
527 ; GFX1030-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[12:13]
528 ; GFX1030-NEXT:    s_and_b32 s0, vcc_lo, s0
529 ; GFX1030-NEXT:    s_and_saveexec_b32 s0, s0
530 ; GFX1030-NEXT:    image_bvh64_intersect_ray v[0:3], v[19:27], s[4:7] a16
531 ; GFX1030-NEXT:    ; implicit-def: $vgpr17
532 ; GFX1030-NEXT:    ; implicit-def: $vgpr19
533 ; GFX1030-NEXT:    ; implicit-def: $vgpr20
534 ; GFX1030-NEXT:    ; implicit-def: $vgpr21
535 ; GFX1030-NEXT:    ; implicit-def: $vgpr22
536 ; GFX1030-NEXT:    ; implicit-def: $vgpr23
537 ; GFX1030-NEXT:    ; implicit-def: $vgpr24
538 ; GFX1030-NEXT:    ; implicit-def: $vgpr25
539 ; GFX1030-NEXT:    ; implicit-def: $vgpr26
540 ; GFX1030-NEXT:    ; implicit-def: $vgpr27
541 ; GFX1030-NEXT:    ; implicit-def: $vgpr10_vgpr11_vgpr12_vgpr13
542 ; GFX1030-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
543 ; GFX1030-NEXT:    s_cbranch_execnz .LBB9_1
544 ; GFX1030-NEXT:  ; %bb.2:
545 ; GFX1030-NEXT:    s_mov_b32 exec_lo, s1
546 ; GFX1030-NEXT:    s_waitcnt vmcnt(0)
547 ; GFX1030-NEXT:    ; return to shader part epilog
549 ; GFX1013-LABEL: image_bvh64_intersect_ray_a16_vgpr_descr:
550 ; GFX1013:       ; %bb.0:
551 ; GFX1013-NEXT:    v_mov_b32_e32 v18, v10
552 ; GFX1013-NEXT:    v_mov_b32_e32 v19, v11
553 ; GFX1013-NEXT:    v_lshrrev_b32_e32 v10, 16, v6
554 ; GFX1013-NEXT:    v_and_b32_e32 v11, 0xffff, v8
555 ; GFX1013-NEXT:    v_and_b32_e32 v9, 0xffff, v9
556 ; GFX1013-NEXT:    s_mov_b32 s1, exec_lo
557 ; GFX1013-NEXT:    v_lshlrev_b32_e32 v10, 16, v10
558 ; GFX1013-NEXT:    v_lshlrev_b32_e32 v11, 16, v11
559 ; GFX1013-NEXT:    v_alignbit_b32 v8, v9, v8, 16
560 ; GFX1013-NEXT:    v_and_or_b32 v6, 0xffff, v6, v10
561 ; GFX1013-NEXT:    v_and_or_b32 v7, 0xffff, v7, v11
562 ; GFX1013-NEXT:  .LBB9_1: ; =>This Inner Loop Header: Depth=1
563 ; GFX1013-NEXT:    v_readfirstlane_b32 s4, v18
564 ; GFX1013-NEXT:    v_readfirstlane_b32 s5, v19
565 ; GFX1013-NEXT:    v_readfirstlane_b32 s6, v12
566 ; GFX1013-NEXT:    v_readfirstlane_b32 s7, v13
567 ; GFX1013-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[18:19]
568 ; GFX1013-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[12:13]
569 ; GFX1013-NEXT:    s_and_b32 s0, vcc_lo, s0
570 ; GFX1013-NEXT:    s_and_saveexec_b32 s0, s0
571 ; GFX1013-NEXT:    image_bvh64_intersect_ray v[14:17], v[0:8], s[4:7] a16
572 ; GFX1013-NEXT:    ; implicit-def: $vgpr18
573 ; GFX1013-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8
574 ; GFX1013-NEXT:    ; implicit-def: $vgpr10_vgpr11_vgpr12_vgpr13
575 ; GFX1013-NEXT:    s_waitcnt_depctr 0xffe3
576 ; GFX1013-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
577 ; GFX1013-NEXT:    s_cbranch_execnz .LBB9_1
578 ; GFX1013-NEXT:  ; %bb.2:
579 ; GFX1013-NEXT:    s_mov_b32 exec_lo, s1
580 ; GFX1013-NEXT:    s_waitcnt vmcnt(0)
581 ; GFX1013-NEXT:    v_mov_b32_e32 v0, v14
582 ; GFX1013-NEXT:    v_mov_b32_e32 v1, v15
583 ; GFX1013-NEXT:    v_mov_b32_e32 v2, v16
584 ; GFX1013-NEXT:    v_mov_b32_e32 v3, v17
585 ; GFX1013-NEXT:    ; return to shader part epilog
587 ; GFX11-LABEL: image_bvh64_intersect_ray_a16_vgpr_descr:
588 ; GFX11:       ; %bb.0:
589 ; GFX11-NEXT:    v_dual_mov_b32 v17, v0 :: v_dual_mov_b32 v18, v1
590 ; GFX11-NEXT:    v_and_b32_e32 v0, 0xffff, v8
591 ; GFX11-NEXT:    v_and_b32_e32 v1, 0xffff, v9
592 ; GFX11-NEXT:    v_dual_mov_b32 v19, v2 :: v_dual_mov_b32 v14, v3
593 ; GFX11-NEXT:    v_dual_mov_b32 v15, v4 :: v_dual_mov_b32 v16, v5
594 ; GFX11-NEXT:    v_dual_mov_b32 v4, v10 :: v_dual_mov_b32 v5, v11
595 ; GFX11-NEXT:    v_lshl_or_b32 v20, v6, 16, v0
596 ; GFX11-NEXT:    v_perm_b32 v21, v6, v8, 0x7060302
597 ; GFX11-NEXT:    v_lshl_or_b32 v22, v7, 16, v1
598 ; GFX11-NEXT:    s_mov_b32 s1, exec_lo
599 ; GFX11-NEXT:  .LBB9_1: ; =>This Inner Loop Header: Depth=1
600 ; GFX11-NEXT:    v_readfirstlane_b32 s4, v4
601 ; GFX11-NEXT:    v_readfirstlane_b32 s5, v5
602 ; GFX11-NEXT:    v_readfirstlane_b32 s6, v12
603 ; GFX11-NEXT:    v_readfirstlane_b32 s7, v13
604 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
605 ; GFX11-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[4:5]
606 ; GFX11-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[12:13]
607 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
608 ; GFX11-NEXT:    s_and_b32 s0, vcc_lo, s0
609 ; GFX11-NEXT:    s_and_saveexec_b32 s0, s0
610 ; GFX11-NEXT:    image_bvh64_intersect_ray v[0:3], [v[17:18], v19, v[14:16], v[20:22]], s[4:7] a16
611 ; GFX11-NEXT:    ; implicit-def: $vgpr4
612 ; GFX11-NEXT:    ; implicit-def: $vgpr17_vgpr18
613 ; GFX11-NEXT:    ; implicit-def: $vgpr19
614 ; GFX11-NEXT:    ; implicit-def: $vgpr14_vgpr15_vgpr16
615 ; GFX11-NEXT:    ; implicit-def: $vgpr20_vgpr21_vgpr22
616 ; GFX11-NEXT:    ; implicit-def: $vgpr10_vgpr11_vgpr12_vgpr13
617 ; GFX11-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
618 ; GFX11-NEXT:    s_cbranch_execnz .LBB9_1
619 ; GFX11-NEXT:  ; %bb.2:
620 ; GFX11-NEXT:    s_mov_b32 exec_lo, s1
621 ; GFX11-NEXT:    s_waitcnt vmcnt(0)
622 ; GFX11-NEXT:    ; return to shader part epilog
623   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f16(i64 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x half> %ray_dir, <3 x half> %ray_inv_dir, <4 x i32> %tdescr)
624   %r = bitcast <4 x i32> %v to <4 x float>
625   ret <4 x float> %r
628 define amdgpu_kernel void @image_bvh_intersect_ray_nsa_reassign(ptr %p_node_ptr, ptr %p_ray, <4 x i32> inreg %tdescr) {
629 ; GFX1030-LABEL: image_bvh_intersect_ray_nsa_reassign:
630 ; GFX1030:       ; %bb.0:
631 ; GFX1030-NEXT:    s_load_dwordx8 s[0:7], s[4:5], 0x24
632 ; GFX1030-NEXT:    v_lshlrev_b32_e32 v4, 2, v0
633 ; GFX1030-NEXT:    v_mov_b32_e32 v5, 0x40400000
634 ; GFX1030-NEXT:    v_mov_b32_e32 v6, 4.0
635 ; GFX1030-NEXT:    v_mov_b32_e32 v7, 0x40a00000
636 ; GFX1030-NEXT:    v_mov_b32_e32 v8, 0x40c00000
637 ; GFX1030-NEXT:    v_mov_b32_e32 v9, 0x40e00000
638 ; GFX1030-NEXT:    v_mov_b32_e32 v10, 0x41000000
639 ; GFX1030-NEXT:    s_waitcnt lgkmcnt(0)
640 ; GFX1030-NEXT:    v_mov_b32_e32 v0, s0
641 ; GFX1030-NEXT:    v_mov_b32_e32 v1, s1
642 ; GFX1030-NEXT:    v_mov_b32_e32 v2, s2
643 ; GFX1030-NEXT:    v_mov_b32_e32 v3, s3
644 ; GFX1030-NEXT:    v_add_co_u32 v0, vcc_lo, v0, v4
645 ; GFX1030-NEXT:    v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
646 ; GFX1030-NEXT:    v_add_co_u32 v2, vcc_lo, v2, v4
647 ; GFX1030-NEXT:    v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
648 ; GFX1030-NEXT:    v_mov_b32_e32 v4, 2.0
649 ; GFX1030-NEXT:    flat_load_dword v0, v[0:1]
650 ; GFX1030-NEXT:    flat_load_dword v1, v[2:3]
651 ; GFX1030-NEXT:    v_mov_b32_e32 v2, 0
652 ; GFX1030-NEXT:    v_mov_b32_e32 v3, 1.0
653 ; GFX1030-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
654 ; GFX1030-NEXT:    image_bvh_intersect_ray v[0:3], v[0:10], s[4:7]
655 ; GFX1030-NEXT:    s_waitcnt vmcnt(0)
656 ; GFX1030-NEXT:    flat_store_dwordx4 v[0:1], v[0:3]
657 ; GFX1030-NEXT:    s_endpgm
659 ; GFX1013-LABEL: image_bvh_intersect_ray_nsa_reassign:
660 ; GFX1013:       ; %bb.0:
661 ; GFX1013-NEXT:    s_load_dwordx8 s[8:15], s[4:5], 0x24
662 ; GFX1013-NEXT:    v_lshlrev_b32_e32 v6, 2, v0
663 ; GFX1013-NEXT:    v_mov_b32_e32 v7, 0x40a00000
664 ; GFX1013-NEXT:    v_mov_b32_e32 v8, 0x40c00000
665 ; GFX1013-NEXT:    v_mov_b32_e32 v9, 0x40e00000
666 ; GFX1013-NEXT:    v_mov_b32_e32 v10, 0x41000000
667 ; GFX1013-NEXT:    s_waitcnt lgkmcnt(0)
668 ; GFX1013-NEXT:    v_mov_b32_e32 v0, s8
669 ; GFX1013-NEXT:    v_mov_b32_e32 v1, s9
670 ; GFX1013-NEXT:    v_mov_b32_e32 v2, s10
671 ; GFX1013-NEXT:    v_mov_b32_e32 v3, s11
672 ; GFX1013-NEXT:    v_add_co_u32 v4, vcc_lo, v0, v6
673 ; GFX1013-NEXT:    v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
674 ; GFX1013-NEXT:    v_add_co_u32 v2, vcc_lo, v2, v6
675 ; GFX1013-NEXT:    v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
676 ; GFX1013-NEXT:    v_mov_b32_e32 v6, 4.0
677 ; GFX1013-NEXT:    flat_load_dword v0, v[4:5]
678 ; GFX1013-NEXT:    flat_load_dword v1, v[2:3]
679 ; GFX1013-NEXT:    v_mov_b32_e32 v2, 0
680 ; GFX1013-NEXT:    v_mov_b32_e32 v3, 1.0
681 ; GFX1013-NEXT:    v_mov_b32_e32 v4, 2.0
682 ; GFX1013-NEXT:    v_mov_b32_e32 v5, 0x40400000
683 ; GFX1013-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
684 ; GFX1013-NEXT:    image_bvh_intersect_ray v[0:3], v[0:10], s[12:15]
685 ; GFX1013-NEXT:    s_waitcnt vmcnt(0)
686 ; GFX1013-NEXT:    flat_store_dwordx4 v[0:1], v[0:3]
687 ; GFX1013-NEXT:    s_endpgm
689 ; GFX11-LABEL: image_bvh_intersect_ray_nsa_reassign:
690 ; GFX11:       ; %bb.0:
691 ; GFX11-NEXT:    s_load_b256 s[0:7], s[4:5], 0x24
692 ; GFX11-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
693 ; GFX11-NEXT:    s_mov_b32 s10, 0x40a00000
694 ; GFX11-NEXT:    s_mov_b32 s9, 4.0
695 ; GFX11-NEXT:    s_mov_b32 s8, 0x40400000
696 ; GFX11-NEXT:    s_mov_b32 s12, 0x40c00000
697 ; GFX11-NEXT:    v_lshlrev_b32_e32 v4, 2, v0
698 ; GFX11-NEXT:    s_mov_b32 s14, 0x41000000
699 ; GFX11-NEXT:    s_mov_b32 s13, 0x40e00000
700 ; GFX11-NEXT:    v_mov_b32_e32 v6, s12
701 ; GFX11-NEXT:    v_dual_mov_b32 v8, s14 :: v_dual_mov_b32 v7, s13
702 ; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
703 ; GFX11-NEXT:    v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
704 ; GFX11-NEXT:    s_mov_b32 s2, 2.0
705 ; GFX11-NEXT:    v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
706 ; GFX11-NEXT:    s_mov_b32 s0, 0
707 ; GFX11-NEXT:    s_mov_b32 s1, 1.0
708 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
709 ; GFX11-NEXT:    v_add_co_u32 v0, vcc_lo, v0, v4
710 ; GFX11-NEXT:    v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
711 ; GFX11-NEXT:    v_add_co_u32 v2, vcc_lo, v2, v4
712 ; GFX11-NEXT:    v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
713 ; GFX11-NEXT:    flat_load_b32 v9, v[0:1]
714 ; GFX11-NEXT:    flat_load_b32 v10, v[2:3]
715 ; GFX11-NEXT:    v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v3, s8
716 ; GFX11-NEXT:    v_dual_mov_b32 v1, s1 :: v_dual_mov_b32 v2, s2
717 ; GFX11-NEXT:    v_dual_mov_b32 v4, s9 :: v_dual_mov_b32 v5, s10
718 ; GFX11-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
719 ; GFX11-NEXT:    image_bvh_intersect_ray v[0:3], [v9, v10, v[0:2], v[3:5], v[6:8]], s[4:7]
720 ; GFX11-NEXT:    s_waitcnt vmcnt(0)
721 ; GFX11-NEXT:    flat_store_b128 v[0:1], v[0:3]
722 ; GFX11-NEXT:    s_endpgm
723   %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
724   %gep_node_ptr = getelementptr inbounds i32, ptr %p_node_ptr, i32 %lid
725   %node_ptr = load i32, ptr %gep_node_ptr, align 4
726   %gep_ray = getelementptr inbounds float, ptr %p_ray, i32 %lid
727   %ray_extent = load float, ptr %gep_ray, align 4
728   %ray_origin0 = insertelement <3 x float> undef, float 0.0, i32 0
729   %ray_origin1 = insertelement <3 x float> %ray_origin0, float 1.0, i32 1
730   %ray_origin = insertelement <3 x float> %ray_origin1, float 2.0, i32 2
731   %ray_dir0 = insertelement <3 x float> undef, float 3.0, i32 0
732   %ray_dir1 = insertelement <3 x float> %ray_dir0, float 4.0, i32 1
733   %ray_dir = insertelement <3 x float> %ray_dir1, float 5.0, i32 2
734   %ray_inv_dir0 = insertelement <3 x float> undef, float 6.0, i32 0
735   %ray_inv_dir1 = insertelement <3 x float> %ray_inv_dir0, float 7.0, i32 1
736   %ray_inv_dir = insertelement <3 x float> %ray_inv_dir1, float 8.0, i32 2
737   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f32(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> %tdescr)
738   store <4 x i32> %v, ptr undef
739   ret void
742 define amdgpu_kernel void @image_bvh_intersect_ray_a16_nsa_reassign(ptr %p_node_ptr, ptr %p_ray, <4 x i32> inreg %tdescr) {
743 ; GFX1030-LABEL: image_bvh_intersect_ray_a16_nsa_reassign:
744 ; GFX1030:       ; %bb.0:
745 ; GFX1030-NEXT:    s_load_dwordx8 s[0:7], s[4:5], 0x24
746 ; GFX1030-NEXT:    v_lshlrev_b32_e32 v4, 2, v0
747 ; GFX1030-NEXT:    v_mov_b32_e32 v5, 0x44004200
748 ; GFX1030-NEXT:    v_mov_b32_e32 v6, 0x46004500
749 ; GFX1030-NEXT:    v_mov_b32_e32 v7, 0x48004700
750 ; GFX1030-NEXT:    s_waitcnt lgkmcnt(0)
751 ; GFX1030-NEXT:    v_mov_b32_e32 v0, s0
752 ; GFX1030-NEXT:    v_mov_b32_e32 v1, s1
753 ; GFX1030-NEXT:    v_mov_b32_e32 v2, s2
754 ; GFX1030-NEXT:    v_mov_b32_e32 v3, s3
755 ; GFX1030-NEXT:    v_add_co_u32 v0, vcc_lo, v0, v4
756 ; GFX1030-NEXT:    v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
757 ; GFX1030-NEXT:    v_add_co_u32 v2, vcc_lo, v2, v4
758 ; GFX1030-NEXT:    v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
759 ; GFX1030-NEXT:    v_mov_b32_e32 v4, 2.0
760 ; GFX1030-NEXT:    flat_load_dword v0, v[0:1]
761 ; GFX1030-NEXT:    flat_load_dword v1, v[2:3]
762 ; GFX1030-NEXT:    v_mov_b32_e32 v2, 0
763 ; GFX1030-NEXT:    v_mov_b32_e32 v3, 1.0
764 ; GFX1030-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
765 ; GFX1030-NEXT:    image_bvh_intersect_ray v[0:3], v[0:7], s[4:7] a16
766 ; GFX1030-NEXT:    s_waitcnt vmcnt(0)
767 ; GFX1030-NEXT:    flat_store_dwordx4 v[0:1], v[0:3]
768 ; GFX1030-NEXT:    s_endpgm
770 ; GFX1013-LABEL: image_bvh_intersect_ray_a16_nsa_reassign:
771 ; GFX1013:       ; %bb.0:
772 ; GFX1013-NEXT:    s_load_dwordx8 s[8:15], s[4:5], 0x24
773 ; GFX1013-NEXT:    v_lshlrev_b32_e32 v6, 2, v0
774 ; GFX1013-NEXT:    v_mov_b32_e32 v7, 0x48004700
775 ; GFX1013-NEXT:    s_waitcnt lgkmcnt(0)
776 ; GFX1013-NEXT:    v_mov_b32_e32 v0, s8
777 ; GFX1013-NEXT:    v_mov_b32_e32 v1, s9
778 ; GFX1013-NEXT:    v_mov_b32_e32 v2, s10
779 ; GFX1013-NEXT:    v_mov_b32_e32 v3, s11
780 ; GFX1013-NEXT:    v_add_co_u32 v4, vcc_lo, v0, v6
781 ; GFX1013-NEXT:    v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
782 ; GFX1013-NEXT:    v_add_co_u32 v2, vcc_lo, v2, v6
783 ; GFX1013-NEXT:    v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
784 ; GFX1013-NEXT:    v_mov_b32_e32 v6, 0x46004500
785 ; GFX1013-NEXT:    flat_load_dword v0, v[4:5]
786 ; GFX1013-NEXT:    flat_load_dword v1, v[2:3]
787 ; GFX1013-NEXT:    v_mov_b32_e32 v2, 0
788 ; GFX1013-NEXT:    v_mov_b32_e32 v3, 1.0
789 ; GFX1013-NEXT:    v_mov_b32_e32 v4, 2.0
790 ; GFX1013-NEXT:    v_mov_b32_e32 v5, 0x44004200
791 ; GFX1013-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
792 ; GFX1013-NEXT:    image_bvh_intersect_ray v[0:3], v[0:7], s[12:15] a16
793 ; GFX1013-NEXT:    s_waitcnt vmcnt(0)
794 ; GFX1013-NEXT:    flat_store_dwordx4 v[0:1], v[0:3]
795 ; GFX1013-NEXT:    s_endpgm
797 ; GFX11-LABEL: image_bvh_intersect_ray_a16_nsa_reassign:
798 ; GFX11:       ; %bb.0:
799 ; GFX11-NEXT:    s_load_b256 s[0:7], s[4:5], 0x24
800 ; GFX11-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
801 ; GFX11-NEXT:    s_mov_b32 s8, 0x42004600
802 ; GFX11-NEXT:    s_mov_b32 s9, 0x44004700
803 ; GFX11-NEXT:    s_mov_b32 s10, 0x45004800
804 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_1)
805 ; GFX11-NEXT:    v_lshlrev_b32_e32 v4, 2, v0
806 ; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
807 ; GFX11-NEXT:    v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
808 ; GFX11-NEXT:    s_mov_b32 s2, 2.0
809 ; GFX11-NEXT:    v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
810 ; GFX11-NEXT:    s_mov_b32 s0, 0
811 ; GFX11-NEXT:    s_mov_b32 s1, 1.0
812 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
813 ; GFX11-NEXT:    v_add_co_u32 v0, vcc_lo, v0, v4
814 ; GFX11-NEXT:    v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
815 ; GFX11-NEXT:    v_add_co_u32 v2, vcc_lo, v2, v4
816 ; GFX11-NEXT:    v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
817 ; GFX11-NEXT:    flat_load_b32 v6, v[0:1]
818 ; GFX11-NEXT:    flat_load_b32 v7, v[2:3]
819 ; GFX11-NEXT:    v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v3, s8
820 ; GFX11-NEXT:    v_dual_mov_b32 v1, s1 :: v_dual_mov_b32 v2, s2
821 ; GFX11-NEXT:    v_dual_mov_b32 v4, s9 :: v_dual_mov_b32 v5, s10
822 ; GFX11-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
823 ; GFX11-NEXT:    image_bvh_intersect_ray v[0:3], [v6, v7, v[0:2], v[3:5]], s[4:7] a16
824 ; GFX11-NEXT:    s_waitcnt vmcnt(0)
825 ; GFX11-NEXT:    flat_store_b128 v[0:1], v[0:3]
826 ; GFX11-NEXT:    s_endpgm
827   %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
828   %gep_node_ptr = getelementptr inbounds i32, ptr %p_node_ptr, i32 %lid
829   %node_ptr = load i32, ptr %gep_node_ptr, align 4
830   %gep_ray = getelementptr inbounds float, ptr %p_ray, i32 %lid
831   %ray_extent = load float, ptr %gep_ray, align 4
832   %ray_origin0 = insertelement <3 x float> undef, float 0.0, i32 0
833   %ray_origin1 = insertelement <3 x float> %ray_origin0, float 1.0, i32 1
834   %ray_origin = insertelement <3 x float> %ray_origin1, float 2.0, i32 2
835   %ray_dir0 = insertelement <3 x half> undef, half 3.0, i32 0
836   %ray_dir1 = insertelement <3 x half> %ray_dir0, half 4.0, i32 1
837   %ray_dir = insertelement <3 x half> %ray_dir1, half 5.0, i32 2
838   %ray_inv_dir0 = insertelement <3 x half> undef, half 6.0, i32 0
839   %ray_inv_dir1 = insertelement <3 x half> %ray_inv_dir0, half 7.0, i32 1
840   %ray_inv_dir = insertelement <3 x half> %ray_inv_dir1, half 8.0, i32 2
841   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f16(i32 %node_ptr, float %ray_extent, <3 x float> %ray_origin, <3 x half> %ray_dir, <3 x half> %ray_inv_dir, <4 x i32> %tdescr)
842   store <4 x i32> %v, ptr undef
843   ret void
846 define amdgpu_kernel void @image_bvh64_intersect_ray_nsa_reassign(ptr %p_ray, <4 x i32> inreg %tdescr) {
847 ; GFX10-LABEL: image_bvh64_intersect_ray_nsa_reassign:
848 ; GFX10:       ; %bb.0:
849 ; GFX10-NEXT:    s_clause 0x1
850 ; GFX10-NEXT:    s_load_dwordx2 s[6:7], s[4:5], 0x24
851 ; GFX10-NEXT:    s_load_dwordx4 s[0:3], s[4:5], 0x34
852 ; GFX10-NEXT:    v_lshlrev_b32_e32 v2, 2, v0
853 ; GFX10-NEXT:    v_mov_b32_e32 v3, 0
854 ; GFX10-NEXT:    v_mov_b32_e32 v4, 1.0
855 ; GFX10-NEXT:    v_mov_b32_e32 v5, 2.0
856 ; GFX10-NEXT:    v_mov_b32_e32 v6, 0x40400000
857 ; GFX10-NEXT:    v_mov_b32_e32 v7, 4.0
858 ; GFX10-NEXT:    v_mov_b32_e32 v8, 0x40a00000
859 ; GFX10-NEXT:    v_mov_b32_e32 v9, 0x40c00000
860 ; GFX10-NEXT:    v_mov_b32_e32 v10, 0x40e00000
861 ; GFX10-NEXT:    v_mov_b32_e32 v11, 0x41000000
862 ; GFX10-NEXT:    s_waitcnt lgkmcnt(0)
863 ; GFX10-NEXT:    v_mov_b32_e32 v0, s6
864 ; GFX10-NEXT:    v_mov_b32_e32 v1, s7
865 ; GFX10-NEXT:    v_add_co_u32 v0, vcc_lo, v0, v2
866 ; GFX10-NEXT:    v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
867 ; GFX10-NEXT:    flat_load_dword v2, v[0:1]
868 ; GFX10-NEXT:    v_mov_b32_e32 v0, 0xb36211c7
869 ; GFX10-NEXT:    v_bfrev_b32_e32 v1, 4.0
870 ; GFX10-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
871 ; GFX10-NEXT:    image_bvh64_intersect_ray v[0:3], v[0:11], s[0:3]
872 ; GFX10-NEXT:    s_waitcnt vmcnt(0)
873 ; GFX10-NEXT:    flat_store_dwordx4 v[0:1], v[0:3]
874 ; GFX10-NEXT:    s_endpgm
876 ; GFX11-LABEL: image_bvh64_intersect_ray_nsa_reassign:
877 ; GFX11:       ; %bb.0:
878 ; GFX11-NEXT:    s_clause 0x1
879 ; GFX11-NEXT:    s_load_b64 s[6:7], s[4:5], 0x24
880 ; GFX11-NEXT:    s_load_b128 s[0:3], s[4:5], 0x34
881 ; GFX11-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
882 ; GFX11-NEXT:    s_mov_b32 s5, 1.0
883 ; GFX11-NEXT:    s_mov_b32 s4, 0
884 ; GFX11-NEXT:    v_mov_b32_e32 v9, 0xb36211c7
885 ; GFX11-NEXT:    s_mov_b32 s8, 0x40400000
886 ; GFX11-NEXT:    v_lshlrev_b32_e32 v2, 2, v0
887 ; GFX11-NEXT:    s_mov_b32 s12, 0x40c00000
888 ; GFX11-NEXT:    s_mov_b32 s10, 0x40a00000
889 ; GFX11-NEXT:    s_mov_b32 s9, 4.0
890 ; GFX11-NEXT:    s_mov_b32 s14, 0x41000000
891 ; GFX11-NEXT:    s_mov_b32 s13, 0x40e00000
892 ; GFX11-NEXT:    v_mov_b32_e32 v6, s12
893 ; GFX11-NEXT:    v_bfrev_b32_e32 v10, 4.0
894 ; GFX11-NEXT:    v_dual_mov_b32 v8, s14 :: v_dual_mov_b32 v3, s8
895 ; GFX11-NEXT:    v_dual_mov_b32 v4, s9 :: v_dual_mov_b32 v7, s13
896 ; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
897 ; GFX11-NEXT:    v_dual_mov_b32 v5, s10 :: v_dual_mov_b32 v0, s6
898 ; GFX11-NEXT:    v_mov_b32_e32 v1, s7
899 ; GFX11-NEXT:    s_mov_b32 s6, 2.0
900 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
901 ; GFX11-NEXT:    v_add_co_u32 v0, vcc_lo, v0, v2
902 ; GFX11-NEXT:    v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
903 ; GFX11-NEXT:    flat_load_b32 v11, v[0:1]
904 ; GFX11-NEXT:    v_dual_mov_b32 v0, s4 :: v_dual_mov_b32 v1, s5
905 ; GFX11-NEXT:    v_mov_b32_e32 v2, s6
906 ; GFX11-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
907 ; GFX11-NEXT:    image_bvh64_intersect_ray v[0:3], [v[9:10], v11, v[0:2], v[3:5], v[6:8]], s[0:3]
908 ; GFX11-NEXT:    s_waitcnt vmcnt(0)
909 ; GFX11-NEXT:    flat_store_b128 v[0:1], v[0:3]
910 ; GFX11-NEXT:    s_endpgm
911   %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
912   %gep_ray = getelementptr inbounds float, ptr %p_ray, i32 %lid
913   %ray_extent = load float, ptr %gep_ray, align 4
914   %ray_origin0 = insertelement <3 x float> undef, float 0.0, i32 0
915   %ray_origin1 = insertelement <3 x float> %ray_origin0, float 1.0, i32 1
916   %ray_origin = insertelement <3 x float> %ray_origin1, float 2.0, i32 2
917   %ray_dir0 = insertelement <3 x float> undef, float 3.0, i32 0
918   %ray_dir1 = insertelement <3 x float> %ray_dir0, float 4.0, i32 1
919   %ray_dir = insertelement <3 x float> %ray_dir1, float 5.0, i32 2
920   %ray_inv_dir0 = insertelement <3 x float> undef, float 6.0, i32 0
921   %ray_inv_dir1 = insertelement <3 x float> %ray_inv_dir0, float 7.0, i32 1
922   %ray_inv_dir = insertelement <3 x float> %ray_inv_dir1, float 8.0, i32 2
923   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f32(i64 1111111111111, float %ray_extent, <3 x float> %ray_origin, <3 x float> %ray_dir, <3 x float> %ray_inv_dir, <4 x i32> %tdescr)
924   store <4 x i32> %v, ptr undef
925   ret void
928 define amdgpu_kernel void @image_bvh64_intersect_ray_a16_nsa_reassign(ptr %p_ray, <4 x i32> inreg %tdescr) {
929 ; GFX10-LABEL: image_bvh64_intersect_ray_a16_nsa_reassign:
930 ; GFX10:       ; %bb.0:
931 ; GFX10-NEXT:    s_clause 0x1
932 ; GFX10-NEXT:    s_load_dwordx2 s[6:7], s[4:5], 0x24
933 ; GFX10-NEXT:    s_load_dwordx4 s[0:3], s[4:5], 0x34
934 ; GFX10-NEXT:    v_lshlrev_b32_e32 v2, 2, v0
935 ; GFX10-NEXT:    v_mov_b32_e32 v3, 0
936 ; GFX10-NEXT:    v_mov_b32_e32 v4, 1.0
937 ; GFX10-NEXT:    v_mov_b32_e32 v5, 2.0
938 ; GFX10-NEXT:    v_mov_b32_e32 v6, 0x44004200
939 ; GFX10-NEXT:    v_mov_b32_e32 v7, 0x46004500
940 ; GFX10-NEXT:    v_mov_b32_e32 v8, 0x48004700
941 ; GFX10-NEXT:    s_waitcnt lgkmcnt(0)
942 ; GFX10-NEXT:    v_mov_b32_e32 v0, s6
943 ; GFX10-NEXT:    v_mov_b32_e32 v1, s7
944 ; GFX10-NEXT:    v_add_co_u32 v0, vcc_lo, v0, v2
945 ; GFX10-NEXT:    v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
946 ; GFX10-NEXT:    flat_load_dword v2, v[0:1]
947 ; GFX10-NEXT:    v_mov_b32_e32 v0, 0xb36211c6
948 ; GFX10-NEXT:    v_bfrev_b32_e32 v1, 4.0
949 ; GFX10-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
950 ; GFX10-NEXT:    image_bvh64_intersect_ray v[0:3], v[0:8], s[0:3] a16
951 ; GFX10-NEXT:    s_waitcnt vmcnt(0)
952 ; GFX10-NEXT:    flat_store_dwordx4 v[0:1], v[0:3]
953 ; GFX10-NEXT:    s_endpgm
955 ; GFX11-LABEL: image_bvh64_intersect_ray_a16_nsa_reassign:
956 ; GFX11:       ; %bb.0:
957 ; GFX11-NEXT:    s_clause 0x1
958 ; GFX11-NEXT:    s_load_b64 s[6:7], s[4:5], 0x24
959 ; GFX11-NEXT:    s_load_b128 s[0:3], s[4:5], 0x34
960 ; GFX11-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
961 ; GFX11-NEXT:    s_mov_b32 s5, 1.0
962 ; GFX11-NEXT:    s_mov_b32 s4, 0
963 ; GFX11-NEXT:    s_mov_b32 s8, 0x42004600
964 ; GFX11-NEXT:    s_mov_b32 s9, 0x44004700
965 ; GFX11-NEXT:    v_lshlrev_b32_e32 v2, 2, v0
966 ; GFX11-NEXT:    s_mov_b32 s10, 0x45004800
967 ; GFX11-NEXT:    v_mov_b32_e32 v6, 0xb36211c6
968 ; GFX11-NEXT:    v_bfrev_b32_e32 v7, 4.0
969 ; GFX11-NEXT:    v_mov_b32_e32 v3, s8
970 ; GFX11-NEXT:    v_dual_mov_b32 v5, s10 :: v_dual_mov_b32 v4, s9
971 ; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
972 ; GFX11-NEXT:    v_dual_mov_b32 v0, s6 :: v_dual_mov_b32 v1, s7
973 ; GFX11-NEXT:    s_mov_b32 s6, 2.0
974 ; GFX11-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
975 ; GFX11-NEXT:    v_add_co_u32 v0, vcc_lo, v0, v2
976 ; GFX11-NEXT:    v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
977 ; GFX11-NEXT:    flat_load_b32 v8, v[0:1]
978 ; GFX11-NEXT:    v_dual_mov_b32 v0, s4 :: v_dual_mov_b32 v1, s5
979 ; GFX11-NEXT:    v_mov_b32_e32 v2, s6
980 ; GFX11-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
981 ; GFX11-NEXT:    image_bvh64_intersect_ray v[0:3], [v[6:7], v8, v[0:2], v[3:5]], s[0:3] a16
982 ; GFX11-NEXT:    s_waitcnt vmcnt(0)
983 ; GFX11-NEXT:    flat_store_b128 v[0:1], v[0:3]
984 ; GFX11-NEXT:    s_endpgm
985   %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
986   %gep_ray = getelementptr inbounds float, ptr %p_ray, i32 %lid
987   %ray_extent = load float, ptr %gep_ray, align 4
988   %ray_origin0 = insertelement <3 x float> undef, float 0.0, i32 0
989   %ray_origin1 = insertelement <3 x float> %ray_origin0, float 1.0, i32 1
990   %ray_origin = insertelement <3 x float> %ray_origin1, float 2.0, i32 2
991   %ray_dir0 = insertelement <3 x half> undef, half 3.0, i32 0
992   %ray_dir1 = insertelement <3 x half> %ray_dir0, half 4.0, i32 1
993   %ray_dir = insertelement <3 x half> %ray_dir1, half 5.0, i32 2
994   %ray_inv_dir0 = insertelement <3 x half> undef, half 6.0, i32 0
995   %ray_inv_dir1 = insertelement <3 x half> %ray_inv_dir0, half 7.0, i32 1
996   %ray_inv_dir = insertelement <3 x half> %ray_inv_dir1, half 8.0, i32 2
997   %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f16(i64 1111111111110, float %ray_extent, <3 x float> %ray_origin, <3 x half> %ray_dir, <3 x half> %ray_inv_dir, <4 x i32> %tdescr)
998   store <4 x i32> %v, ptr undef
999   ret void