File: align-branch-mixed.s

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (51 lines) | stat: -rw-r--r-- 1,477 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# RUN: llvm-mc -filetype=obj -triple x86_64 --x86-align-branch-boundary=32 --x86-align-branch=jcc+jmp+indirect+call+ret %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s

  # Exercise cases where mixed kinds of branch are asked to be aligned.

  .text
  .globl  labeled_mixed_test1
labeled_mixed_test1:
  .p2align  5
  .rept 30
  int3
  .endr
  # This call should have started at 0x1e and ends at 0x23, so two bytes of
  # padding are inserted before it.
  # CHECK:    20:          callq
  call  bar
  .rept 28
  int3
  .endr
  # If the previous call was not aligned, this jmp should have started at 0x3f
  # and need two bytes of padding. After the two bytes of padding are inserted
  # for the call, this jmp starts at 0xa1 and does not need padding.
  # CHECK:    41:          jmp
  jmp  *%rax

  .globl  labeled_mixed_test2
labeled_mixed_test2:
  .p2align  5
  .rept 30
  int3
  .endr
  # This jne should have started at 0x7e, so two bytes of padding are inserted
  # before it.
  # CHECK:    80:          jne
  jne bar
  .rept 28
  int3
  .endr
  # If the previous jne was not aligned, this jmp should have started at 0x3c.
  # After the two bytes of padding are inserted for the jne, this jmp should
  # have started at 0x9e, so two bytes of padding are inserted and it starts at
  # 0xa0.
  # CHECK:    a0:          jmp
  jmp bar

  .globl  labeled_mixed_test3
labeled_mixed_test3:
  .p2align 5
  .type   bar,@function
bar:
  # CHECK:    c0:          retq
  retq