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 { 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 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 { 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 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" } 32