Matt Arsenault | 9de2fb5 | 2018-09-13 11:56:28 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=amdgcn--amdpal -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN %s |
Tim Renouf | 75ced9d | 2018-01-12 22:57:24 +0000 | [diff] [blame] | 2 | |
| 3 | ; The first image store and the second image load use the same descriptor and |
| 4 | ; the same coordinate. Check that they do not get swapped by the machine |
| 5 | ; instruction scheduler. |
| 6 | |
| 7 | ; GCN-LABEL: {{^}}_amdgpu_cs_main: |
| 8 | ; GCN: image_load |
| 9 | ; GCN: image_store |
| 10 | ; GCN: image_load |
| 11 | ; GCN: image_store |
| 12 | |
| 13 | define dllexport amdgpu_cs void @_amdgpu_cs_main(i32 inreg %arg, i32 inreg %arg1, i32 inreg %arg2, <3 x i32> inreg %arg3, i32 inreg %arg4, <3 x i32> %arg5) local_unnamed_addr #0 { |
| 14 | .entry: |
| 15 | %tmp = call i64 @llvm.amdgcn.s.getpc() #1 |
| 16 | %tmp6 = bitcast i64 %tmp to <2 x i32> |
Matt Arsenault | da42b2f | 2025-03-12 20:33:33 +0700 | [diff] [blame] | 17 | %.0.vec.insert = insertelement <2 x i32> poison, i32 %arg2, i32 0 |
Tim Renouf | 75ced9d | 2018-01-12 22:57:24 +0000 | [diff] [blame] | 18 | %.4.vec.insert = shufflevector <2 x i32> %.0.vec.insert, <2 x i32> %tmp6, <2 x i32> <i32 0, i32 3> |
| 19 | %tmp7 = bitcast <2 x i32> %.4.vec.insert to i64 |
Nikita Popov | bdf2fbb | 2022-12-19 12:39:01 +0100 | [diff] [blame] | 20 | %tmp8 = inttoptr i64 %tmp7 to ptr addrspace(4) |
Tim Renouf | 75ced9d | 2018-01-12 22:57:24 +0000 | [diff] [blame] | 21 | %tmp9 = add <3 x i32> %arg3, %arg5 |
Nikita Popov | bdf2fbb | 2022-12-19 12:39:01 +0100 | [diff] [blame] | 22 | %tmp10 = getelementptr [4294967295 x i8], ptr addrspace(4) %tmp8, i64 0, i64 32 |
| 23 | %tmp12 = load <8 x i32>, ptr addrspace(4) %tmp10, align 16 |
Nicolai Haehnle | 1045928 | 2018-06-21 13:37:19 +0000 | [diff] [blame] | 24 | %tmp13.0 = extractelement <3 x i32> %tmp9, i32 0 |
| 25 | %tmp13.1 = extractelement <3 x i32> %tmp9, i32 1 |
| 26 | %tmp14 = call <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32 15, i32 %tmp13.0, i32 %tmp13.1, <8 x i32> %tmp12, i32 0, i32 0) #0 |
Nikita Popov | bdf2fbb | 2022-12-19 12:39:01 +0100 | [diff] [blame] | 27 | %tmp15 = inttoptr i64 %tmp7 to ptr addrspace(4) |
| 28 | %tmp16 = load <8 x i32>, ptr addrspace(4) %tmp15, align 16 |
Nicolai Haehnle | 1045928 | 2018-06-21 13:37:19 +0000 | [diff] [blame] | 29 | call void @llvm.amdgcn.image.store.2d.v4f32.i32(<4 x float> %tmp14, i32 15, i32 %tmp13.0, i32 %tmp13.1, <8 x i32> %tmp16, i32 0, i32 0) #0 |
Nikita Popov | bdf2fbb | 2022-12-19 12:39:01 +0100 | [diff] [blame] | 30 | %tmp17 = load <8 x i32>, ptr addrspace(4) %tmp15, align 16 |
Nicolai Haehnle | 1045928 | 2018-06-21 13:37:19 +0000 | [diff] [blame] | 31 | %tmp18 = call <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32 165, i32 %tmp13.0, i32 %tmp13.1, <8 x i32> %tmp17, i32 0, i32 0) #0 |
Nikita Popov | bdf2fbb | 2022-12-19 12:39:01 +0100 | [diff] [blame] | 32 | %tmp19 = getelementptr [4294967295 x i8], ptr addrspace(4) %tmp8, i64 0, i64 64 |
| 33 | %tmp21 = load <8 x i32>, ptr addrspace(4) %tmp19, align 16 |
Nicolai Haehnle | 1045928 | 2018-06-21 13:37:19 +0000 | [diff] [blame] | 34 | call void @llvm.amdgcn.image.store.2d.v4f32.i32(<4 x float> %tmp18, i32 15, i32 %tmp13.0, i32 %tmp13.1, <8 x i32> %tmp21, i32 0, i32 0) #0 |
Tim Renouf | 75ced9d | 2018-01-12 22:57:24 +0000 | [diff] [blame] | 35 | ret void |
| 36 | } |
| 37 | |
| 38 | ; Function Attrs: nounwind readnone speculatable |
| 39 | declare i64 @llvm.amdgcn.s.getpc() #1 |
| 40 | |
| 41 | ; Function Attrs: nounwind readonly |
Nicolai Haehnle | 1045928 | 2018-06-21 13:37:19 +0000 | [diff] [blame] | 42 | declare <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32, i32, i32, <8 x i32>, i32, i32) #2 |
Tim Renouf | 75ced9d | 2018-01-12 22:57:24 +0000 | [diff] [blame] | 43 | |
| 44 | ; Function Attrs: nounwind writeonly |
Nicolai Haehnle | 1045928 | 2018-06-21 13:37:19 +0000 | [diff] [blame] | 45 | declare void @llvm.amdgcn.image.store.2d.v4f32.i32(<4 x float>, i32, i32, i32, <8 x i32>, i32, i32) #3 |
Tim Renouf | 75ced9d | 2018-01-12 22:57:24 +0000 | [diff] [blame] | 46 | |
| 47 | attributes #0 = { nounwind } |
| 48 | attributes #1 = { nounwind readnone speculatable } |
| 49 | attributes #2 = { nounwind readonly } |
| 50 | attributes #3 = { nounwind writeonly } |
| 51 | |
| 52 | !0 = !{} |