Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / i386-tls-opt.s
blob9cb63f6292dcd62ea814c4810e01512fef2a66ff
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=i686 %s -o %t.o
3 // RUN: ld.lld %t.o -o %t1
4 // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s
5 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefix=DISASM %s
7 // NORELOC: Relocations [
8 // NORELOC-NEXT: ]
10 // DISASM: Disassembly of section .text:
11 // DISASM-EMPTY:
12 // DISASM-NEXT: <_start>:
13 // LD -> LE:
14 // DISASM-NEXT: movl %gs:0, %eax
15 // DISASM-NEXT: nop
16 // DISASM-NEXT: leal (%esi,%eiz), %esi
17 // DISASM-NEXT: leal -8(%eax), %edx
18 // DISASM-NEXT: movl %gs:0, %eax
19 // DISASM-NEXT: nop
20 // DISASM-NEXT: leal (%esi,%eiz), %esi
21 // DISASM-NEXT: leal -4(%eax), %edx
22 // DISASM-NEXT: movl %gs:0, %eax
23 // DISASM-NEXT: leal (%esi), %esi
24 // DISASM-NEXT: movl -4(%eax), %edx
25 // IE -> LE:
26 // 4294967288 == 0xFFFFFFF8
27 // 4294967292 == 0xFFFFFFFC
28 // DISASM-NEXT: movl %gs:0, %eax
29 // DISASM-NEXT: movl $4294967288, %eax
30 // DISASM-NEXT: movl %gs:0, %eax
31 // DISASM-NEXT: movl $4294967292, %eax
32 // DISASM-NEXT: movl %gs:0, %eax
33 // DISASM-NEXT: leal -8(%eax), %eax
34 // DISASM-NEXT: movl %gs:0, %eax
35 // DISASM-NEXT: leal -4(%eax), %eax
36 .type tls0,@object
37 .section .tbss,"awT",@nobits
38 .globl tls0
39 .align 4
40 tls0:
41 .long 0
42 .size tls0, 4
44 .type tls1,@object
45 .globl tls1
46 .align 4
47 tls1:
48 .long 0
49 .size tls1, 4
51 .section .text
52 .globl ___tls_get_addr
53 .type ___tls_get_addr,@function
54 ___tls_get_addr:
56 .section .text
57 .globl _start
58 _start:
59 //LD -> LE:
60 leal tls0@tlsldm(%ebx),%eax
61 call ___tls_get_addr@plt
62 leal tls0@dtpoff(%eax),%edx
63 leal tls1@tlsldm(%ebx),%eax
64 call ___tls_get_addr@plt
65 leal tls1@dtpoff(%eax),%edx
66 // -fno-plt LD -> LE
67 leal tls1@tlsldm(%edx),%eax
68 call *___tls_get_addr@GOT(%edx)
69 movl tls1@dtpoff(%eax), %edx
70 //IE -> LE:
71 movl %gs:0,%eax
72 movl tls0@gotntpoff(%ebx),%eax
73 movl %gs:0,%eax
74 movl tls1@gotntpoff(%ebx),%eax
75 movl %gs:0,%eax
76 addl tls0@gotntpoff(%ebx),%eax
77 movl %gs:0,%eax
78 addl tls1@gotntpoff(%ebx),%eax