1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,WAVE64 %s
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,WAVE32 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,WAVE64 %s
4 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,WAVE32 %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,WAVE64 %s
7 ; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo14:
8 ; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4
9 ; GCN: v_and_b32_e32 [[MASKED:v[0-9]+]], 0x3ffc, [[FI]]
10 ; GCN: {{flat|global}}_store_{{dword|b32}} v{{\[[0-9]+:[0-9]+\]}}, [[MASKED]]
11 define amdgpu_kernel void @scratch_buffer_known_high_masklo14() #0 {
12 %alloca = alloca i32, align 4, addrspace(5)
13 store volatile i32 0, ptr addrspace(5) %alloca
14 %toint = ptrtoint ptr addrspace(5) %alloca to i32
15 %masked = and i32 %toint, 16383
16 store volatile i32 %masked, ptr addrspace(1) undef
20 ; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo16:
21 ; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4
22 ; GCN: v_and_b32_e32 [[MASKED:v[0-9]+]], 0xfffc, [[FI]]
23 ; GCN: {{flat|global}}_store_{{dword|b32}} v{{\[[0-9]+:[0-9]+\]}}, [[MASKED]]
24 define amdgpu_kernel void @scratch_buffer_known_high_masklo16() #0 {
25 %alloca = alloca i32, align 4, addrspace(5)
26 store volatile i32 0, ptr addrspace(5) %alloca
27 %toint = ptrtoint ptr addrspace(5) %alloca to i32
28 %masked = and i32 %toint, 65535
29 store volatile i32 %masked, ptr addrspace(1) undef
33 ; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo17:
34 ; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4
36 ; WAVE64: {{flat|global}}_store_{{dword|b32}} v{{\[[0-9]+:[0-9]+\]}}, [[FI]]
38 ; WAVE32: v_and_b32_e32 [[MASKED:v[0-9]+]], 0x1fffc, [[FI]]
39 ; WAVE32: {{flat|global}}_store_{{dword|b32}} v{{\[[0-9]+:[0-9]+\]}}, [[MASKED]]
40 define amdgpu_kernel void @scratch_buffer_known_high_masklo17() #0 {
41 %alloca = alloca i32, align 4, addrspace(5)
42 store volatile i32 0, ptr addrspace(5) %alloca
43 %toint = ptrtoint ptr addrspace(5) %alloca to i32
44 %masked = and i32 %toint, 131071
45 store volatile i32 %masked, ptr addrspace(1) undef
49 ; GCN-LABEL: {{^}}scratch_buffer_known_high_mask18:
50 ; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4
52 ; GCN: {{flat|global}}_store_{{dword|b32}} v{{\[[0-9]+:[0-9]+\]}}, [[FI]]
53 define amdgpu_kernel void @scratch_buffer_known_high_mask18() #0 {
54 %alloca = alloca i32, align 4, addrspace(5)
55 store volatile i32 0, ptr addrspace(5) %alloca
56 %toint = ptrtoint ptr addrspace(5) %alloca to i32
57 %masked = and i32 %toint, 262143
58 store volatile i32 %masked, ptr addrspace(1) undef
62 attributes #0 = { nounwind }