brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 2946434 Raw
77 lines · plain
1# RUN: llvm-mc -mcpu=skylake -filetype=obj -triple x86_64-pc-linux-gnu %s -x86-pad-max-prefix-size=5 -x86-pad-for-align=1 | llvm-objdump --no-print-imm-hex -d - | FileCheck %s2 3# This test file highlights the interactions between prefix padding and4# relaxation padding.5 6  .file "test.c"7  .text8  .section  .text9  # We can both relax and prefix for padding purposes, but the moment, we10  # can't prefix without first having relaxed.11  # CHECK: .text12  # CHECK:  0: eb 1f                         jmp13  # CHECK:  2: eb 1d                         jmp14  # CHECK:  4: eb 1b                         jmp15  # CHECK:  6: eb 19                         jmp16  # CHECK:  8: eb 17                         jmp17  # CHECK:  a: 2e 2e 2e 2e 2e e9 0d 00 00 00 jmp18  # CHECK: 14: 2e 2e 2e 2e 2e e9 03 00 00 00 jmp19  # CHECK: 1e: 66 90                         nop20  # CHECK: 20: cc                            int321  .p2align 422  jmp foo23  jmp foo24  jmp foo25  jmp foo26  jmp foo27  jmp foo28  jmp foo29  .p2align 530  int331foo:32  ret33 34  # Canonical toy loop to show benefit - we can align the loop header with35  # fewer nops by relaxing the branch, even though we don't need to36  # CHECK: <loop_preheader>:37  # CHECK: 45: 48 85 c0                       testq %rax, %rax38  # CHECK: 48: 2e 2e 2e 2e 0f 8e 1e 00 00 00  jle 0x70 <loop_exit>39  # CHECK: 52: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00    	nopw	%cs:(%rax,%rax)40  # CHECK: <loop_header>:41  # CHECK: 60: 48 83 e8 01                    subq $1, %rax42  # CHECK: 64: 48 85 c0                       testq %rax, %rax43  # CHECK: 67: 7e 07                          jle 0x70 <loop_exit>44  # CHECK: 69: 2e 2e e9 f0 ff ff ff           jmp45  # CHECK: <loop_exit>:46  # CHECK: 70: c3                             retq47  .p2align 548  .skip 549loop_preheader:50  testq %rax, %rax51  jle loop_exit52  .p2align 553loop_header:54  subq $1, %rax55  testq %rax, %rax56  jle loop_exit57  jmp loop_header58  .p2align 459loop_exit:60  ret61 62  # Correctness cornercase - can't prefix pad jmp without having relaxed it63  # first as doing so would make the relative offset too large64  # CHECK: fd: cc                             int365  # CHECK: fe: eb 80                          jmp 0x80 <loop_exit+0x10>66  # CHECK: 100: cc                           	int367.p2align 568.L1:69.rept 12670  int371.endr72  jmp .L173.rept 3074  int375.endr76.p2align 577