1 ; RUN: llc -march=mipsel -mcpu=mips2 < %s | FileCheck %s -check-prefix=PIC
2 ; RUN: llc -march=mipsel -mcpu=mips2 -relocation-model=static < %s \
3 ; RUN: | FileCheck %s -check-prefix=STATIC
6 @t1 = thread_local global i32 0, align 4
8 define i32 @f1() nounwind {
10 %tmp = load i32* @t1, align 4
15 ; PIC: lw $25, %call16(__tls_get_addr)($gp)
16 ; PIC: addiu $4, $gp, %tlsgd(t1)
20 ; STATIC: rdhwr $3, $29
21 ; STATIC: lui $[[R0:[0-9]+]], %tprel_hi(t1)
22 ; STATIC: addiu $[[R1:[0-9]+]], $[[R0]], %tprel_lo(t1)
23 ; STATIC: addu $[[R2:[0-9]+]], $3, $[[R1]]
24 ; STATIC: lw $2, 0($[[R2]])
28 @t2 = external thread_local global i32
30 define i32 @f2() nounwind {
32 %tmp = load i32* @t2, align 4
37 ; PIC: lw $25, %call16(__tls_get_addr)($gp)
38 ; PIC: addiu $4, $gp, %tlsgd(t2)
42 ; STATIC: rdhwr $3, $29
43 ; STATIC: lw $[[R0:[0-9]+]], %gottprel(t2)($gp)
44 ; STATIC: addu $[[R1:[0-9]+]], $3, $[[R0]]
45 ; STATIC: lw $2, 0($[[R1]])