1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN %s
3 ; The type promotion for the vector loads v3i32/v3f32 into v4i32/v4f32 is enabled
4 ; only when the alignment is 8-byte or higher.
5 ; Otherwise, split the load into two separate loads (dwordx2 + dword).
6 ; This type promotion on smaller aligned loads can cause a page fault error
7 ; while accessing one extra dword beyond the buffer.
9 define protected amdgpu_kernel void @load_v3i32_align4(<3 x i32> addrspace(1)* %arg) #0 {
10 ; GCN-LABEL: load_v3i32_align4:
12 ; GCN: s_waitcnt lgkmcnt(0)
13 ; GCN-NEXT: s_load_dwordx2 s{{\[[0-9]:[0-9]+\]}}, s[0:1], 0x0
14 ; GCN-NEXT: s_load_dword s{{[0-9]+}}, s[0:1], 0x8
15 %vec = load <3 x i32>, <3 x i32> addrspace(1)* %arg, align 4
16 store <3 x i32> %vec, <3 x i32> addrspace(1)* undef, align 4
20 define protected amdgpu_kernel void @load_v3i32_align8(<3 x i32> addrspace(1)* %arg) #0 {
21 ; GCN-LABEL: load_v3i32_align8:
23 ; GCN: s_waitcnt lgkmcnt(0)
24 ; GCN-NEXT: s_load_dwordx4 s{{\[[0-9]:[0-9]+\]}}, s[0:1], 0x0
25 %vec = load <3 x i32>, <3 x i32> addrspace(1)* %arg, align 8
26 store <3 x i32> %vec, <3 x i32> addrspace(1)* undef, align 8
30 define protected amdgpu_kernel void @load_v3i32_align16(<3 x i32> addrspace(1)* %arg) #0 {
31 ; GCN-LABEL: load_v3i32_align16:
33 ; GCN: s_waitcnt lgkmcnt(0)
34 ; GCN-NEXT: s_load_dwordx4 s{{\[[0-9]:[0-9]+\]}}, s[0:1], 0x0
35 %vec = load <3 x i32>, <3 x i32> addrspace(1)* %arg, align 16
36 store <3 x i32> %vec, <3 x i32> addrspace(1)* undef, align 16
40 define protected amdgpu_kernel void @load_v3f32_align4(<3 x float> addrspace(1)* %arg) #0 {
41 ; GCN-LABEL: load_v3f32_align4:
43 ; GCN: s_waitcnt lgkmcnt(0)
44 ; GCN-NEXT: s_load_dwordx2 s{{\[[0-9]:[0-9]+\]}}, s[0:1], 0x0
45 ; GCN-NEXT: s_load_dword s{{[0-9]+}}, s[0:1], 0x8
46 %vec = load <3 x float>, <3 x float> addrspace(1)* %arg, align 4
47 store <3 x float> %vec, <3 x float> addrspace(1)* undef, align 4
51 define protected amdgpu_kernel void @load_v3f32_align8(<3 x float> addrspace(1)* %arg) #0 {
52 ; GCN-LABEL: load_v3f32_align8:
54 ; GCN: s_waitcnt lgkmcnt(0)
55 ; GCN-NEXT: s_load_dwordx4 s{{\[[0-9]:[0-9]+\]}}, s[0:1], 0x0
56 %vec = load <3 x float>, <3 x float> addrspace(1)* %arg, align 8
57 store <3 x float> %vec, <3 x float> addrspace(1)* undef, align 8
61 define protected amdgpu_kernel void @load_v3f32_align16(<3 x float> addrspace(1)* %arg) #0 {
62 ; GCN-LABEL: load_v3f32_align16:
64 ; GCN: s_waitcnt lgkmcnt(0)
65 ; GCN-NEXT: s_load_dwordx4 s{{\[[0-9]:[0-9]+\]}}, s[0:1], 0x0
66 %vec = load <3 x float>, <3 x float> addrspace(1)* %arg, align 16
67 store <3 x float> %vec, <3 x float> addrspace(1)* undef, align 16
71 attributes #0 = { nounwind noinline }