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