1; Based llvm/test/CodeGen/X86/aliases.ll
2; RUN: llc < %s -mtriple=wasm32-unknown-uknown -asm-verbose=false | FileCheck %s
3
4@bar = global i32 42
5
6; CHECK-DAG: .globl	foo1
7; CHECK-DAG: .set foo1, bar
8@foo1 = alias i32, i32* @bar
9
10; CHECK-DAG: .globl	foo2
11; CHECK-DAG: .set foo2, bar
12@foo2 = alias i32, i32* @bar
13
14%FunTy = type i32()
15
16define i32 @foo_f() {
17  ret i32 0
18}
19
20; CHECK-DAG: .weak	bar_f
21; CHECK-DAG: .type	bar_f,@function
22; CHECK-DAG: .set bar_f, foo_f
23@bar_f = weak alias %FunTy, %FunTy* @foo_f
24
25; CHECK-DAG: .weak	bar_l
26; CHECK-DAG: .set bar_l, bar
27@bar_l = linkonce_odr alias i32, i32* @bar
28
29; CHECK-DAG: .set bar_i, bar
30@bar_i = internal alias i32, i32* @bar
31
32; CHECK-DAG: .globl	A
33@A = alias i64, bitcast (i32* @bar to i64*)
34
35; CHECK-DAG: .globl	bar_h
36; CHECK-DAG: .hidden	bar_h
37; CHECK-DAG: .set bar_h, bar
38@bar_h = hidden alias i32, i32* @bar
39
40; CHECK-DAG: .globl	bar_p
41; CHECK-DAG: .protected	bar_p
42; CHECK-DAG: .set bar_p, bar
43@bar_p = protected alias i32, i32* @bar
44
45; CHECK-DAG: .set test2, bar+4
46@test2 = alias i32, getelementptr(i32, i32* @bar, i32 1)
47
48; CHECK-DAG: .set test3, 42
49@test3 = alias i32, inttoptr(i32 42 to i32*)
50
51; CHECK-DAG: .set test4, bar
52@test4 = alias i32, inttoptr(i64 ptrtoint (i32* @bar to i64) to i32*)
53
54; CHECK-DAG: .set test5, test2-bar
55@test5 = alias i32, inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32),
56                                 i32 ptrtoint (i32* @bar to i32)) to i32*)
57
58; CHECK-DAG: .globl	test
59define i32 @test() {
60entry:
61   %tmp = load i32, i32* @foo1
62   %tmp1 = load i32, i32* @foo2
63   %tmp0 = load i32, i32* @bar_i
64   %tmp2 = call i32 @foo_f()
65   %tmp3 = add i32 %tmp, %tmp2
66   %tmp4 = call i32 @bar_f()
67   %tmp5 = add i32 %tmp3, %tmp4
68   %tmp6 = add i32 %tmp1, %tmp5
69   %tmp7 = add i32 %tmp6, %tmp0
70   ret i32 %tmp7
71}
72