18a9cb242SWouter van Oortmerssen; RUN: llc < %s -asm-verbose=false -wasm-disable-explicit-locals -wasm-keep-registers -disable-wasm-fallthrough-return-opt | FileCheck %s
24b9d7916SDan Gohman
34b9d7916SDan Gohman; Test constant load and store address offsets.
44b9d7916SDan Gohman
5a5908009SSam Cleggtarget triple = "wasm32-unknown-unknown"
64b9d7916SDan Gohman
7d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
8d31bc986SHeejin Ahn; Loads: 32-bit
9d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
10d31bc986SHeejin Ahn
11d31bc986SHeejin Ahn; Basic load.
12d31bc986SHeejin Ahn
13d31bc986SHeejin Ahn; CHECK-LABEL: load_i32_no_offset:
14d31bc986SHeejin Ahn; CHECK: i32.load $push0=, 0($0){{$}}
15d31bc986SHeejin Ahn; CHECK-NEXT: return $pop0{{$}}
16d31bc986SHeejin Ahndefine i32 @load_i32_no_offset(i32 *%p) {
17d31bc986SHeejin Ahn  %v = load i32, i32* %p
18d31bc986SHeejin Ahn  ret i32 %v
19d31bc986SHeejin Ahn}
20d31bc986SHeejin Ahn
214b9d7916SDan Gohman; With an nuw add, we can fold an offset.
224b9d7916SDan Gohman
234b9d7916SDan Gohman; CHECK-LABEL: load_i32_with_folded_offset:
244b9d7916SDan Gohman; CHECK: i32.load  $push0=, 24($0){{$}}
254b9d7916SDan Gohmandefine i32 @load_i32_with_folded_offset(i32* %p) {
264b9d7916SDan Gohman  %q = ptrtoint i32* %p to i32
274b9d7916SDan Gohman  %r = add nuw i32 %q, 24
284b9d7916SDan Gohman  %s = inttoptr i32 %r to i32*
294b9d7916SDan Gohman  %t = load i32, i32* %s
304b9d7916SDan Gohman  ret i32 %t
314b9d7916SDan Gohman}
324b9d7916SDan Gohman
33797f639eSDan Gohman; With an inbounds gep, we can fold an offset.
34797f639eSDan Gohman
35797f639eSDan Gohman; CHECK-LABEL: load_i32_with_folded_gep_offset:
36797f639eSDan Gohman; CHECK: i32.load  $push0=, 24($0){{$}}
37797f639eSDan Gohmandefine i32 @load_i32_with_folded_gep_offset(i32* %p) {
38797f639eSDan Gohman  %s = getelementptr inbounds i32, i32* %p, i32 6
39797f639eSDan Gohman  %t = load i32, i32* %s
40797f639eSDan Gohman  ret i32 %t
41797f639eSDan Gohman}
42797f639eSDan Gohman
43797f639eSDan Gohman; We can't fold a negative offset though, even with an inbounds gep.
44797f639eSDan Gohman
45797f639eSDan Gohman; CHECK-LABEL: load_i32_with_unfolded_gep_negative_offset:
46797f639eSDan Gohman; CHECK: i32.const $push0=, -24{{$}}
47797f639eSDan Gohman; CHECK: i32.add   $push1=, $0, $pop0{{$}}
48797f639eSDan Gohman; CHECK: i32.load  $push2=, 0($pop1){{$}}
49797f639eSDan Gohmandefine i32 @load_i32_with_unfolded_gep_negative_offset(i32* %p) {
50797f639eSDan Gohman  %s = getelementptr inbounds i32, i32* %p, i32 -6
51797f639eSDan Gohman  %t = load i32, i32* %s
52797f639eSDan Gohman  ret i32 %t
53797f639eSDan Gohman}
54797f639eSDan Gohman
554b9d7916SDan Gohman; Without nuw, and even with nsw, we can't fold an offset.
564b9d7916SDan Gohman
574b9d7916SDan Gohman; CHECK-LABEL: load_i32_with_unfolded_offset:
584b9d7916SDan Gohman; CHECK: i32.const $push0=, 24{{$}}
594b9d7916SDan Gohman; CHECK: i32.add   $push1=, $0, $pop0{{$}}
604b9d7916SDan Gohman; CHECK: i32.load  $push2=, 0($pop1){{$}}
614b9d7916SDan Gohmandefine i32 @load_i32_with_unfolded_offset(i32* %p) {
624b9d7916SDan Gohman  %q = ptrtoint i32* %p to i32
634b9d7916SDan Gohman  %r = add nsw i32 %q, 24
644b9d7916SDan Gohman  %s = inttoptr i32 %r to i32*
654b9d7916SDan Gohman  %t = load i32, i32* %s
664b9d7916SDan Gohman  ret i32 %t
674b9d7916SDan Gohman}
684b9d7916SDan Gohman
69797f639eSDan Gohman; Without inbounds, we can't fold a gep offset.
70797f639eSDan Gohman
71797f639eSDan Gohman; CHECK-LABEL: load_i32_with_unfolded_gep_offset:
72797f639eSDan Gohman; CHECK: i32.const $push0=, 24{{$}}
73797f639eSDan Gohman; CHECK: i32.add   $push1=, $0, $pop0{{$}}
74797f639eSDan Gohman; CHECK: i32.load  $push2=, 0($pop1){{$}}
75797f639eSDan Gohmandefine i32 @load_i32_with_unfolded_gep_offset(i32* %p) {
76797f639eSDan Gohman  %s = getelementptr i32, i32* %p, i32 6
77797f639eSDan Gohman  %t = load i32, i32* %s
78797f639eSDan Gohman  ret i32 %t
79797f639eSDan Gohman}
80797f639eSDan Gohman
814b9d7916SDan Gohman; When loading from a fixed address, materialize a zero.
824b9d7916SDan Gohman
834b9d7916SDan Gohman; CHECK-LABEL: load_i32_from_numeric_address
844b9d7916SDan Gohman; CHECK: i32.const $push0=, 0{{$}}
854b9d7916SDan Gohman; CHECK: i32.load  $push1=, 42($pop0){{$}}
864b9d7916SDan Gohmandefine i32 @load_i32_from_numeric_address() {
874b9d7916SDan Gohman  %s = inttoptr i32 42 to i32*
884b9d7916SDan Gohman  %t = load i32, i32* %s
894b9d7916SDan Gohman  ret i32 %t
904b9d7916SDan Gohman}
914b9d7916SDan Gohman
924b9d7916SDan Gohman; CHECK-LABEL: load_i32_from_global_address
934b9d7916SDan Gohman; CHECK: i32.const $push0=, 0{{$}}
944b9d7916SDan Gohman; CHECK: i32.load  $push1=, gv($pop0){{$}}
954b9d7916SDan Gohman@gv = global i32 0
964b9d7916SDan Gohmandefine i32 @load_i32_from_global_address() {
974b9d7916SDan Gohman  %t = load i32, i32* @gv
984b9d7916SDan Gohman  ret i32 %t
994b9d7916SDan Gohman}
1004b9d7916SDan Gohman
101d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
102d31bc986SHeejin Ahn; Loads: 64-bit
103d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
104d31bc986SHeejin Ahn
105d31bc986SHeejin Ahn; Basic load.
106d31bc986SHeejin Ahn
107d31bc986SHeejin Ahn; CHECK-LABEL: load_i64_no_offset:
108d31bc986SHeejin Ahn; CHECK: i64.load $push0=, 0($0){{$}}
109d31bc986SHeejin Ahn; CHECK-NEXT: return $pop0{{$}}
110d31bc986SHeejin Ahndefine i64 @load_i64_no_offset(i64 *%p) {
111d31bc986SHeejin Ahn  %v = load i64, i64* %p
112d31bc986SHeejin Ahn  ret i64 %v
113d31bc986SHeejin Ahn}
114d31bc986SHeejin Ahn
115d31bc986SHeejin Ahn; With an nuw add, we can fold an offset.
116d31bc986SHeejin Ahn
117d31bc986SHeejin Ahn; CHECK-LABEL: load_i64_with_folded_offset:
118d31bc986SHeejin Ahn; CHECK: i64.load  $push0=, 24($0){{$}}
119d31bc986SHeejin Ahndefine i64 @load_i64_with_folded_offset(i64* %p) {
120d31bc986SHeejin Ahn  %q = ptrtoint i64* %p to i32
121d31bc986SHeejin Ahn  %r = add nuw i32 %q, 24
122d31bc986SHeejin Ahn  %s = inttoptr i32 %r to i64*
123d31bc986SHeejin Ahn  %t = load i64, i64* %s
124d31bc986SHeejin Ahn  ret i64 %t
125d31bc986SHeejin Ahn}
126d31bc986SHeejin Ahn
127d31bc986SHeejin Ahn; With an inbounds gep, we can fold an offset.
128d31bc986SHeejin Ahn
129d31bc986SHeejin Ahn; CHECK-LABEL: load_i64_with_folded_gep_offset:
130d31bc986SHeejin Ahn; CHECK: i64.load  $push0=, 24($0){{$}}
131d31bc986SHeejin Ahndefine i64 @load_i64_with_folded_gep_offset(i64* %p) {
132d31bc986SHeejin Ahn  %s = getelementptr inbounds i64, i64* %p, i32 3
133d31bc986SHeejin Ahn  %t = load i64, i64* %s
134d31bc986SHeejin Ahn  ret i64 %t
135d31bc986SHeejin Ahn}
136d31bc986SHeejin Ahn
137d31bc986SHeejin Ahn; We can't fold a negative offset though, even with an inbounds gep.
138d31bc986SHeejin Ahn
139d31bc986SHeejin Ahn; CHECK-LABEL: load_i64_with_unfolded_gep_negative_offset:
140d31bc986SHeejin Ahn; CHECK: i32.const $push0=, -24{{$}}
141d31bc986SHeejin Ahn; CHECK: i32.add   $push1=, $0, $pop0{{$}}
142d31bc986SHeejin Ahn; CHECK: i64.load  $push2=, 0($pop1){{$}}
143d31bc986SHeejin Ahndefine i64 @load_i64_with_unfolded_gep_negative_offset(i64* %p) {
144d31bc986SHeejin Ahn  %s = getelementptr inbounds i64, i64* %p, i32 -3
145d31bc986SHeejin Ahn  %t = load i64, i64* %s
146d31bc986SHeejin Ahn  ret i64 %t
147d31bc986SHeejin Ahn}
148d31bc986SHeejin Ahn
149d31bc986SHeejin Ahn; Without nuw, and even with nsw, we can't fold an offset.
150d31bc986SHeejin Ahn
151d31bc986SHeejin Ahn; CHECK-LABEL: load_i64_with_unfolded_offset:
152d31bc986SHeejin Ahn; CHECK: i32.const $push0=, 24{{$}}
153d31bc986SHeejin Ahn; CHECK: i32.add   $push1=, $0, $pop0{{$}}
154d31bc986SHeejin Ahn; CHECK: i64.load  $push2=, 0($pop1){{$}}
155d31bc986SHeejin Ahndefine i64 @load_i64_with_unfolded_offset(i64* %p) {
156d31bc986SHeejin Ahn  %q = ptrtoint i64* %p to i32
157d31bc986SHeejin Ahn  %r = add nsw i32 %q, 24
158d31bc986SHeejin Ahn  %s = inttoptr i32 %r to i64*
159d31bc986SHeejin Ahn  %t = load i64, i64* %s
160d31bc986SHeejin Ahn  ret i64 %t
161d31bc986SHeejin Ahn}
162d31bc986SHeejin Ahn
163d31bc986SHeejin Ahn; Without inbounds, we can't fold a gep offset.
164d31bc986SHeejin Ahn
165d31bc986SHeejin Ahn; CHECK-LABEL: load_i64_with_unfolded_gep_offset:
166d31bc986SHeejin Ahn; CHECK: i32.const $push0=, 24{{$}}
167d31bc986SHeejin Ahn; CHECK: i32.add   $push1=, $0, $pop0{{$}}
168d31bc986SHeejin Ahn; CHECK: i64.load  $push2=, 0($pop1){{$}}
169d31bc986SHeejin Ahndefine i64 @load_i64_with_unfolded_gep_offset(i64* %p) {
170d31bc986SHeejin Ahn  %s = getelementptr i64, i64* %p, i32 3
171d31bc986SHeejin Ahn  %t = load i64, i64* %s
172d31bc986SHeejin Ahn  ret i64 %t
173d31bc986SHeejin Ahn}
174d31bc986SHeejin Ahn
175d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
176d31bc986SHeejin Ahn; Stores: 32-bit
177d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
178d31bc986SHeejin Ahn
179d31bc986SHeejin Ahn; Basic store.
180d31bc986SHeejin Ahn
181d31bc986SHeejin Ahn; CHECK-LABEL: store_i32_no_offset:
18249482f82SWouter van Oortmerssen; CHECK-NEXT: .functype store_i32_no_offset (i32, i32) -> (){{$}}
183d31bc986SHeejin Ahn; CHECK-NEXT: i32.store 0($0), $1{{$}}
184d31bc986SHeejin Ahn; CHECK-NEXT: return{{$}}
185d31bc986SHeejin Ahndefine void @store_i32_no_offset(i32 *%p, i32 %v) {
186d31bc986SHeejin Ahn  store i32 %v, i32* %p
187d31bc986SHeejin Ahn  ret void
188d31bc986SHeejin Ahn}
189d31bc986SHeejin Ahn
190d31bc986SHeejin Ahn; With an nuw add, we can fold an offset.
191d31bc986SHeejin Ahn
192d31bc986SHeejin Ahn; CHECK-LABEL: store_i32_with_folded_offset:
193d31bc986SHeejin Ahn; CHECK: i32.store 24($0), $pop0{{$}}
194d31bc986SHeejin Ahndefine void @store_i32_with_folded_offset(i32* %p) {
195d31bc986SHeejin Ahn  %q = ptrtoint i32* %p to i32
196d31bc986SHeejin Ahn  %r = add nuw i32 %q, 24
197d31bc986SHeejin Ahn  %s = inttoptr i32 %r to i32*
198d31bc986SHeejin Ahn  store i32 0, i32* %s
199d31bc986SHeejin Ahn  ret void
200d31bc986SHeejin Ahn}
201d31bc986SHeejin Ahn
202d31bc986SHeejin Ahn; With an inbounds gep, we can fold an offset.
203d31bc986SHeejin Ahn
204d31bc986SHeejin Ahn; CHECK-LABEL: store_i32_with_folded_gep_offset:
205d31bc986SHeejin Ahn; CHECK: i32.store 24($0), $pop0{{$}}
206d31bc986SHeejin Ahndefine void @store_i32_with_folded_gep_offset(i32* %p) {
207d31bc986SHeejin Ahn  %s = getelementptr inbounds i32, i32* %p, i32 6
208d31bc986SHeejin Ahn  store i32 0, i32* %s
209d31bc986SHeejin Ahn  ret void
210d31bc986SHeejin Ahn}
211d31bc986SHeejin Ahn
212d31bc986SHeejin Ahn; We can't fold a negative offset though, even with an inbounds gep.
213d31bc986SHeejin Ahn
214d31bc986SHeejin Ahn; CHECK-LABEL: store_i32_with_unfolded_gep_negative_offset:
215d31bc986SHeejin Ahn; CHECK: i32.const $push0=, -24{{$}}
216d31bc986SHeejin Ahn; CHECK: i32.add   $push1=, $0, $pop0{{$}}
217d31bc986SHeejin Ahn; CHECK: i32.store 0($pop1), $pop2{{$}}
218d31bc986SHeejin Ahndefine void @store_i32_with_unfolded_gep_negative_offset(i32* %p) {
219d31bc986SHeejin Ahn  %s = getelementptr inbounds i32, i32* %p, i32 -6
220d31bc986SHeejin Ahn  store i32 0, i32* %s
221d31bc986SHeejin Ahn  ret void
222d31bc986SHeejin Ahn}
223d31bc986SHeejin Ahn
224d31bc986SHeejin Ahn; Without nuw, and even with nsw, we can't fold an offset.
225d31bc986SHeejin Ahn
226d31bc986SHeejin Ahn; CHECK-LABEL: store_i32_with_unfolded_offset:
227d31bc986SHeejin Ahn; CHECK: i32.const $push0=, 24{{$}}
228d31bc986SHeejin Ahn; CHECK: i32.add   $push1=, $0, $pop0{{$}}
229d31bc986SHeejin Ahn; CHECK: i32.store 0($pop1), $pop2{{$}}
230d31bc986SHeejin Ahndefine void @store_i32_with_unfolded_offset(i32* %p) {
231d31bc986SHeejin Ahn  %q = ptrtoint i32* %p to i32
232d31bc986SHeejin Ahn  %r = add nsw i32 %q, 24
233d31bc986SHeejin Ahn  %s = inttoptr i32 %r to i32*
234d31bc986SHeejin Ahn  store i32 0, i32* %s
235d31bc986SHeejin Ahn  ret void
236d31bc986SHeejin Ahn}
237d31bc986SHeejin Ahn
238d31bc986SHeejin Ahn; Without inbounds, we can't fold a gep offset.
239d31bc986SHeejin Ahn
240d31bc986SHeejin Ahn; CHECK-LABEL: store_i32_with_unfolded_gep_offset:
241d31bc986SHeejin Ahn; CHECK: i32.const $push0=, 24{{$}}
242d31bc986SHeejin Ahn; CHECK: i32.add   $push1=, $0, $pop0{{$}}
243d31bc986SHeejin Ahn; CHECK: i32.store 0($pop1), $pop2{{$}}
244d31bc986SHeejin Ahndefine void @store_i32_with_unfolded_gep_offset(i32* %p) {
245d31bc986SHeejin Ahn  %s = getelementptr i32, i32* %p, i32 6
246d31bc986SHeejin Ahn  store i32 0, i32* %s
247d31bc986SHeejin Ahn  ret void
248d31bc986SHeejin Ahn}
249d31bc986SHeejin Ahn
250d31bc986SHeejin Ahn; When storing from a fixed address, materialize a zero.
251d31bc986SHeejin Ahn
2524b9d7916SDan Gohman; CHECK-LABEL: store_i32_to_numeric_address:
25349482f82SWouter van Oortmerssen; CHECK:      i32.const $push0=, 0{{$}}
254b6fd39a3SDan Gohman; CHECK-NEXT: i32.const $push1=, 0{{$}}
2557f1bdb2eSDan Gohman; CHECK-NEXT: i32.store 42($pop0), $pop1{{$}}
2564b9d7916SDan Gohmandefine void @store_i32_to_numeric_address() {
2574b9d7916SDan Gohman  %s = inttoptr i32 42 to i32*
2584b9d7916SDan Gohman  store i32 0, i32* %s
2594b9d7916SDan Gohman  ret void
2604b9d7916SDan Gohman}
2614b9d7916SDan Gohman
2624b9d7916SDan Gohman; CHECK-LABEL: store_i32_to_global_address:
263b6fd39a3SDan Gohman; CHECK: i32.const $push0=, 0{{$}}
264b6fd39a3SDan Gohman; CHECK: i32.const $push1=, 0{{$}}
2657f1bdb2eSDan Gohman; CHECK: i32.store gv($pop0), $pop1{{$}}
2664b9d7916SDan Gohmandefine void @store_i32_to_global_address() {
2674b9d7916SDan Gohman  store i32 0, i32* @gv
2684b9d7916SDan Gohman  ret void
2694b9d7916SDan Gohman}
2704b9d7916SDan Gohman
271d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
272d31bc986SHeejin Ahn; Stores: 64-bit
273d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
274d31bc986SHeejin Ahn
275d31bc986SHeejin Ahn; Basic store.
276d31bc986SHeejin Ahn
277d31bc986SHeejin Ahn; CHECK-LABEL: store_i64_with_folded_offset:
278d31bc986SHeejin Ahn; CHECK: i64.store 24($0), $pop0{{$}}
279d31bc986SHeejin Ahndefine void @store_i64_with_folded_offset(i64* %p) {
280d31bc986SHeejin Ahn  %q = ptrtoint i64* %p to i32
281d31bc986SHeejin Ahn  %r = add nuw i32 %q, 24
282d31bc986SHeejin Ahn  %s = inttoptr i32 %r to i64*
283d31bc986SHeejin Ahn  store i64 0, i64* %s
284d31bc986SHeejin Ahn  ret void
285d31bc986SHeejin Ahn}
286d31bc986SHeejin Ahn
287d31bc986SHeejin Ahn; With an nuw add, we can fold an offset.
288d31bc986SHeejin Ahn
289d31bc986SHeejin Ahn; CHECK-LABEL: store_i64_with_folded_gep_offset:
290d31bc986SHeejin Ahn; CHECK: i64.store 24($0), $pop0{{$}}
291d31bc986SHeejin Ahndefine void @store_i64_with_folded_gep_offset(i64* %p) {
292d31bc986SHeejin Ahn  %s = getelementptr inbounds i64, i64* %p, i32 3
293d31bc986SHeejin Ahn  store i64 0, i64* %s
294d31bc986SHeejin Ahn  ret void
295d31bc986SHeejin Ahn}
296d31bc986SHeejin Ahn
297d31bc986SHeejin Ahn; With an inbounds gep, we can fold an offset.
298d31bc986SHeejin Ahn
299d31bc986SHeejin Ahn; CHECK-LABEL: store_i64_with_unfolded_gep_negative_offset:
300d31bc986SHeejin Ahn; CHECK: i32.const $push0=, -24{{$}}
301d31bc986SHeejin Ahn; CHECK: i32.add   $push1=, $0, $pop0{{$}}
302d31bc986SHeejin Ahn; CHECK: i64.store 0($pop1), $pop2{{$}}
303d31bc986SHeejin Ahndefine void @store_i64_with_unfolded_gep_negative_offset(i64* %p) {
304d31bc986SHeejin Ahn  %s = getelementptr inbounds i64, i64* %p, i32 -3
305d31bc986SHeejin Ahn  store i64 0, i64* %s
306d31bc986SHeejin Ahn  ret void
307d31bc986SHeejin Ahn}
308d31bc986SHeejin Ahn
309d31bc986SHeejin Ahn; We can't fold a negative offset though, even with an inbounds gep.
310d31bc986SHeejin Ahn
311d31bc986SHeejin Ahn; CHECK-LABEL: store_i64_with_unfolded_offset:
312d31bc986SHeejin Ahn; CHECK: i32.const $push0=, 24{{$}}
313d31bc986SHeejin Ahn; CHECK: i32.add   $push1=, $0, $pop0{{$}}
314d31bc986SHeejin Ahn; CHECK: i64.store 0($pop1), $pop2{{$}}
315d31bc986SHeejin Ahndefine void @store_i64_with_unfolded_offset(i64* %p) {
316d31bc986SHeejin Ahn  %q = ptrtoint i64* %p to i32
317d31bc986SHeejin Ahn  %r = add nsw i32 %q, 24
318d31bc986SHeejin Ahn  %s = inttoptr i32 %r to i64*
319d31bc986SHeejin Ahn  store i64 0, i64* %s
320d31bc986SHeejin Ahn  ret void
321d31bc986SHeejin Ahn}
322d31bc986SHeejin Ahn
323d31bc986SHeejin Ahn; Without nuw, and even with nsw, we can't fold an offset.
324d31bc986SHeejin Ahn
325d31bc986SHeejin Ahn; CHECK-LABEL: store_i64_with_unfolded_gep_offset:
326d31bc986SHeejin Ahn; CHECK: i32.const $push0=, 24{{$}}
327d31bc986SHeejin Ahn; CHECK: i32.add   $push1=, $0, $pop0{{$}}
328d31bc986SHeejin Ahn; CHECK: i64.store 0($pop1), $pop2{{$}}
329d31bc986SHeejin Ahndefine void @store_i64_with_unfolded_gep_offset(i64* %p) {
330d31bc986SHeejin Ahn  %s = getelementptr i64, i64* %p, i32 3
331d31bc986SHeejin Ahn  store i64 0, i64* %s
332d31bc986SHeejin Ahn  ret void
333d31bc986SHeejin Ahn}
334d31bc986SHeejin Ahn
335d31bc986SHeejin Ahn; Without inbounds, we can't fold a gep offset.
336d31bc986SHeejin Ahn
337d31bc986SHeejin Ahn; CHECK-LABEL: store_i32_with_folded_or_offset:
338d31bc986SHeejin Ahn; CHECK: i32.store8 2($pop{{[0-9]+}}), $pop{{[0-9]+}}{{$}}
339d31bc986SHeejin Ahndefine void @store_i32_with_folded_or_offset(i32 %x) {
340d31bc986SHeejin Ahn  %and = and i32 %x, -4
341d31bc986SHeejin Ahn  %t0 = inttoptr i32 %and to i8*
342d31bc986SHeejin Ahn  %arrayidx = getelementptr inbounds i8, i8* %t0, i32 2
343d31bc986SHeejin Ahn  store i8 0, i8* %arrayidx, align 1
344d31bc986SHeejin Ahn  ret void
345d31bc986SHeejin Ahn}
346d31bc986SHeejin Ahn
347d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
348d31bc986SHeejin Ahn; Sign-extending loads
349d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
350d31bc986SHeejin Ahn
3514b9d7916SDan Gohman; Fold an offset into a sign-extending load.
3524b9d7916SDan Gohman
353d31bc986SHeejin Ahn; CHECK-LABEL: load_i8_i32_s_with_folded_offset:
3544b9d7916SDan Gohman; CHECK: i32.load8_s $push0=, 24($0){{$}}
355d31bc986SHeejin Ahndefine i32 @load_i8_i32_s_with_folded_offset(i8* %p) {
3564b9d7916SDan Gohman  %q = ptrtoint i8* %p to i32
3574b9d7916SDan Gohman  %r = add nuw i32 %q, 24
3584b9d7916SDan Gohman  %s = inttoptr i32 %r to i8*
3594b9d7916SDan Gohman  %t = load i8, i8* %s
3604b9d7916SDan Gohman  %u = sext i8 %t to i32
3614b9d7916SDan Gohman  ret i32 %u
3624b9d7916SDan Gohman}
3634b9d7916SDan Gohman
364d31bc986SHeejin Ahn; CHECK-LABEL: load_i32_i64_s_with_folded_offset:
365d31bc986SHeejin Ahn; CHECK: i64.load32_s $push0=, 24($0){{$}}
366d31bc986SHeejin Ahndefine i64 @load_i32_i64_s_with_folded_offset(i32* %p) {
367d31bc986SHeejin Ahn  %q = ptrtoint i32* %p to i32
368d31bc986SHeejin Ahn  %r = add nuw i32 %q, 24
369d31bc986SHeejin Ahn  %s = inttoptr i32 %r to i32*
370d31bc986SHeejin Ahn  %t = load i32, i32* %s
371d31bc986SHeejin Ahn  %u = sext i32 %t to i64
372d31bc986SHeejin Ahn  ret i64 %u
373d31bc986SHeejin Ahn}
374d31bc986SHeejin Ahn
375797f639eSDan Gohman; Fold a gep offset into a sign-extending load.
376797f639eSDan Gohman
377d31bc986SHeejin Ahn; CHECK-LABEL: load_i8_i32_s_with_folded_gep_offset:
378797f639eSDan Gohman; CHECK: i32.load8_s $push0=, 24($0){{$}}
379d31bc986SHeejin Ahndefine i32 @load_i8_i32_s_with_folded_gep_offset(i8* %p) {
380797f639eSDan Gohman  %s = getelementptr inbounds i8, i8* %p, i32 24
381797f639eSDan Gohman  %t = load i8, i8* %s
382797f639eSDan Gohman  %u = sext i8 %t to i32
383797f639eSDan Gohman  ret i32 %u
384797f639eSDan Gohman}
385797f639eSDan Gohman
386d31bc986SHeejin Ahn; CHECK-LABEL: load_i16_i32_s_with_folded_gep_offset:
387d31bc986SHeejin Ahn; CHECK: i32.load16_s $push0=, 48($0){{$}}
388d31bc986SHeejin Ahndefine i32 @load_i16_i32_s_with_folded_gep_offset(i16* %p) {
389d31bc986SHeejin Ahn  %s = getelementptr inbounds i16, i16* %p, i32 24
390d31bc986SHeejin Ahn  %t = load i16, i16* %s
391d31bc986SHeejin Ahn  %u = sext i16 %t to i32
392d31bc986SHeejin Ahn  ret i32 %u
393d31bc986SHeejin Ahn}
394d31bc986SHeejin Ahn
395d31bc986SHeejin Ahn; CHECK-LABEL: load_i16_i64_s_with_folded_gep_offset:
396d31bc986SHeejin Ahn; CHECK: i64.load16_s $push0=, 48($0){{$}}
397d31bc986SHeejin Ahndefine i64 @load_i16_i64_s_with_folded_gep_offset(i16* %p) {
398d31bc986SHeejin Ahn  %s = getelementptr inbounds i16, i16* %p, i32 24
399d31bc986SHeejin Ahn  %t = load i16, i16* %s
400d31bc986SHeejin Ahn  %u = sext i16 %t to i64
401d31bc986SHeejin Ahn  ret i64 %u
402d31bc986SHeejin Ahn}
403d31bc986SHeejin Ahn
404d31bc986SHeejin Ahn; 'add' in this code becomes 'or' after DAG optimization. Treat an 'or' node as
405d31bc986SHeejin Ahn; an 'add' if the or'ed bits are known to be zero.
406d31bc986SHeejin Ahn
407d31bc986SHeejin Ahn; CHECK-LABEL: load_i8_i32_s_with_folded_or_offset:
408d31bc986SHeejin Ahn; CHECK: i32.load8_s $push{{[0-9]+}}=, 2($pop{{[0-9]+}}){{$}}
409d31bc986SHeejin Ahndefine i32 @load_i8_i32_s_with_folded_or_offset(i32 %x) {
410d31bc986SHeejin Ahn  %and = and i32 %x, -4
411d31bc986SHeejin Ahn  %t0 = inttoptr i32 %and to i8*
412d31bc986SHeejin Ahn  %arrayidx = getelementptr inbounds i8, i8* %t0, i32 2
413d31bc986SHeejin Ahn  %t1 = load i8, i8* %arrayidx
414d31bc986SHeejin Ahn  %conv = sext i8 %t1 to i32
415d31bc986SHeejin Ahn  ret i32 %conv
416d31bc986SHeejin Ahn}
417d31bc986SHeejin Ahn
418d31bc986SHeejin Ahn; CHECK-LABEL: load_i8_i64_s_with_folded_or_offset:
419d31bc986SHeejin Ahn; CHECK: i64.load8_s $push{{[0-9]+}}=, 2($pop{{[0-9]+}}){{$}}
420d31bc986SHeejin Ahndefine i64 @load_i8_i64_s_with_folded_or_offset(i32 %x) {
421d31bc986SHeejin Ahn  %and = and i32 %x, -4
422d31bc986SHeejin Ahn  %t0 = inttoptr i32 %and to i8*
423d31bc986SHeejin Ahn  %arrayidx = getelementptr inbounds i8, i8* %t0, i32 2
424d31bc986SHeejin Ahn  %t1 = load i8, i8* %arrayidx
425d31bc986SHeejin Ahn  %conv = sext i8 %t1 to i64
426d31bc986SHeejin Ahn  ret i64 %conv
427d31bc986SHeejin Ahn}
428d31bc986SHeejin Ahn
429d31bc986SHeejin Ahn; When loading from a fixed address, materialize a zero.
430d31bc986SHeejin Ahn
431d31bc986SHeejin Ahn; CHECK-LABEL: load_i16_i32_s_from_numeric_address
432d31bc986SHeejin Ahn; CHECK: i32.const $push0=, 0{{$}}
433d31bc986SHeejin Ahn; CHECK: i32.load16_s  $push1=, 42($pop0){{$}}
434d31bc986SHeejin Ahndefine i32 @load_i16_i32_s_from_numeric_address() {
435d31bc986SHeejin Ahn  %s = inttoptr i32 42 to i16*
436d31bc986SHeejin Ahn  %t = load i16, i16* %s
437d31bc986SHeejin Ahn  %u = sext i16 %t to i32
438d31bc986SHeejin Ahn  ret i32 %u
439d31bc986SHeejin Ahn}
440d31bc986SHeejin Ahn
441d31bc986SHeejin Ahn; CHECK-LABEL: load_i8_i32_s_from_global_address
442d31bc986SHeejin Ahn; CHECK: i32.const $push0=, 0{{$}}
443d31bc986SHeejin Ahn; CHECK: i32.load8_s  $push1=, gv8($pop0){{$}}
444d31bc986SHeejin Ahn@gv8 = global i8 0
445d31bc986SHeejin Ahndefine i32 @load_i8_i32_s_from_global_address() {
446d31bc986SHeejin Ahn  %t = load i8, i8* @gv8
447d31bc986SHeejin Ahn  %u = sext i8 %t to i32
448d31bc986SHeejin Ahn  ret i32 %u
449d31bc986SHeejin Ahn}
450d31bc986SHeejin Ahn
451d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
452d31bc986SHeejin Ahn; Zero-extending loads
453d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
454d31bc986SHeejin Ahn
4554b9d7916SDan Gohman; Fold an offset into a zero-extending load.
4564b9d7916SDan Gohman
457d31bc986SHeejin Ahn; CHECK-LABEL: load_i8_i32_z_with_folded_offset:
4584b9d7916SDan Gohman; CHECK: i32.load8_u $push0=, 24($0){{$}}
459d31bc986SHeejin Ahndefine i32 @load_i8_i32_z_with_folded_offset(i8* %p) {
4604b9d7916SDan Gohman  %q = ptrtoint i8* %p to i32
4614b9d7916SDan Gohman  %r = add nuw i32 %q, 24
4624b9d7916SDan Gohman  %s = inttoptr i32 %r to i8*
4634b9d7916SDan Gohman  %t = load i8, i8* %s
4644b9d7916SDan Gohman  %u = zext i8 %t to i32
4654b9d7916SDan Gohman  ret i32 %u
4664b9d7916SDan Gohman}
4674b9d7916SDan Gohman
468d31bc986SHeejin Ahn; CHECK-LABEL: load_i32_i64_z_with_folded_offset:
469d31bc986SHeejin Ahn; CHECK: i64.load32_u $push0=, 24($0){{$}}
470d31bc986SHeejin Ahndefine i64 @load_i32_i64_z_with_folded_offset(i32* %p) {
471d31bc986SHeejin Ahn  %q = ptrtoint i32* %p to i32
472d31bc986SHeejin Ahn  %r = add nuw i32 %q, 24
473d31bc986SHeejin Ahn  %s = inttoptr i32 %r to i32*
474d31bc986SHeejin Ahn  %t = load i32, i32* %s
475d31bc986SHeejin Ahn  %u = zext i32 %t to i64
476d31bc986SHeejin Ahn  ret i64 %u
477d31bc986SHeejin Ahn}
478d31bc986SHeejin Ahn
479797f639eSDan Gohman; Fold a gep offset into a zero-extending load.
480797f639eSDan Gohman
481d31bc986SHeejin Ahn; CHECK-LABEL: load_i8_i32_z_with_folded_gep_offset:
482797f639eSDan Gohman; CHECK: i32.load8_u $push0=, 24($0){{$}}
483d31bc986SHeejin Ahndefine i32 @load_i8_i32_z_with_folded_gep_offset(i8* %p) {
484797f639eSDan Gohman  %s = getelementptr inbounds i8, i8* %p, i32 24
485797f639eSDan Gohman  %t = load i8, i8* %s
486797f639eSDan Gohman  %u = zext i8 %t to i32
487797f639eSDan Gohman  ret i32 %u
488797f639eSDan Gohman}
489797f639eSDan Gohman
490d31bc986SHeejin Ahn; CHECK-LABEL: load_i16_i32_z_with_folded_gep_offset:
491d31bc986SHeejin Ahn; CHECK: i32.load16_u $push0=, 48($0){{$}}
492d31bc986SHeejin Ahndefine i32 @load_i16_i32_z_with_folded_gep_offset(i16* %p) {
493d31bc986SHeejin Ahn  %s = getelementptr inbounds i16, i16* %p, i32 24
494d31bc986SHeejin Ahn  %t = load i16, i16* %s
495d31bc986SHeejin Ahn  %u = zext i16 %t to i32
496d31bc986SHeejin Ahn  ret i32 %u
497d31bc986SHeejin Ahn}
498d31bc986SHeejin Ahn
499d31bc986SHeejin Ahn; CHECK-LABEL: load_i16_i64_z_with_folded_gep_offset:
500d31bc986SHeejin Ahn; CHECK: i64.load16_u $push0=, 48($0){{$}}
501d31bc986SHeejin Ahndefine i64 @load_i16_i64_z_with_folded_gep_offset(i16* %p) {
502d31bc986SHeejin Ahn  %s = getelementptr inbounds i16, i16* %p, i64 24
503d31bc986SHeejin Ahn  %t = load i16, i16* %s
504d31bc986SHeejin Ahn  %u = zext i16 %t to i64
505d31bc986SHeejin Ahn  ret i64 %u
506d31bc986SHeejin Ahn}
507d31bc986SHeejin Ahn
508d31bc986SHeejin Ahn; When loading from a fixed address, materialize a zero.
509d31bc986SHeejin Ahn
510d31bc986SHeejin Ahn; CHECK-LABEL: load_i16_i32_z_from_numeric_address
511d31bc986SHeejin Ahn; CHECK: i32.const $push0=, 0{{$}}
512d31bc986SHeejin Ahn; CHECK: i32.load16_u  $push1=, 42($pop0){{$}}
513d31bc986SHeejin Ahndefine i32 @load_i16_i32_z_from_numeric_address() {
514d31bc986SHeejin Ahn  %s = inttoptr i32 42 to i16*
515d31bc986SHeejin Ahn  %t = load i16, i16* %s
516d31bc986SHeejin Ahn  %u = zext i16 %t to i32
517d31bc986SHeejin Ahn  ret i32 %u
518d31bc986SHeejin Ahn}
519d31bc986SHeejin Ahn
520d31bc986SHeejin Ahn; CHECK-LABEL: load_i8_i32_z_from_global_address
521d31bc986SHeejin Ahn; CHECK: i32.const $push0=, 0{{$}}
522d31bc986SHeejin Ahn; CHECK: i32.load8_u  $push1=, gv8($pop0){{$}}
523d31bc986SHeejin Ahndefine i32 @load_i8_i32_z_from_global_address() {
524d31bc986SHeejin Ahn  %t = load i8, i8* @gv8
525d31bc986SHeejin Ahn  %u = zext i8 %t to i32
526d31bc986SHeejin Ahn  ret i32 %u
527d31bc986SHeejin Ahn}
528d31bc986SHeejin Ahn
529d31bc986SHeejin Ahn; i8 return value should test anyext loads
530d31bc986SHeejin Ahn; CHECK-LABEL: load_i8_i32_retvalue:
531d31bc986SHeejin Ahn; CHECK: i32.load8_u $push[[NUM:[0-9]+]]=, 0($0){{$}}
532d31bc986SHeejin Ahn; CHECK-NEXT: return $pop[[NUM]]{{$}}
533d31bc986SHeejin Ahndefine i8 @load_i8_i32_retvalue(i8 *%p) {
534d31bc986SHeejin Ahn  %v = load i8, i8* %p
535d31bc986SHeejin Ahn  ret i8 %v
536d31bc986SHeejin Ahn}
537d31bc986SHeejin Ahn
538d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
539d31bc986SHeejin Ahn; Truncating stores
540d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
541d31bc986SHeejin Ahn
5424b9d7916SDan Gohman; Fold an offset into a truncating store.
5434b9d7916SDan Gohman
544d31bc986SHeejin Ahn; CHECK-LABEL: store_i8_i32_with_folded_offset:
545d31bc986SHeejin Ahn; CHECK: i32.store8 24($0), $1{{$}}
546d31bc986SHeejin Ahndefine void @store_i8_i32_with_folded_offset(i8* %p, i32 %v) {
5474b9d7916SDan Gohman  %q = ptrtoint i8* %p to i32
5484b9d7916SDan Gohman  %r = add nuw i32 %q, 24
5494b9d7916SDan Gohman  %s = inttoptr i32 %r to i8*
550d31bc986SHeejin Ahn  %t = trunc i32 %v to i8
551d31bc986SHeejin Ahn  store i8 %t, i8* %s
552d31bc986SHeejin Ahn  ret void
553d31bc986SHeejin Ahn}
554d31bc986SHeejin Ahn
555d31bc986SHeejin Ahn; CHECK-LABEL: store_i32_i64_with_folded_offset:
556d31bc986SHeejin Ahn; CHECK: i64.store32 24($0), $1{{$}}
557d31bc986SHeejin Ahndefine void @store_i32_i64_with_folded_offset(i32* %p, i64 %v) {
558d31bc986SHeejin Ahn  %q = ptrtoint i32* %p to i32
559d31bc986SHeejin Ahn  %r = add nuw i32 %q, 24
560d31bc986SHeejin Ahn  %s = inttoptr i32 %r to i32*
561d31bc986SHeejin Ahn  %t = trunc i64 %v to i32
562d31bc986SHeejin Ahn  store i32 %t, i32* %s
5634b9d7916SDan Gohman  ret void
5644b9d7916SDan Gohman}
565797f639eSDan Gohman
566797f639eSDan Gohman; Fold a gep offset into a truncating store.
567797f639eSDan Gohman
568d31bc986SHeejin Ahn; CHECK-LABEL: store_i8_i32_with_folded_gep_offset:
569d31bc986SHeejin Ahn; CHECK: i32.store8 24($0), $1{{$}}
570d31bc986SHeejin Ahndefine void @store_i8_i32_with_folded_gep_offset(i8* %p, i32 %v) {
571797f639eSDan Gohman  %s = getelementptr inbounds i8, i8* %p, i32 24
572d31bc986SHeejin Ahn  %t = trunc i32 %v to i8
573d31bc986SHeejin Ahn  store i8 %t, i8* %s
574797f639eSDan Gohman  ret void
575797f639eSDan Gohman}
576797f639eSDan Gohman
577d31bc986SHeejin Ahn; CHECK-LABEL: store_i16_i32_with_folded_gep_offset:
578d31bc986SHeejin Ahn; CHECK: i32.store16 48($0), $1{{$}}
579d31bc986SHeejin Ahndefine void @store_i16_i32_with_folded_gep_offset(i16* %p, i32 %v) {
580d31bc986SHeejin Ahn  %s = getelementptr inbounds i16, i16* %p, i32 24
581d31bc986SHeejin Ahn  %t = trunc i32 %v to i16
582d31bc986SHeejin Ahn  store i16 %t, i16* %s
583d31bc986SHeejin Ahn  ret void
584d31bc986SHeejin Ahn}
585d31bc986SHeejin Ahn
586d31bc986SHeejin Ahn; CHECK-LABEL: store_i16_i64_with_folded_gep_offset:
587d31bc986SHeejin Ahn; CHECK: i64.store16 48($0), $1{{$}}
588d31bc986SHeejin Ahndefine void @store_i16_i64_with_folded_gep_offset(i16* %p, i64 %v) {
589d31bc986SHeejin Ahn  %s = getelementptr inbounds i16, i16* %p, i64 24
590d31bc986SHeejin Ahn  %t = trunc i64 %v to i16
591d31bc986SHeejin Ahn  store i16 %t, i16* %s
592d31bc986SHeejin Ahn  ret void
593d31bc986SHeejin Ahn}
594d31bc986SHeejin Ahn
595d31bc986SHeejin Ahn; 'add' in this code becomes 'or' after DAG optimization. Treat an 'or' node as
596d31bc986SHeejin Ahn; an 'add' if the or'ed bits are known to be zero.
597d31bc986SHeejin Ahn
598d31bc986SHeejin Ahn; CHECK-LABEL: store_i8_i32_with_folded_or_offset:
599d31bc986SHeejin Ahn; CHECK: i32.store8 2($pop{{[0-9]+}}), $1{{$}}
600d31bc986SHeejin Ahndefine void @store_i8_i32_with_folded_or_offset(i32 %x, i32 %v) {
601d31bc986SHeejin Ahn  %and = and i32 %x, -4
602d31bc986SHeejin Ahn  %p = inttoptr i32 %and to i8*
603d31bc986SHeejin Ahn  %arrayidx = getelementptr inbounds i8, i8* %p, i32 2
604d31bc986SHeejin Ahn  %t = trunc i32 %v to i8
605d31bc986SHeejin Ahn  store i8 %t, i8* %arrayidx
606d31bc986SHeejin Ahn  ret void
607d31bc986SHeejin Ahn}
608d31bc986SHeejin Ahn
609d31bc986SHeejin Ahn; CHECK-LABEL: store_i8_i64_with_folded_or_offset:
610d31bc986SHeejin Ahn; CHECK: i64.store8 2($pop{{[0-9]+}}), $1{{$}}
611d31bc986SHeejin Ahndefine void @store_i8_i64_with_folded_or_offset(i32 %x, i64 %v) {
612d31bc986SHeejin Ahn  %and = and i32 %x, -4
613d31bc986SHeejin Ahn  %p = inttoptr i32 %and to i8*
614d31bc986SHeejin Ahn  %arrayidx = getelementptr inbounds i8, i8* %p, i32 2
615d31bc986SHeejin Ahn  %t = trunc i64 %v to i8
616d31bc986SHeejin Ahn  store i8 %t, i8* %arrayidx
617d31bc986SHeejin Ahn  ret void
618d31bc986SHeejin Ahn}
619d31bc986SHeejin Ahn
620d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
621d31bc986SHeejin Ahn; Aggregate values
622d31bc986SHeejin Ahn;===----------------------------------------------------------------------------
623d31bc986SHeejin Ahn
624797f639eSDan Gohman; Fold the offsets when lowering aggregate loads and stores.
625797f639eSDan Gohman
626797f639eSDan Gohman; CHECK-LABEL: aggregate_load_store:
627797f639eSDan Gohman; CHECK: i32.load  $2=, 0($0){{$}}
628797f639eSDan Gohman; CHECK: i32.load  $3=, 4($0){{$}}
629797f639eSDan Gohman; CHECK: i32.load  $4=, 8($0){{$}}
630797f639eSDan Gohman; CHECK: i32.load  $push0=, 12($0){{$}}
6317f1bdb2eSDan Gohman; CHECK: i32.store 12($1), $pop0{{$}}
6327f1bdb2eSDan Gohman; CHECK: i32.store 8($1), $4{{$}}
6337f1bdb2eSDan Gohman; CHECK: i32.store 4($1), $3{{$}}
6347f1bdb2eSDan Gohman; CHECK: i32.store 0($1), $2{{$}}
635797f639eSDan Gohmandefine void @aggregate_load_store({i32,i32,i32,i32}* %p, {i32,i32,i32,i32}* %q) {
636797f639eSDan Gohman  ; volatile so that things stay in order for the tests above
637797f639eSDan Gohman  %t = load volatile {i32,i32,i32,i32}, {i32, i32,i32,i32}* %p
638797f639eSDan Gohman  store volatile {i32,i32,i32,i32} %t, {i32, i32,i32,i32}* %q
639797f639eSDan Gohman  ret void
640797f639eSDan Gohman}
641797f639eSDan Gohman
642bb372243SDan Gohman; Fold the offsets when lowering aggregate return values. The stores get
643bb372243SDan Gohman; merged into i64 stores.
644797f639eSDan Gohman
645797f639eSDan Gohman; CHECK-LABEL: aggregate_return:
6460cfb5f85SDan Gohman; CHECK: i64.const   $push[[L0:[0-9]+]]=, 0{{$}}
647*d1ff003fSAlex Richardson; CHECK: i64.store   8($0), $pop[[L0]]{{$}}
648c9623db8SDan Gohman; CHECK: i64.const   $push[[L1:[0-9]+]]=, 0{{$}}
649*d1ff003fSAlex Richardson; CHECK: i64.store   0($0), $pop[[L1]]{{$}}
650797f639eSDan Gohmandefine {i32,i32,i32,i32} @aggregate_return() {
651797f639eSDan Gohman  ret {i32,i32,i32,i32} zeroinitializer
652797f639eSDan Gohman}
653bb372243SDan Gohman
654bb372243SDan Gohman; Fold the offsets when lowering aggregate return values. The stores are not
655bb372243SDan Gohman; merged.
656bb372243SDan Gohman
657bb372243SDan Gohman; CHECK-LABEL: aggregate_return_without_merge:
6580cfb5f85SDan Gohman; CHECK: i32.const   $push[[L0:[0-9]+]]=, 0{{$}}
6597f1bdb2eSDan Gohman; CHECK: i32.store8  14($0), $pop[[L0]]{{$}}
660c9623db8SDan Gohman; CHECK: i32.const   $push[[L1:[0-9]+]]=, 0{{$}}
6617f1bdb2eSDan Gohman; CHECK: i32.store16 12($0), $pop[[L1]]{{$}}
662c9623db8SDan Gohman; CHECK: i32.const   $push[[L2:[0-9]+]]=, 0{{$}}
6637f1bdb2eSDan Gohman; CHECK: i32.store   8($0), $pop[[L2]]{{$}}
6640cfb5f85SDan Gohman; CHECK: i64.const   $push[[L3:[0-9]+]]=, 0{{$}}
6657f1bdb2eSDan Gohman; CHECK: i64.store   0($0), $pop[[L3]]{{$}}
666bb372243SDan Gohmandefine {i64,i32,i16,i8} @aggregate_return_without_merge() {
667bb372243SDan Gohman  ret {i64,i32,i16,i8} zeroinitializer
668bb372243SDan Gohman}
669