| OLD | NEW |
| 1 # RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \ | 1 # RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \ |
| 2 # RUN: | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck %s | 2 # RUN: | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck -check-pref
ix=CHECK -check-prefix=CHECK-OPT %s |
| 3 # RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu -mc-relax-all %s -o - \ |
| 4 # RUN: | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck -check-pref
ix=CHECK -check-prefix=CHECK-RELAX %s |
| 3 | 5 |
| 4 # Test simple NOP insertion for single instructions. | 6 # Test simple NOP insertion for single instructions. |
| 5 | 7 |
| 6 .text | 8 .text |
| 7 foo: | 9 foo: |
| 8 # Will be bundle-aligning to 16 byte boundaries | 10 # Will be bundle-aligning to 16 byte boundaries |
| 9 .bundle_align_mode 4 | 11 .bundle_align_mode 4 |
| 10 pushq %rbp | 12 pushq %rbp |
| 11 pushq %r14 | 13 pushq %r14 |
| 12 pushq %rbx | 14 pushq %rbx |
| 13 | 15 |
| 14 movl %edi, %ebx | 16 movl %edi, %ebx |
| 15 callq bar | 17 callq bar |
| 16 movl %eax, %r14d | 18 movl %eax, %r14d |
| 17 | 19 |
| 18 imull $17, %ebx, %ebp | 20 imull $17, %ebx, %ebp |
| 19 # This imull is 3 bytes long and should have started at 0xe, so two bytes | 21 # This imull is 3 bytes long and should have started at 0xe, so two bytes |
| 20 # of nop padding are inserted instead and it starts at 0x10 | 22 # of nop padding are inserted instead and it starts at 0x10 |
| 21 # CHECK: nop | 23 # CHECK: nop |
| 22 # CHECK-NEXT: 10: imull | 24 # CHECK-NEXT: 10: imull |
| 23 | 25 |
| 24 movl %ebx, %edi | 26 movl %ebx, %edi |
| 25 callq bar | 27 callq bar |
| 26 cmpl %r14d, %ebp | 28 cmpl %r14d, %ebp |
| 29 # CHECK-RELAX: nopl |
| 27 jle .L_ELSE | 30 jle .L_ELSE |
| 28 # Due to the padding that's inserted before the addl, the jump target | 31 # Due to the padding that's inserted before the addl, the jump target |
| 29 # becomes farther by one byte. | 32 # becomes farther by one byte. |
| 30 # CHECK: jle 5 | 33 # CHECK-OPT: jle 5 |
| 34 # CHECK-RELAX: jle 7 |
| 31 | 35 |
| 32 addl %ebp, %eax | 36 addl %ebp, %eax |
| 33 # CHECK: nop | 37 # CHECK-OPT: nop |
| 34 # CHECK-NEXT: 20: addl | 38 # CHECK-OPT-NEXT:20: addl |
| 39 # CHECK-RELAX: 26: addl |
| 35 | 40 |
| 36 jmp .L_RET | 41 jmp .L_RET |
| 37 .L_ELSE: | 42 .L_ELSE: |
| 38 imull %ebx, %eax | 43 imull %ebx, %eax |
| 39 .L_RET: | 44 .L_RET: |
| 40 ret | 45 ret |
| 41 | 46 |
| 42 # Just sanity checking that data fills don't drive bundling crazy | 47 # Just sanity checking that data fills don't drive bundling crazy |
| 43 .data | 48 .data |
| 44 .byte 40 | 49 .byte 40 |
| 45 .byte 98 | 50 .byte 98 |
| 46 | 51 |
| 47 | 52 |
| OLD | NEW |