File: align-branch-mixed.s

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
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