[llvm-readobj] - Simplify stack-sizes.test test case.
[llvm-complete.git] / test / MC / X86 / AlignedBundling / labeloffset.s
blob5b2efe079650cca70591e0bbe500309c29afcee3
1 # RUN: llvm-mc -triple=i686-linux -filetype=obj %s -o - | \
2 # RUN: llvm-objdump -disassemble -no-show-raw-insn -r - | FileCheck %s
3 # RUN: llvm-mc -triple=i686-nacl -filetype=obj %s -o - | \
4 # RUN: llvm-objdump -disassemble -no-show-raw-insn -r - | FileCheck %s
5 # RUN: llvm-mc -triple=i686-nacl -filetype=obj -mc-relax-all %s -o - | \
6 # RUN: llvm-objdump -disassemble -no-show-raw-insn -r - | FileCheck %s
8 .bundle_align_mode 5
9 .text
10 .globl main
11 .align 32, 0x90
12 .type main,@function
13 main: # @main
14 # CHECK-LABEL: main:
15 # Call + pop sequence for determining the PIC base.
16 .bundle_lock align_to_end
17 calll .L0$pb
18 .bundle_unlock
19 .L0$pb:
20 popl %eax
21 # CHECK: 20: popl
22 # 26 bytes of instructions between the pop and the use of the pic base symbol.
23 movl $3, 2(%ebx, %ebx)
24 movl $3, 2(%ebx, %ebx)
25 movl $3, 2(%ebx, %ebx)
26 hlt
27 hlt
28 # CHECK: nop
29 .Ltmp0:
30 addl (.Ltmp0-.L0$pb), %eax
31 # The addl has bundle padding to push it from 0x3b to 0x40.
32 # The difference between the labels should be 0x20 (0x40-0x20) not 0x1b
33 # (0x3b-0x20)
34 # CHECK: 40: addl 32, %eax
35 popl %ecx
36 jmp *%ecx
39 # Also make sure it works with a non-relaxable instruction (cmp vs add)
40 # and for 2 adjacent labels that both point to the correct instruction
41 .section .text.bar, "ax"
42 .globl bar
43 .align 32, 0x90
44 .type bar,@function
45 bar:
46 # CHECK-LABEL: bar:
47 .bundle_lock align_to_end
48 calll .L1$pb
49 .bundle_unlock
50 .L1$pb:
51 popl %eax
52 # CHECK: 20: popl
53 # 26 bytes of instructions between the pop and the use of the pic base symbol.
54 movl $3, 2(%ebx, %ebx)
55 movl $3, 2(%ebx, %ebx)
56 movl $3, 2(%ebx, %ebx)
57 hlt
58 hlt
59 # CHECK: nop
60 .Ltmp1:
61 .Ltmp2:
62 cmpl %eax, .Ltmp1
63 # CHECK: 40: cmpl %eax, 64
64 cmpl %eax, (.Ltmp2-.L1$pb)
65 # CHECK: 46: cmpl %eax, 32
66 popl %ecx
67 jmp *%ecx
70 # Switch sections in the middle of a function
71 .section .text.foo, "ax"
72 .globl foo
73 .align 32, 0x90
74 .type foo,@function
75 # CHECK-LABEL: foo:
76 foo:
77 inc %eax
78 tmp3:
79 .rodata
80 .type obj,@object
81 .comm obj,4,4
82 .section .text.foo
83 inc %eax
84 # CHECK: tmp3:
85 # CHECK-NEXT: 1: incl