Matt Arsenault | 45b9818 | 2017-11-15 00:45:43 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN %s |
| 2 | |
| 3 | ; GCN-LABEL: {{^}}scratch_buffer_known_high_bit_small: |
| 4 | ; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 |
| 5 | ; GCN-NOT: [[FI]] |
| 6 | ; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[FI]] |
| 7 | define amdgpu_kernel void @scratch_buffer_known_high_bit_small() #0 { |
Yaxun Liu | 2a22c5d | 2018-02-02 16:07:16 +0000 | [diff] [blame] | 8 | %alloca = alloca i32, align 4, addrspace(5) |
| 9 | store volatile i32 0, i32 addrspace(5)* %alloca |
| 10 | %toint = ptrtoint i32 addrspace(5)* %alloca to i32 |
Matt Arsenault | 45b9818 | 2017-11-15 00:45:43 +0000 | [diff] [blame] | 11 | %masked = and i32 %toint, 2147483647 |
| 12 | store volatile i32 %masked, i32 addrspace(1)* undef |
| 13 | ret void |
| 14 | } |
| 15 | |
| 16 | ; GCN-LABEL: {{^}}scratch_buffer_known_high_bit_huge: |
| 17 | ; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 |
| 18 | ; GCN-DAG: buffer_store_dword |
| 19 | ; GCN-DAG: v_and_b32_e32 [[MASKED:v[0-9]+]], 0x7ffffffc, [[FI]] |
| 20 | ; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[MASKED]] |
| 21 | define amdgpu_kernel void @scratch_buffer_known_high_bit_huge() #1 { |
Yaxun Liu | 2a22c5d | 2018-02-02 16:07:16 +0000 | [diff] [blame] | 22 | %alloca = alloca i32, align 4, addrspace(5) |
| 23 | store volatile i32 0, i32 addrspace(5)* %alloca |
| 24 | %toint = ptrtoint i32 addrspace(5)* %alloca to i32 |
Matt Arsenault | 45b9818 | 2017-11-15 00:45:43 +0000 | [diff] [blame] | 25 | %masked = and i32 %toint, 2147483647 |
| 26 | store volatile i32 %masked, i32 addrspace(1)* undef |
| 27 | ret void |
| 28 | } |
| 29 | |
| 30 | attributes #0 = { nounwind } |
| 31 | attributes #1 = { nounwind "target-features"="+huge-private-buffer" } |