1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i686-pc-linux-gnu -asm-verbose=false \ 2*9880d681SAndroid Build Coastguard Worker; RUN: -relocation-model=pic | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker@thread_var = thread_local global i32 42, align 4 5*9880d681SAndroid Build Coastguard Worker@thread_alias = thread_local(localdynamic) alias i32, i32* @thread_var 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: get_thread_var 8*9880d681SAndroid Build Coastguard Workerdefine i32* @get_thread_var() { 9*9880d681SAndroid Build Coastguard Worker; CHECK: leal thread_var@TLSGD 10*9880d681SAndroid Build Coastguard Worker ret i32* @thread_var 11*9880d681SAndroid Build Coastguard Worker} 12*9880d681SAndroid Build Coastguard Worker 13*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: get_thread_alias 14*9880d681SAndroid Build Coastguard Workerdefine i32* @get_thread_alias() { 15*9880d681SAndroid Build Coastguard Worker; CHECK: leal thread_alias@TLSLD 16*9880d681SAndroid Build Coastguard Worker ret i32* @thread_alias 17*9880d681SAndroid Build Coastguard Worker} 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Worker@bar = global i32 42 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: .globl foo1 22*9880d681SAndroid Build Coastguard Worker@foo1 = alias i32, i32* @bar 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: .globl foo2 25*9880d681SAndroid Build Coastguard Worker@foo2 = alias i32, i32* @bar 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker%FunTy = type i32() 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Workerdefine i32 @foo_f() { 30*9880d681SAndroid Build Coastguard Worker ret i32 0 31*9880d681SAndroid Build Coastguard Worker} 32*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: .weak bar_f 33*9880d681SAndroid Build Coastguard Worker@bar_f = weak alias %FunTy, %FunTy* @foo_f 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker@bar_l = linkonce_odr alias i32, i32* @bar 36*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: .weak bar_l 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker@bar_i = internal alias i32, i32* @bar 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: .globl A 41*9880d681SAndroid Build Coastguard Worker@A = alias i64, bitcast (i32* @bar to i64*) 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: .globl bar_h 44*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: .hidden bar_h 45*9880d681SAndroid Build Coastguard Worker@bar_h = hidden alias i32, i32* @bar 46*9880d681SAndroid Build Coastguard Worker 47*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: .globl bar_p 48*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: .protected bar_p 49*9880d681SAndroid Build Coastguard Worker@bar_p = protected alias i32, i32* @bar 50*9880d681SAndroid Build Coastguard Worker 51*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: test2 = bar+4 52*9880d681SAndroid Build Coastguard Worker@test2 = alias i32, getelementptr(i32, i32* @bar, i32 1) 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: test3 = 42 55*9880d681SAndroid Build Coastguard Worker@test3 = alias i32, inttoptr(i32 42 to i32*) 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: test4 = bar 58*9880d681SAndroid Build Coastguard Worker@test4 = alias i32, inttoptr(i64 ptrtoint (i32* @bar to i64) to i32*) 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: test5 = test2-bar 61*9880d681SAndroid Build Coastguard Worker@test5 = alias i32, inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32), 62*9880d681SAndroid Build Coastguard Worker i32 ptrtoint (i32* @bar to i32)) to i32*) 63*9880d681SAndroid Build Coastguard Worker 64*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: .globl test 65*9880d681SAndroid Build Coastguard Workerdefine i32 @test() { 66*9880d681SAndroid Build Coastguard Workerentry: 67*9880d681SAndroid Build Coastguard Worker %tmp = load i32, i32* @foo1 68*9880d681SAndroid Build Coastguard Worker %tmp1 = load i32, i32* @foo2 69*9880d681SAndroid Build Coastguard Worker %tmp0 = load i32, i32* @bar_i 70*9880d681SAndroid Build Coastguard Worker %tmp2 = call i32 @foo_f() 71*9880d681SAndroid Build Coastguard Worker %tmp3 = add i32 %tmp, %tmp2 72*9880d681SAndroid Build Coastguard Worker %tmp4 = call i32 @bar_f() 73*9880d681SAndroid Build Coastguard Worker %tmp5 = add i32 %tmp3, %tmp4 74*9880d681SAndroid Build Coastguard Worker %tmp6 = add i32 %tmp1, %tmp5 75*9880d681SAndroid Build Coastguard Worker %tmp7 = add i32 %tmp6, %tmp0 76*9880d681SAndroid Build Coastguard Worker ret i32 %tmp7 77*9880d681SAndroid Build Coastguard Worker} 78