|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| 2 | +; RUN: llc -global-isel -march=amdgcn -mcpu=gfx1030 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s |
| 3 | + |
| 4 | +; uint4 llvm.amdgcn.image.bvh.intersect.ray.i32.v4f32(uint node_ptr, float ray_extent, float4 ray_origin, float4 ray_dir, float4 ray_inv_dir, uint4 texture_descr) |
| 5 | +; uint4 llvm.amdgcn.image.bvh.intersect.ray.i32.v4f16(uint node_ptr, float ray_extent, float4 ray_origin, half4 ray_dir, half4 ray_inv_dir, uint4 texture_descr) |
| 6 | +; uint4 llvm.amdgcn.image.bvh.intersect.ray.i64.v4f32(ulong node_ptr, float ray_extent, float4 ray_origin, float4 ray_dir, float4 ray_inv_dir, uint4 texture_descr) |
| 7 | +; uint4 llvm.amdgcn.image.bvh.intersect.ray.i64.v4f16(ulong node_ptr, float ray_extent, float4 ray_origin, half4 ray_dir, half4 ray_inv_dir, uint4 texture_descr) |
| 8 | + |
| 9 | +declare <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f32(i32, float, <4 x float>, <4 x float>, <4 x float>, <4 x i32>) |
| 10 | +declare <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f16(i32, float, <4 x float>, <4 x half>, <4 x half>, <4 x i32>) |
| 11 | +declare <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f32(i64, float, <4 x float>, <4 x float>, <4 x float>, <4 x i32>) |
| 12 | +declare <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f16(i64, float, <4 x float>, <4 x half>, <4 x half>, <4 x i32>) |
| 13 | + |
| 14 | +define amdgpu_ps <4 x float> @image_bvh_intersect_ray(i32 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x float> %ray_dir, <4 x float> %ray_inv_dir, <4 x i32> inreg %tdescr) { |
| 15 | +; GCN-LABEL: image_bvh_intersect_ray: |
| 16 | +; GCN: ; %bb.0: |
| 17 | +; GCN-NEXT: image_bvh_intersect_ray v[0:3], [v0, v1, v2, v3, v4, v6, v7, v8, v10, v11, v12], s[0:3] |
| 18 | +; GCN-NEXT: ; implicit-def: $vcc_hi |
| 19 | +; GCN-NEXT: s_waitcnt vmcnt(0) |
| 20 | +; GCN-NEXT: ; return to shader part epilog |
| 21 | + %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f32(i32 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x float> %ray_dir, <4 x float> %ray_inv_dir, <4 x i32> %tdescr) |
| 22 | + %r = bitcast <4 x i32> %v to <4 x float> |
| 23 | + ret <4 x float> %r |
| 24 | +} |
| 25 | + |
| 26 | +define amdgpu_ps <4 x float> @image_bvh_intersect_ray_a16(i32 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x half> %ray_dir, <4 x half> %ray_inv_dir, <4 x i32> inreg %tdescr) { |
| 27 | +; GCN-LABEL: image_bvh_intersect_ray_a16: |
| 28 | +; GCN: ; %bb.0: |
| 29 | +; GCN-NEXT: s_mov_b32 s4, 0xffff |
| 30 | +; GCN-NEXT: v_lshrrev_b32_e32 v5, 16, v6 |
| 31 | +; GCN-NEXT: v_and_b32_e32 v10, s4, v8 |
| 32 | +; GCN-NEXT: v_lshrrev_b32_e32 v8, 16, v8 |
| 33 | +; GCN-NEXT: v_and_b32_e32 v9, s4, v9 |
| 34 | +; GCN-NEXT: ; implicit-def: $vcc_hi |
| 35 | +; GCN-NEXT: v_lshlrev_b32_e32 v5, 16, v5 |
| 36 | +; GCN-NEXT: v_lshlrev_b32_e32 v10, 16, v10 |
| 37 | +; GCN-NEXT: v_and_or_b32 v5, v6, s4, v5 |
| 38 | +; GCN-NEXT: v_and_or_b32 v6, v7, s4, v10 |
| 39 | +; GCN-NEXT: v_lshl_or_b32 v7, v9, 16, v8 |
| 40 | +; GCN-NEXT: image_bvh_intersect_ray v[0:3], v[0:7], s[0:3] a16 |
| 41 | +; GCN-NEXT: s_waitcnt vmcnt(0) |
| 42 | +; GCN-NEXT: ; return to shader part epilog |
| 43 | + %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f16(i32 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x half> %ray_dir, <4 x half> %ray_inv_dir, <4 x i32> %tdescr) |
| 44 | + %r = bitcast <4 x i32> %v to <4 x float> |
| 45 | + ret <4 x float> %r |
| 46 | +} |
| 47 | + |
| 48 | +define amdgpu_ps <4 x float> @image_bvh64_intersect_ray(i64 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x float> %ray_dir, <4 x float> %ray_inv_dir, <4 x i32> inreg %tdescr) { |
| 49 | +; GCN-LABEL: image_bvh64_intersect_ray: |
| 50 | +; GCN: ; %bb.0: |
| 51 | +; GCN-NEXT: image_bvh64_intersect_ray v[0:3], [v0, v1, v2, v3, v4, v5, v7, v8, v9, v11, v12, v13], s[0:3] |
| 52 | +; GCN-NEXT: ; implicit-def: $vcc_hi |
| 53 | +; GCN-NEXT: s_waitcnt vmcnt(0) |
| 54 | +; GCN-NEXT: ; return to shader part epilog |
| 55 | + %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f32(i64 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x float> %ray_dir, <4 x float> %ray_inv_dir, <4 x i32> %tdescr) |
| 56 | + %r = bitcast <4 x i32> %v to <4 x float> |
| 57 | + ret <4 x float> %r |
| 58 | +} |
| 59 | + |
| 60 | +define amdgpu_ps <4 x float> @image_bvh64_intersect_ray_a16(i64 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x half> %ray_dir, <4 x half> %ray_inv_dir, <4 x i32> inreg %tdescr) { |
| 61 | +; GCN-LABEL: image_bvh64_intersect_ray_a16: |
| 62 | +; GCN: ; %bb.0: |
| 63 | +; GCN-NEXT: s_mov_b32 s4, 0xffff |
| 64 | +; GCN-NEXT: v_lshrrev_b32_e32 v6, 16, v7 |
| 65 | +; GCN-NEXT: v_and_b32_e32 v11, s4, v9 |
| 66 | +; GCN-NEXT: v_lshrrev_b32_e32 v9, 16, v9 |
| 67 | +; GCN-NEXT: v_and_b32_e32 v10, s4, v10 |
| 68 | +; GCN-NEXT: ; implicit-def: $vcc_hi |
| 69 | +; GCN-NEXT: v_lshlrev_b32_e32 v6, 16, v6 |
| 70 | +; GCN-NEXT: v_lshlrev_b32_e32 v11, 16, v11 |
| 71 | +; GCN-NEXT: v_and_or_b32 v6, v7, s4, v6 |
| 72 | +; GCN-NEXT: v_and_or_b32 v7, v8, s4, v11 |
| 73 | +; GCN-NEXT: v_lshl_or_b32 v8, v10, 16, v9 |
| 74 | +; GCN-NEXT: image_bvh64_intersect_ray v[0:3], v[0:15], s[0:3] a16 |
| 75 | +; GCN-NEXT: s_waitcnt vmcnt(0) |
| 76 | +; GCN-NEXT: ; return to shader part epilog |
| 77 | + %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f16(i64 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x half> %ray_dir, <4 x half> %ray_inv_dir, <4 x i32> %tdescr) |
| 78 | + %r = bitcast <4 x i32> %v to <4 x float> |
| 79 | + ret <4 x float> %r |
| 80 | +} |
| 81 | + |
| 82 | +define amdgpu_ps <4 x float> @image_bvh_intersect_ray_vgpr_descr(i32 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x float> %ray_dir, <4 x float> %ray_inv_dir, <4 x i32> %tdescr) { |
| 83 | +; GCN-LABEL: image_bvh_intersect_ray_vgpr_descr: |
| 84 | +; GCN: ; %bb.0: |
| 85 | +; GCN-NEXT: s_mov_b32 s1, exec_lo |
| 86 | +; GCN-NEXT: ; implicit-def: $vcc_hi |
| 87 | +; GCN-NEXT: BB4_1: ; =>This Inner Loop Header: Depth=1 |
| 88 | +; GCN-NEXT: v_readfirstlane_b32 s4, v14 |
| 89 | +; GCN-NEXT: v_readfirstlane_b32 s5, v15 |
| 90 | +; GCN-NEXT: v_readfirstlane_b32 s6, v16 |
| 91 | +; GCN-NEXT: v_readfirstlane_b32 s7, v17 |
| 92 | +; GCN-NEXT: v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[14:15] |
| 93 | +; GCN-NEXT: v_cmp_eq_u64_e64 s0, s[6:7], v[16:17] |
| 94 | +; GCN-NEXT: s_nop 2 |
| 95 | +; GCN-NEXT: image_bvh_intersect_ray v[18:21], [v0, v1, v2, v3, v4, v6, v7, v8, v10, v11, v12], s[4:7] |
| 96 | +; GCN-NEXT: s_and_b32 s0, s0, vcc_lo |
| 97 | +; GCN-NEXT: s_and_saveexec_b32 s0, s0 |
| 98 | +; GCN-NEXT: s_xor_b32 exec_lo, exec_lo, s0 |
| 99 | +; GCN-NEXT: s_cbranch_execnz BB4_1 |
| 100 | +; GCN-NEXT: ; %bb.2: |
| 101 | +; GCN-NEXT: s_mov_b32 exec_lo, s1 |
| 102 | +; GCN-NEXT: s_waitcnt vmcnt(0) |
| 103 | +; GCN-NEXT: v_mov_b32_e32 v0, v18 |
| 104 | +; GCN-NEXT: v_mov_b32_e32 v1, v19 |
| 105 | +; GCN-NEXT: v_mov_b32_e32 v2, v20 |
| 106 | +; GCN-NEXT: v_mov_b32_e32 v3, v21 |
| 107 | +; GCN-NEXT: ; return to shader part epilog |
| 108 | + %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f32(i32 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x float> %ray_dir, <4 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 |
| 111 | +} |
| 112 | + |
| 113 | +define amdgpu_ps <4 x float> @image_bvh_intersect_ray_a16_vgpr_descr(i32 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x half> %ray_dir, <4 x half> %ray_inv_dir, <4 x i32> %tdescr) { |
| 114 | +; GCN-LABEL: image_bvh_intersect_ray_a16_vgpr_descr: |
| 115 | +; GCN: ; %bb.0: |
| 116 | +; GCN-NEXT: s_mov_b32 s0, 0xffff |
| 117 | +; GCN-NEXT: v_lshrrev_b32_e32 v5, 16, v6 |
| 118 | +; GCN-NEXT: v_and_b32_e32 v14, s0, v8 |
| 119 | +; GCN-NEXT: v_lshrrev_b32_e32 v8, 16, v8 |
| 120 | +; GCN-NEXT: v_and_b32_e32 v15, s0, v9 |
| 121 | +; GCN-NEXT: s_mov_b32 s1, exec_lo |
| 122 | +; GCN-NEXT: v_lshlrev_b32_e32 v5, 16, v5 |
| 123 | +; GCN-NEXT: v_lshlrev_b32_e32 v14, 16, v14 |
| 124 | +; GCN-NEXT: ; implicit-def: $vcc_hi |
| 125 | +; GCN-NEXT: v_lshl_or_b32 v15, v15, 16, v8 |
| 126 | +; GCN-NEXT: v_and_or_b32 v9, v6, s0, v5 |
| 127 | +; GCN-NEXT: v_and_or_b32 v14, v7, s0, v14 |
| 128 | +; GCN-NEXT: BB5_1: ; =>This Inner Loop Header: Depth=1 |
| 129 | +; GCN-NEXT: v_readfirstlane_b32 s4, v10 |
| 130 | +; GCN-NEXT: v_readfirstlane_b32 s5, v11 |
| 131 | +; GCN-NEXT: v_readfirstlane_b32 s6, v12 |
| 132 | +; GCN-NEXT: v_readfirstlane_b32 s7, v13 |
| 133 | +; GCN-NEXT: v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[10:11] |
| 134 | +; GCN-NEXT: v_cmp_eq_u64_e64 s0, s[6:7], v[12:13] |
| 135 | +; GCN-NEXT: s_nop 2 |
| 136 | +; GCN-NEXT: image_bvh_intersect_ray v[5:8], [v0, v1, v2, v3, v4, v9, v14, v15], s[4:7] a16 |
| 137 | +; GCN-NEXT: s_and_b32 s0, s0, vcc_lo |
| 138 | +; GCN-NEXT: s_and_saveexec_b32 s0, s0 |
| 139 | +; GCN-NEXT: s_xor_b32 exec_lo, exec_lo, s0 |
| 140 | +; GCN-NEXT: s_cbranch_execnz BB5_1 |
| 141 | +; GCN-NEXT: ; %bb.2: |
| 142 | +; GCN-NEXT: s_mov_b32 exec_lo, s1 |
| 143 | +; GCN-NEXT: s_waitcnt vmcnt(0) |
| 144 | +; GCN-NEXT: v_mov_b32_e32 v0, v5 |
| 145 | +; GCN-NEXT: v_mov_b32_e32 v1, v6 |
| 146 | +; GCN-NEXT: v_mov_b32_e32 v2, v7 |
| 147 | +; GCN-NEXT: v_mov_b32_e32 v3, v8 |
| 148 | +; GCN-NEXT: ; return to shader part epilog |
| 149 | + %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i32.v4f16(i32 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x half> %ray_dir, <4 x half> %ray_inv_dir, <4 x i32> %tdescr) |
| 150 | + %r = bitcast <4 x i32> %v to <4 x float> |
| 151 | + ret <4 x float> %r |
| 152 | +} |
| 153 | + |
| 154 | +define amdgpu_ps <4 x float> @image_bvh64_intersect_ray_vgpr_descr(i64 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x float> %ray_dir, <4 x float> %ray_inv_dir, <4 x i32> %tdescr) { |
| 155 | +; GCN-LABEL: image_bvh64_intersect_ray_vgpr_descr: |
| 156 | +; GCN: ; %bb.0: |
| 157 | +; GCN-NEXT: s_mov_b32 s1, exec_lo |
| 158 | +; GCN-NEXT: ; implicit-def: $vcc_hi |
| 159 | +; GCN-NEXT: BB6_1: ; =>This Inner Loop Header: Depth=1 |
| 160 | +; GCN-NEXT: v_readfirstlane_b32 s4, v15 |
| 161 | +; GCN-NEXT: v_readfirstlane_b32 s5, v16 |
| 162 | +; GCN-NEXT: v_readfirstlane_b32 s6, v17 |
| 163 | +; GCN-NEXT: v_readfirstlane_b32 s7, v18 |
| 164 | +; GCN-NEXT: v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[15:16] |
| 165 | +; GCN-NEXT: v_cmp_eq_u64_e64 s0, s[6:7], v[17:18] |
| 166 | +; GCN-NEXT: s_nop 2 |
| 167 | +; GCN-NEXT: image_bvh64_intersect_ray v[19:22], [v0, v1, v2, v3, v4, v5, v7, v8, v9, v11, v12, v13], s[4:7] |
| 168 | +; GCN-NEXT: s_and_b32 s0, s0, vcc_lo |
| 169 | +; GCN-NEXT: s_and_saveexec_b32 s0, s0 |
| 170 | +; GCN-NEXT: s_xor_b32 exec_lo, exec_lo, s0 |
| 171 | +; GCN-NEXT: s_cbranch_execnz BB6_1 |
| 172 | +; GCN-NEXT: ; %bb.2: |
| 173 | +; GCN-NEXT: s_mov_b32 exec_lo, s1 |
| 174 | +; GCN-NEXT: s_waitcnt vmcnt(0) |
| 175 | +; GCN-NEXT: v_mov_b32_e32 v0, v19 |
| 176 | +; GCN-NEXT: v_mov_b32_e32 v1, v20 |
| 177 | +; GCN-NEXT: v_mov_b32_e32 v2, v21 |
| 178 | +; GCN-NEXT: v_mov_b32_e32 v3, v22 |
| 179 | +; GCN-NEXT: ; return to shader part epilog |
| 180 | + %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f32(i64 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x float> %ray_dir, <4 x float> %ray_inv_dir, <4 x i32> %tdescr) |
| 181 | + %r = bitcast <4 x i32> %v to <4 x float> |
| 182 | + ret <4 x float> %r |
| 183 | +} |
| 184 | + |
| 185 | +define amdgpu_ps <4 x float> @image_bvh64_intersect_ray_a16_vgpr_descr(i64 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x half> %ray_dir, <4 x half> %ray_inv_dir, <4 x i32> %tdescr) { |
| 186 | +; GCN-LABEL: image_bvh64_intersect_ray_a16_vgpr_descr: |
| 187 | +; GCN: ; %bb.0: |
| 188 | +; GCN-NEXT: s_mov_b32 s0, 0xffff |
| 189 | +; GCN-NEXT: v_lshrrev_b32_e32 v6, 16, v7 |
| 190 | +; GCN-NEXT: v_and_b32_e32 v15, s0, v9 |
| 191 | +; GCN-NEXT: v_lshrrev_b32_e32 v9, 16, v9 |
| 192 | +; GCN-NEXT: v_and_b32_e32 v16, s0, v10 |
| 193 | +; GCN-NEXT: s_mov_b32 s1, exec_lo |
| 194 | +; GCN-NEXT: v_lshlrev_b32_e32 v6, 16, v6 |
| 195 | +; GCN-NEXT: v_lshlrev_b32_e32 v15, 16, v15 |
| 196 | +; GCN-NEXT: ; implicit-def: $vcc_hi |
| 197 | +; GCN-NEXT: v_lshl_or_b32 v16, v16, 16, v9 |
| 198 | +; GCN-NEXT: v_and_or_b32 v10, v7, s0, v6 |
| 199 | +; GCN-NEXT: v_and_or_b32 v15, v8, s0, v15 |
| 200 | +; GCN-NEXT: BB7_1: ; =>This Inner Loop Header: Depth=1 |
| 201 | +; GCN-NEXT: v_readfirstlane_b32 s4, v11 |
| 202 | +; GCN-NEXT: v_readfirstlane_b32 s5, v12 |
| 203 | +; GCN-NEXT: v_readfirstlane_b32 s6, v13 |
| 204 | +; GCN-NEXT: v_readfirstlane_b32 s7, v14 |
| 205 | +; GCN-NEXT: v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[11:12] |
| 206 | +; GCN-NEXT: v_cmp_eq_u64_e64 s0, s[6:7], v[13:14] |
| 207 | +; GCN-NEXT: s_nop 2 |
| 208 | +; GCN-NEXT: image_bvh64_intersect_ray v[6:9], [v0, v1, v2, v3, v4, v5, v10, v15, v16], s[4:7] a16 |
| 209 | +; GCN-NEXT: s_and_b32 s0, s0, vcc_lo |
| 210 | +; GCN-NEXT: s_and_saveexec_b32 s0, s0 |
| 211 | +; GCN-NEXT: s_xor_b32 exec_lo, exec_lo, s0 |
| 212 | +; GCN-NEXT: s_cbranch_execnz BB7_1 |
| 213 | +; GCN-NEXT: ; %bb.2: |
| 214 | +; GCN-NEXT: s_mov_b32 exec_lo, s1 |
| 215 | +; GCN-NEXT: s_waitcnt vmcnt(0) |
| 216 | +; GCN-NEXT: v_mov_b32_e32 v0, v6 |
| 217 | +; GCN-NEXT: v_mov_b32_e32 v1, v7 |
| 218 | +; GCN-NEXT: v_mov_b32_e32 v2, v8 |
| 219 | +; GCN-NEXT: v_mov_b32_e32 v3, v9 |
| 220 | +; GCN-NEXT: ; return to shader part epilog |
| 221 | + %v = call <4 x i32> @llvm.amdgcn.image.bvh.intersect.ray.i64.v4f16(i64 %node_ptr, float %ray_extent, <4 x float> %ray_origin, <4 x half> %ray_dir, <4 x half> %ray_inv_dir, <4 x i32> %tdescr) |
| 222 | + %r = bitcast <4 x i32> %v to <4 x float> |
| 223 | + ret <4 x float> %r |
| 224 | +} |
0 commit comments