brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · a5a1d07 Raw
146 lines · plain
1# RUN: llvm-mc -filetype=obj -triple x86_64 --x86-align-branch-boundary=32 --x86-align-branch=call+jmp+indirect+ret+jcc %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s2 3  # These tests are checking the basic cases for each instructions, and a4  # bit of the alignment checking logic itself.  Fused instruction cases are5  # excluded, as are details of argument parsing.6 7  # instruction sizes for reference:8  #  callq is 5 bytes long9  #  int3 is 1 byte10  #  jmp <near-label> is 2 bytes11  #  jmp <far-label> is 5 bytes12  #  ret N is 2 bytes13 14  # Next couple tests are checking the edge cases on the alignment computation15 16  .text17  # CHECK: <test1>:18  # CHECK: 20: callq19  .globl  test120  .p2align  521test1:22  .rept 2923  int324  .endr25  callq bar26 27  # CHECK: <test2>:28  # CHECK: 60: callq29  .globl  test230  .p2align  531test2:32  .rept 3133  int334  .endr35  callq bar36 37  # CHECK: <test3>:38  # CHECK: a0: callq39  .globl  test340  .p2align  541test3:42  .rept 2743  int344  .endr45  callq bar46 47  # next couple check instruction type coverage48 49  # CHECK: <test_jmp>:50  # CHECK: e0: jmp51  .globl  test_jmp52  .p2align  553test_jmp:54  .rept 3155  int356  .endr57  jmp bar58 59  # CHECK: <test_ret>:60  # CHECK: 120: retq61  .globl  test_ret62  .p2align  563test_ret:64  .rept 3165  int366  .endr67  retq $068 69  # check a case with a relaxable instruction70 71  # CHECK: <test_jmp_far>:72  # CHECK: 160: jmp73  .globl  test_jmp_far74  .p2align  575test_jmp_far:76  .rept 3177  int378  .endr79  jmp baz80 81  # CHECK: <test_jcc>:82  # CHECK: 1a0: jne83  .globl  test_jcc84  .p2align  585test_jcc:86  .rept 3187  int388  .endr89  jne bar90 91  # CHECK: <test_indirect>:92  # CHECK: 1e0: jmp93  .globl  test_indirect94  .p2align  595test_indirect:96  .rept 3197  int398  .endr99  jmpq *(%rax)100 101  .p2align 4102  .type   bar,@function103bar:104  retq105 106  # This case looks really tempting to pad, but doing so for the call causes107  # the jmp to be misaligned.108  # CHECK: <test_pad_via_relax_neg1>:109  # CHECK: 200: int3110  # CHECK: 21a: testq111  # CHECK: 21d: jne112  # CHECK: 21f: nop113  # CHECK: 220: callq114  .global test_pad_via_relax_neg1115  .p2align  5116test_pad_via_relax_neg1:117  .rept 26118  int3119  .endr120  testq %rax, %rax121  jnz bar122  callq bar123 124  # Same as previous, but without fusion125  # CHECK: <test_pad_via_relax_neg2>:126  # CHECK: 240: int3127  # CHECK: 25d: jmp128  # CHECK: 25f: nop129  # CHECK: 260: callq130  .global test_pad_via_relax_neg2131  .p2align  5132test_pad_via_relax_neg2:133  .rept 29134  int3135  .endr136  jmp bar2137  callq bar2138 139bar2:140 141  .section "unknown"142  .p2align 4143  .type   baz,@function144baz:145  retq146