1 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3 ; GCN-LABEL: {{^}}const_load_no_shrink_dword_to_unaligned_byte:
4 ; GCN: s_load_dword s{{[0-9]+}}
5 ; GCN: s_load_dword [[LD:s[0-9]+]],
6 ; GCN: s_bfe_i32 s{{[0-9]+}}, [[LD]], 0x10013
7 define amdgpu_kernel void @const_load_no_shrink_dword_to_unaligned_byte(ptr addrspace(1) %out, ptr addrspace(4) %in, i32 %x) {
8 %ptr = getelementptr i32, ptr addrspace(4) %in, i32 %x
9 %load = load i32, ptr addrspace(4) %ptr, align 4
10 %and = and i32 %load, 524288
11 %cmp = icmp eq i32 %and, 0
12 %sel = select i1 %cmp, i32 0, i32 -1
13 store i32 %sel, ptr addrspace(1) %out
17 ; GCN-LABEL: const_load_no_shrink_dword_to_aligned_byte:
18 ; GCN: s_load_dword s{{[0-9]+}}
19 ; GCN: s_load_dword [[LD:s[0-9]+]],
20 ; GCN: s_bfe_i32 s{{[0-9]+}}, [[LD]], 0x10003
21 define amdgpu_kernel void @const_load_no_shrink_dword_to_aligned_byte(ptr addrspace(1) %out, ptr addrspace(4) %in, i32 %x) {
22 %ptr = getelementptr i32, ptr addrspace(4) %in, i32 %x
23 %load = load i32, ptr addrspace(4) %ptr, align 4
24 %and = and i32 %load, 8
25 %cmp = icmp eq i32 %and, 0
26 %sel = select i1 %cmp, i32 0, i32 -1
27 store i32 %sel, ptr addrspace(1) %out
31 ; GCN-LABEL: global_load_no_shrink_dword_to_unaligned_byte:
32 ; GCN: s_load_dword s{{[0-9]+}}
33 ; GCN: s_load_dword [[LD:s[0-9]+]],
34 ; GCN: s_bfe_i32 s{{[0-9]+}}, [[LD]], 0x10013
35 define amdgpu_kernel void @global_load_no_shrink_dword_to_unaligned_byte(ptr addrspace(1) noalias %out, ptr addrspace(1) noalias %in, i32 %x) {
36 %ptr = getelementptr i32, ptr addrspace(1) %in, i32 %x
37 %load = load i32, ptr addrspace(1) %ptr, align 4
38 %and = and i32 %load, 524288
39 %cmp = icmp eq i32 %and, 0
40 %sel = select i1 %cmp, i32 0, i32 -1
41 store i32 %sel, ptr addrspace(1) %out
45 ; GCN-LABEL: global_load_no_shrink_dword_to_aligned_byte:
46 ; GCN: s_load_dword s{{[0-9]+}}
47 ; GCN: s_load_dword [[LD:s[0-9]+]],
48 ; GCN: s_bfe_i32 s{{[0-9]+}}, [[LD]], 0x10003
49 define amdgpu_kernel void @global_load_no_shrink_dword_to_aligned_byte(ptr addrspace(1) %out, ptr addrspace(1) %in, i32 %x) {
50 %ptr = getelementptr i32, ptr addrspace(1) %in, i32 %x
51 %load = load i32, ptr addrspace(1) %ptr, align 4
52 %and = and i32 %load, 8
53 %cmp = icmp eq i32 %and, 0
54 %sel = select i1 %cmp, i32 0, i32 -1
55 store i32 %sel, ptr addrspace(1) %out
59 ; GCN-LABEL: const_load_shrink_dword_to_unaligned_byte:
60 ; GCN: global_load_ushort
61 define amdgpu_kernel void @const_load_shrink_dword_to_unaligned_byte(ptr addrspace(1) %out, ptr addrspace(4) %in, i32 %x) {
62 %ptr = getelementptr i32, ptr addrspace(4) %in, i32 %x
63 %load = load i32, ptr addrspace(4) %ptr, align 2
64 %and = and i32 %load, 524288
65 %cmp = icmp eq i32 %and, 0
66 %sel = select i1 %cmp, i32 0, i32 -1
67 store i32 %sel, ptr addrspace(1) %out