2012-08-22 02:51:28 +00:00
|
|
|
; RUN: llc -march=mipsel -disable-mips-delay-filler < %s | \
|
2014-02-16 13:28:15 +00:00
|
|
|
; RUN: FileCheck %s -check-prefix=PIC -check-prefix=CHECK
|
2012-08-22 02:51:28 +00:00
|
|
|
; RUN: llc -march=mipsel -relocation-model=static -disable-mips-delay-filler < \
|
2014-02-16 13:28:15 +00:00
|
|
|
; RUN: %s | FileCheck %s -check-prefix=STATIC -check-prefix=CHECK
|
2012-08-22 02:51:28 +00:00
|
|
|
; RUN: llc -march=mipsel -relocation-model=static -disable-mips-delay-filler \
|
|
|
|
; RUN: -mips-fix-global-base-reg=false < %s | \
|
2014-02-16 13:28:15 +00:00
|
|
|
; RUN: FileCheck %s -check-prefix=STATICGP -check-prefix=CHECK
|
2011-05-31 02:53:58 +00:00
|
|
|
|
|
|
|
@t1 = thread_local global i32 0, align 4
|
|
|
|
|
|
|
|
define i32 @f1() nounwind {
|
|
|
|
entry:
|
|
|
|
%tmp = load i32* @t1, align 4
|
|
|
|
ret i32 %tmp
|
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; PIC-LABEL: f1:
|
2013-07-12 23:33:22 +00:00
|
|
|
; PIC-DAG: addu $[[R0:[a-z0-9]+]], $2, $25
|
|
|
|
; PIC-DAG: lw $25, %call16(__tls_get_addr)($[[R0]])
|
|
|
|
; PIC-DAG: addiu $4, $[[R0]], %tlsgd(t1)
|
|
|
|
; PIC-DAG: jalr $25
|
|
|
|
; PIC-DAG: lw $2, 0($2)
|
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; STATIC-LABEL: f1:
|
2011-05-31 02:53:58 +00:00
|
|
|
; STATIC: lui $[[R0:[0-9]+]], %tprel_hi(t1)
|
|
|
|
; STATIC: addiu $[[R1:[0-9]+]], $[[R0]], %tprel_lo(t1)
|
2013-01-22 21:34:25 +00:00
|
|
|
; STATIC: rdhwr $3, $29
|
2011-05-31 02:53:58 +00:00
|
|
|
; STATIC: addu $[[R2:[0-9]+]], $3, $[[R1]]
|
|
|
|
; STATIC: lw $2, 0($[[R2]])
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@t2 = external thread_local global i32
|
|
|
|
|
|
|
|
define i32 @f2() nounwind {
|
|
|
|
entry:
|
|
|
|
%tmp = load i32* @t2, align 4
|
|
|
|
ret i32 %tmp
|
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; PIC-LABEL: f2:
|
2013-07-12 23:33:22 +00:00
|
|
|
; PIC-DAG: addu $[[R0:[a-z0-9]+]], $2, $25
|
|
|
|
; PIC-DAG: lw $25, %call16(__tls_get_addr)($[[R0]])
|
|
|
|
; PIC-DAG: addiu $4, $[[R0]], %tlsgd(t2)
|
|
|
|
; PIC-DAG: jalr $25
|
|
|
|
; PIC-DAG: lw $2, 0($2)
|
2011-05-31 02:53:58 +00:00
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; STATICGP-LABEL: f2:
|
2012-02-24 22:34:47 +00:00
|
|
|
; STATICGP: lui $[[R0:[0-9]+]], %hi(__gnu_local_gp)
|
|
|
|
; STATICGP: addiu $[[GP:[0-9]+]], $[[R0]], %lo(__gnu_local_gp)
|
|
|
|
; STATICGP: lw ${{[0-9]+}}, %gottprel(t2)($[[GP]])
|
2013-07-12 23:33:22 +00:00
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; STATIC-LABEL: f2:
|
2012-05-12 00:17:17 +00:00
|
|
|
; STATIC: lui $[[R0:[0-9]+]], %hi(__gnu_local_gp)
|
2012-05-12 03:25:16 +00:00
|
|
|
; STATIC: addiu $[[GP:[0-9]+]], $[[R0]], %lo(__gnu_local_gp)
|
2011-05-31 02:53:58 +00:00
|
|
|
; STATIC: rdhwr $3, $29
|
2012-05-12 03:25:16 +00:00
|
|
|
; STATIC: lw $[[R0:[0-9]+]], %gottprel(t2)($[[GP]])
|
2011-05-31 02:53:58 +00:00
|
|
|
; STATIC: addu $[[R1:[0-9]+]], $3, $[[R0]]
|
|
|
|
; STATIC: lw $2, 0($[[R1]])
|
|
|
|
}
|
2011-12-14 18:26:41 +00:00
|
|
|
|
|
|
|
@f3.i = internal thread_local unnamed_addr global i32 1, align 4
|
|
|
|
|
|
|
|
define i32 @f3() nounwind {
|
|
|
|
entry:
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f3:
|
2011-12-14 18:26:41 +00:00
|
|
|
|
2012-05-12 03:25:16 +00:00
|
|
|
; PIC: addiu $4, ${{[a-z0-9]+}}, %tlsldm(f3.i)
|
2011-12-14 18:26:41 +00:00
|
|
|
; PIC: jalr $25
|
|
|
|
; PIC: lui $[[R0:[0-9]+]], %dtprel_hi(f3.i)
|
|
|
|
; PIC: addu $[[R1:[0-9]+]], $[[R0]], $2
|
Remove the restriction on the first operand of the add node in SelectAddr.
This change reduces the number of instructions generated.
For example,
(load (add (sub $n0, $n1), (MipsLo got(s))))
results in the following sequence of instructions:
1. sub $n2, $n0, $n1
2. lw got(s)($n2)
Previously, three instructions were needed.
1. sub $n2, $n0, $n1
2. addiu $n3, $n2, got(s)
3. lw 0($n3)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146888 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-19 19:28:37 +00:00
|
|
|
; PIC: lw ${{[0-9]+}}, %dtprel_lo(f3.i)($[[R1]])
|
2011-12-14 18:26:41 +00:00
|
|
|
|
|
|
|
%0 = load i32* @f3.i, align 4
|
|
|
|
%inc = add nsw i32 %0, 1
|
|
|
|
store i32 %inc, i32* @f3.i, align 4
|
|
|
|
ret i32 %inc
|
|
|
|
}
|
|
|
|
|