1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -global-isel -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,GFX9 %s
3; RUN: llc -global-isel -mtriple=amdgcn-amd-amdpal -mcpu=fiji < %s | FileCheck -check-prefixes=GCN,GFX8 %s
4; RUN: llc -global-isel -mtriple=amdgcn-amd-amdpal -mcpu=tahiti < %s | FileCheck -check-prefixes=GCN,GFX6 %s
5
6define i64 @zextload_global_i1_to_i64(i1 addrspace(1)* %ptr) {
7; GFX9-LABEL: zextload_global_i1_to_i64:
8; GFX9:       ; %bb.0:
9; GFX9-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10; GFX9-NEXT:    global_load_ubyte v0, v[0:1], off
11; GFX9-NEXT:    v_mov_b32_e32 v1, 0
12; GFX9-NEXT:    s_waitcnt vmcnt(0)
13; GFX9-NEXT:    v_and_b32_e32 v0, 1, v0
14; GFX9-NEXT:    s_setpc_b64 s[30:31]
15;
16; GFX8-LABEL: zextload_global_i1_to_i64:
17; GFX8:       ; %bb.0:
18; GFX8-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
19; GFX8-NEXT:    flat_load_ubyte v0, v[0:1]
20; GFX8-NEXT:    v_mov_b32_e32 v1, 0
21; GFX8-NEXT:    s_waitcnt vmcnt(0)
22; GFX8-NEXT:    v_and_b32_e32 v0, 1, v0
23; GFX8-NEXT:    s_setpc_b64 s[30:31]
24;
25; GFX6-LABEL: zextload_global_i1_to_i64:
26; GFX6:       ; %bb.0:
27; GFX6-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
28; GFX6-NEXT:    s_mov_b32 s6, 0
29; GFX6-NEXT:    s_mov_b32 s7, 0xf000
30; GFX6-NEXT:    s_mov_b64 s[4:5], 0
31; GFX6-NEXT:    buffer_load_ubyte v0, v[0:1], s[4:7], 0 addr64
32; GFX6-NEXT:    v_mov_b32_e32 v1, 0
33; GFX6-NEXT:    s_waitcnt vmcnt(0)
34; GFX6-NEXT:    v_and_b32_e32 v0, 1, v0
35; GFX6-NEXT:    s_setpc_b64 s[30:31]
36  %load = load i1, i1 addrspace(1)* %ptr
37  %ext = zext i1 %load to i64
38  ret i64 %ext
39}
40
41define i64 @zextload_global_i8_to_i64(i8 addrspace(1)* %ptr) {
42; GFX9-LABEL: zextload_global_i8_to_i64:
43; GFX9:       ; %bb.0:
44; GFX9-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
45; GFX9-NEXT:    global_load_ubyte v0, v[0:1], off
46; GFX9-NEXT:    v_mov_b32_e32 v1, 0
47; GFX9-NEXT:    s_waitcnt vmcnt(0)
48; GFX9-NEXT:    s_setpc_b64 s[30:31]
49;
50; GFX8-LABEL: zextload_global_i8_to_i64:
51; GFX8:       ; %bb.0:
52; GFX8-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
53; GFX8-NEXT:    flat_load_ubyte v0, v[0:1]
54; GFX8-NEXT:    v_mov_b32_e32 v1, 0
55; GFX8-NEXT:    s_waitcnt vmcnt(0)
56; GFX8-NEXT:    s_setpc_b64 s[30:31]
57;
58; GFX6-LABEL: zextload_global_i8_to_i64:
59; GFX6:       ; %bb.0:
60; GFX6-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
61; GFX6-NEXT:    s_mov_b32 s6, 0
62; GFX6-NEXT:    s_mov_b32 s7, 0xf000
63; GFX6-NEXT:    s_mov_b64 s[4:5], 0
64; GFX6-NEXT:    buffer_load_ubyte v0, v[0:1], s[4:7], 0 addr64
65; GFX6-NEXT:    v_mov_b32_e32 v1, 0
66; GFX6-NEXT:    s_waitcnt vmcnt(0)
67; GFX6-NEXT:    s_setpc_b64 s[30:31]
68  %load = load i8, i8 addrspace(1)* %ptr
69  %ext = zext i8 %load to i64
70  ret i64 %ext
71}
72
73define i64 @zextload_global_i16_to_i64(i16 addrspace(1)* %ptr) {
74; GFX9-LABEL: zextload_global_i16_to_i64:
75; GFX9:       ; %bb.0:
76; GFX9-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
77; GFX9-NEXT:    global_load_ushort v0, v[0:1], off
78; GFX9-NEXT:    v_mov_b32_e32 v1, 0
79; GFX9-NEXT:    s_waitcnt vmcnt(0)
80; GFX9-NEXT:    s_setpc_b64 s[30:31]
81;
82; GFX8-LABEL: zextload_global_i16_to_i64:
83; GFX8:       ; %bb.0:
84; GFX8-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
85; GFX8-NEXT:    flat_load_ushort v0, v[0:1]
86; GFX8-NEXT:    v_mov_b32_e32 v1, 0
87; GFX8-NEXT:    s_waitcnt vmcnt(0)
88; GFX8-NEXT:    s_setpc_b64 s[30:31]
89;
90; GFX6-LABEL: zextload_global_i16_to_i64:
91; GFX6:       ; %bb.0:
92; GFX6-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
93; GFX6-NEXT:    s_mov_b32 s6, 0
94; GFX6-NEXT:    s_mov_b32 s7, 0xf000
95; GFX6-NEXT:    s_mov_b64 s[4:5], 0
96; GFX6-NEXT:    buffer_load_ushort v0, v[0:1], s[4:7], 0 addr64
97; GFX6-NEXT:    v_mov_b32_e32 v1, 0
98; GFX6-NEXT:    s_waitcnt vmcnt(0)
99; GFX6-NEXT:    s_setpc_b64 s[30:31]
100  %load = load i16, i16 addrspace(1)* %ptr
101  %ext = zext i16 %load to i64
102  ret i64 %ext
103}
104
105define i64 @zextload_global_i32_to_i64(i32 addrspace(1)* %ptr) {
106; GFX9-LABEL: zextload_global_i32_to_i64:
107; GFX9:       ; %bb.0:
108; GFX9-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
109; GFX9-NEXT:    global_load_dword v0, v[0:1], off
110; GFX9-NEXT:    v_mov_b32_e32 v1, 0
111; GFX9-NEXT:    s_waitcnt vmcnt(0)
112; GFX9-NEXT:    s_setpc_b64 s[30:31]
113;
114; GFX8-LABEL: zextload_global_i32_to_i64:
115; GFX8:       ; %bb.0:
116; GFX8-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
117; GFX8-NEXT:    flat_load_dword v0, v[0:1]
118; GFX8-NEXT:    v_mov_b32_e32 v1, 0
119; GFX8-NEXT:    s_waitcnt vmcnt(0)
120; GFX8-NEXT:    s_setpc_b64 s[30:31]
121;
122; GFX6-LABEL: zextload_global_i32_to_i64:
123; GFX6:       ; %bb.0:
124; GFX6-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
125; GFX6-NEXT:    s_mov_b32 s6, 0
126; GFX6-NEXT:    s_mov_b32 s7, 0xf000
127; GFX6-NEXT:    s_mov_b64 s[4:5], 0
128; GFX6-NEXT:    buffer_load_dword v0, v[0:1], s[4:7], 0 addr64
129; GFX6-NEXT:    v_mov_b32_e32 v1, 0
130; GFX6-NEXT:    s_waitcnt vmcnt(0)
131; GFX6-NEXT:    s_setpc_b64 s[30:31]
132  %load = load i32, i32 addrspace(1)* %ptr
133  %ext = zext i32 %load to i64
134  ret i64 %ext
135}
136
137define i96 @zextload_global_i32_to_i96(i32 addrspace(1)* %ptr) {
138; GFX9-LABEL: zextload_global_i32_to_i96:
139; GFX9:       ; %bb.0:
140; GFX9-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
141; GFX9-NEXT:    global_load_dword v0, v[0:1], off
142; GFX9-NEXT:    v_mov_b32_e32 v1, 0
143; GFX9-NEXT:    v_mov_b32_e32 v2, 0
144; GFX9-NEXT:    s_waitcnt vmcnt(0)
145; GFX9-NEXT:    s_setpc_b64 s[30:31]
146;
147; GFX8-LABEL: zextload_global_i32_to_i96:
148; GFX8:       ; %bb.0:
149; GFX8-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
150; GFX8-NEXT:    flat_load_dword v0, v[0:1]
151; GFX8-NEXT:    v_mov_b32_e32 v1, 0
152; GFX8-NEXT:    v_mov_b32_e32 v2, 0
153; GFX8-NEXT:    s_waitcnt vmcnt(0)
154; GFX8-NEXT:    s_setpc_b64 s[30:31]
155;
156; GFX6-LABEL: zextload_global_i32_to_i96:
157; GFX6:       ; %bb.0:
158; GFX6-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
159; GFX6-NEXT:    s_mov_b32 s6, 0
160; GFX6-NEXT:    s_mov_b32 s7, 0xf000
161; GFX6-NEXT:    s_mov_b64 s[4:5], 0
162; GFX6-NEXT:    buffer_load_dword v0, v[0:1], s[4:7], 0 addr64
163; GFX6-NEXT:    v_mov_b32_e32 v1, 0
164; GFX6-NEXT:    v_mov_b32_e32 v2, 0
165; GFX6-NEXT:    s_waitcnt vmcnt(0)
166; GFX6-NEXT:    s_setpc_b64 s[30:31]
167  %load = load i32, i32 addrspace(1)* %ptr
168  %ext = zext i32 %load to i96
169  ret i96 %ext
170}
171
172define i128 @zextload_global_i32_to_i128(i32 addrspace(1)* %ptr) {
173; GFX9-LABEL: zextload_global_i32_to_i128:
174; GFX9:       ; %bb.0:
175; GFX9-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
176; GFX9-NEXT:    global_load_dword v0, v[0:1], off
177; GFX9-NEXT:    v_mov_b32_e32 v1, 0
178; GFX9-NEXT:    v_mov_b32_e32 v2, 0
179; GFX9-NEXT:    v_mov_b32_e32 v3, 0
180; GFX9-NEXT:    s_waitcnt vmcnt(0)
181; GFX9-NEXT:    s_setpc_b64 s[30:31]
182;
183; GFX8-LABEL: zextload_global_i32_to_i128:
184; GFX8:       ; %bb.0:
185; GFX8-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
186; GFX8-NEXT:    flat_load_dword v0, v[0:1]
187; GFX8-NEXT:    v_mov_b32_e32 v1, 0
188; GFX8-NEXT:    v_mov_b32_e32 v2, 0
189; GFX8-NEXT:    v_mov_b32_e32 v3, 0
190; GFX8-NEXT:    s_waitcnt vmcnt(0)
191; GFX8-NEXT:    s_setpc_b64 s[30:31]
192;
193; GFX6-LABEL: zextload_global_i32_to_i128:
194; GFX6:       ; %bb.0:
195; GFX6-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
196; GFX6-NEXT:    s_mov_b32 s6, 0
197; GFX6-NEXT:    s_mov_b32 s7, 0xf000
198; GFX6-NEXT:    s_mov_b64 s[4:5], 0
199; GFX6-NEXT:    buffer_load_dword v0, v[0:1], s[4:7], 0 addr64
200; GFX6-NEXT:    v_mov_b32_e32 v1, 0
201; GFX6-NEXT:    v_mov_b32_e32 v2, 0
202; GFX6-NEXT:    v_mov_b32_e32 v3, 0
203; GFX6-NEXT:    s_waitcnt vmcnt(0)
204; GFX6-NEXT:    s_setpc_b64 s[30:31]
205  %load = load i32, i32 addrspace(1)* %ptr
206  %ext = zext i32 %load to i128
207  ret i128 %ext
208}
209