File: single-inst-bundling.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (52 lines) | stat: -rw-r--r-- 1,358 bytes parent folder | download | duplicates (17)
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
52
# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu -mcpu=pentiumpro %s -o - \
# RUN:   | llvm-objdump -d --no-show-raw-insn - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-OPT %s
# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu -mcpu=pentiumpro -mc-relax-all %s -o - \
# RUN:   | llvm-objdump -d --no-show-raw-insn - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-RELAX %s

# Test simple NOP insertion for single instructions.

  .text
foo:
  # Will be bundle-aligning to 16 byte boundaries
  .bundle_align_mode 4
  pushq   %rbp
  pushq   %r14
  pushq   %rbx

  movl    %edi, %ebx
  callq   bar
  movl    %eax, %r14d

  imull   $17, %ebx, %ebp
# This imull is 3 bytes long and should have started at 0xe, so two bytes
# of nop padding are inserted instead and it starts at 0x10
# CHECK:          nop
# CHECK-NEXT:     10: imull

  movl    %ebx, %edi
  callq   bar
  cmpl    %r14d, %ebp
# CHECK-RELAX:   nopl
  jle     .L_ELSE
# Due to the padding that's inserted before the addl, the jump target
# becomes farther by one byte.
# CHECK-OPT:     jle 0x24
# CHECK-RELAX:   jle 0x2d

  addl    %ebp, %eax
# CHECK-OPT:     nop
# CHECK-OPT-NEXT:20: addl
# CHECK-RELAX:   26: addl

  jmp     .L_RET
.L_ELSE:
  imull   %ebx, %eax
.L_RET:
  ret

# Just verifying that data fills don't drive bundling crazy
  .data
  .byte 40
  .byte 98