1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s
3 ; Test that constant offsets can be folded into global addresses.
5 target datalayout = "e-p:32:32-i64:64-n32:64-S128"
6 target triple = "wasm32-unknown-unknown"
8 ; FIXME: make this 'external' and make sure it still works. WebAssembly
9 ; currently only supports linking single files, so 'external' makes
11 @x = global [0 x i32] zeroinitializer
12 @y = global [50 x i32] zeroinitializer
14 ; Test basic constant offsets of both defined and external symbols.
17 ; CHECK-NEXT: .result i32{{$}}
18 ; CHECK-NEXT: i32.const $push0=, x+188{{$}}
19 ; CHECK=NEXT: return $pop0{{$}}
20 define i32* @test0() {
21 ret i32* getelementptr ([0 x i32], [0 x i32]* @x, i32 0, i32 47)
25 ; CHECK-NEXT: .result i32{{$}}
26 ; CHECK-NEXT: i32.const $push0=, y+188{{$}}
27 ; CHECK=NEXT: return $pop0{{$}}
28 define i32* @test1() {
29 ret i32* getelementptr ([50 x i32], [50 x i32]* @y, i32 0, i32 47)
35 ; CHECK-NEXT: .result i32{{$}}
36 ; CHECK-NEXT: i32.const $push0=, x{{$}}
37 ; CHECK=NEXT: return $pop0{{$}}
38 define i32* @test2() {
39 ret i32* getelementptr ([0 x i32], [0 x i32]* @x, i32 0, i32 0)
43 ; CHECK-NEXT: .result i32{{$}}
44 ; CHECK-NEXT: i32.const $push0=, y{{$}}
45 ; CHECK=NEXT: return $pop0{{$}}
46 define i32* @test3() {
47 ret i32* getelementptr ([50 x i32], [50 x i32]* @y, i32 0, i32 0)