From e3b7d0228d64fe90811c28027e914e15a330953f Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 28 Mar 2014 19:19:28 +0000 Subject: [PATCH] Convert another llc -filetype=obj test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205033 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/MC/Mips/elf-tls.ll | 40 ------------ test/MC/Mips/elf-tls.s | 134 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+), 40 deletions(-) delete mode 100644 test/MC/Mips/elf-tls.ll create mode 100644 test/MC/Mips/elf-tls.s diff --git a/test/MC/Mips/elf-tls.ll b/test/MC/Mips/elf-tls.ll deleted file mode 100644 index bcce3d515e7..00000000000 --- a/test/MC/Mips/elf-tls.ll +++ /dev/null @@ -1,40 +0,0 @@ -; RUN: llc -filetype=obj -mtriple mipsel-unknown-linux %s -o - | llvm-readobj -r | FileCheck %s - -; Check that the appropriate relocations were created. - -; CHECK: Relocations [ -; CHECK: Section (2) .rel.text { -; CHECK: R_MIPS_TLS_LDM -; CHECK: R_MIPS_TLS_DTPREL_HI16 -; CHECK: R_MIPS_TLS_DTPREL_LO16 -; CHECK: } -; CHECK: ] - -@t1 = thread_local global i32 0, align 4 - -define i32 @f1() nounwind { -entry: - %tmp = load i32* @t1, align 4 - ret i32 %tmp - -} - - -@t2 = external thread_local global i32 - -define i32 @f2() nounwind { -entry: - %tmp = load i32* @t2, align 4 - ret i32 %tmp - -} - -@f3.i = internal thread_local unnamed_addr global i32 1, align 4 - -define i32 @f3() nounwind { -entry: - %0 = load i32* @f3.i, align 4 - %inc = add nsw i32 %0, 1 - store i32 %inc, i32* @f3.i, align 4 - ret i32 %inc -} diff --git a/test/MC/Mips/elf-tls.s b/test/MC/Mips/elf-tls.s new file mode 100644 index 00000000000..d32a699fb08 --- /dev/null +++ b/test/MC/Mips/elf-tls.s @@ -0,0 +1,134 @@ +// RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux %s -o - | llvm-readobj -r | FileCheck %s + +// Check that the appropriate relocations were created. + +// CHECK: Relocations [ +// CHECK: Section (2) .rel.text { +// CHECK: R_MIPS_TLS_LDM +// CHECK: R_MIPS_TLS_DTPREL_HI16 +// CHECK: R_MIPS_TLS_DTPREL_LO16 +// CHECK: } +// CHECK: ] + + .text + .abicalls + .section .mdebug.abi32,"",@progbits + .file "/home/espindola/llvm/llvm/test/MC/Mips/elf-tls.ll" + .text + .globl f1 + .align 2 + .type f1,@function + .set nomips16 + .ent f1 +f1: # @f1 + .frame $sp,24,$ra + .mask 0x80000000,-4 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + .set noat +# BB#0: # %entry + lui $2, %hi(_gp_disp) + addiu $2, $2, %lo(_gp_disp) + addiu $sp, $sp, -24 + sw $ra, 20($sp) # 4-byte Folded Spill + addu $gp, $2, $25 + lw $25, %call16(__tls_get_addr)($gp) + jalr $25 + addiu $4, $gp, %tlsgd(t1) + lw $2, 0($2) + lw $ra, 20($sp) # 4-byte Folded Reload + jr $ra + addiu $sp, $sp, 24 + .set at + .set macro + .set reorder + .end f1 +$tmp0: + .size f1, ($tmp0)-f1 + + .globl f2 + .align 2 + .type f2,@function + .set nomips16 + .ent f2 +f2: # @f2 + .frame $sp,24,$ra + .mask 0x80000000,-4 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + .set noat +# BB#0: # %entry + lui $2, %hi(_gp_disp) + addiu $2, $2, %lo(_gp_disp) + addiu $sp, $sp, -24 + sw $ra, 20($sp) # 4-byte Folded Spill + addu $gp, $2, $25 + lw $25, %call16(__tls_get_addr)($gp) + jalr $25 + addiu $4, $gp, %tlsgd(t2) + lw $2, 0($2) + lw $ra, 20($sp) # 4-byte Folded Reload + jr $ra + addiu $sp, $sp, 24 + .set at + .set macro + .set reorder + .end f2 +$tmp1: + .size f2, ($tmp1)-f2 + + .globl f3 + .align 2 + .type f3,@function + .set nomips16 + .ent f3 +f3: # @f3 + .frame $sp,24,$ra + .mask 0x80000000,-4 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + .set noat +# BB#0: # %entry + lui $2, %hi(_gp_disp) + addiu $2, $2, %lo(_gp_disp) + addiu $sp, $sp, -24 + sw $ra, 20($sp) # 4-byte Folded Spill + addu $gp, $2, $25 + lw $25, %call16(__tls_get_addr)($gp) + jalr $25 + addiu $4, $gp, %tlsldm(f3.i) + lui $1, %dtprel_hi(f3.i) + addu $1, $1, $2 + lw $2, %dtprel_lo(f3.i)($1) + addiu $2, $2, 1 + sw $2, %dtprel_lo(f3.i)($1) + lw $ra, 20($sp) # 4-byte Folded Reload + jr $ra + addiu $sp, $sp, 24 + .set at + .set macro + .set reorder + .end f3 +$tmp2: + .size f3, ($tmp2)-f3 + + .type t1,@object # @t1 + .section .tbss,"awT",@nobits + .globl t1 + .align 2 +t1: + .4byte 0 # 0x0 + .size t1, 4 + + .type f3.i,@object # @f3.i + .section .tdata,"awT",@progbits + .align 2 +f3.i: + .4byte 1 # 0x1 + .size f3.i, 4 + + + .text