Matt Arsenault | 10fc062 | 2017-06-26 03:01:31 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=amdgcn-mesa-mesa3d -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s |
| 2 | |
| 3 | ; FIXME: Requires stack object to not assert |
| 4 | ; GCN-LABEL: {{^}}test_ps: |
| 5 | ; GCN: s_load_dwordx2 s[4:5], s[0:1], 0x0 |
| 6 | ; GCN: buffer_store_dword v0, off, s[4:7], s2 offset:4 |
| 7 | ; GCN: s_load_dword s{{[0-9]+}}, s[0:1], 0x0 |
| 8 | ; GCN-NEXT: s_waitcnt |
| 9 | ; GCN-NEXT: ; return |
| 10 | define amdgpu_ps i32 @test_ps() #1 { |
Yaxun Liu | 2a22c5d | 2018-02-02 16:07:16 +0000 | [diff] [blame] | 11 | %alloca = alloca i32, addrspace(5) |
| 12 | store volatile i32 0, i32 addrspace(5)* %alloca |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 13 | %implicit_buffer_ptr = call i8 addrspace(4)* @llvm.amdgcn.implicit.buffer.ptr() |
| 14 | %buffer_ptr = bitcast i8 addrspace(4)* %implicit_buffer_ptr to i32 addrspace(4)* |
| 15 | %value = load volatile i32, i32 addrspace(4)* %buffer_ptr |
Matt Arsenault | 10fc062 | 2017-06-26 03:01:31 +0000 | [diff] [blame] | 16 | ret i32 %value |
| 17 | } |
| 18 | |
| 19 | ; GCN-LABEL: {{^}}test_cs: |
| 20 | ; GCN: s_mov_b64 s[4:5], s[0:1] |
| 21 | ; GCN: buffer_store_dword v{{[0-9]+}}, off, s[4:7], s2 offset:4 |
| 22 | ; GCN: s_load_dword s0, s[0:1], 0x0 |
| 23 | define amdgpu_cs i32 @test_cs() #1 { |
Yaxun Liu | 2a22c5d | 2018-02-02 16:07:16 +0000 | [diff] [blame] | 24 | %alloca = alloca i32, addrspace(5) |
| 25 | store volatile i32 0, i32 addrspace(5)* %alloca |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 26 | %implicit_buffer_ptr = call i8 addrspace(4)* @llvm.amdgcn.implicit.buffer.ptr() |
| 27 | %buffer_ptr = bitcast i8 addrspace(4)* %implicit_buffer_ptr to i32 addrspace(4)* |
| 28 | %value = load volatile i32, i32 addrspace(4)* %buffer_ptr |
Matt Arsenault | 10fc062 | 2017-06-26 03:01:31 +0000 | [diff] [blame] | 29 | ret i32 %value |
| 30 | } |
| 31 | |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 32 | declare i8 addrspace(4)* @llvm.amdgcn.implicit.buffer.ptr() #0 |
Matt Arsenault | 10fc062 | 2017-06-26 03:01:31 +0000 | [diff] [blame] | 33 | |
| 34 | attributes #0 = { nounwind readnone speculatable } |
| 35 | attributes #1 = { nounwind } |