xref: /llvm-project/llvm/test/MC/X86/pad-for-align-debug.s (revision 75cdab6dc2453a508157a9c383b93373a93078d6)
1# RUN: llvm-mc -mcpu=skylake -filetype=obj -triple x86_64-apple-macos -x86-pad-for-align=true %S/Inputs/pad-align-with-debug.s | llvm-objdump --no-print-imm-hex -d - | FileCheck --check-prefix=CHECK --check-prefix=DEBUG %s
2# RUN: llvm-mc -mcpu=skylake -filetype=obj -triple x86_64-apple-macos -x86-pad-for-align=true %S/Inputs/pad-align-without-debug.s | llvm-objdump --no-print-imm-hex -d - | FileCheck --check-prefix=CHECK --check-prefix=NODEBUG %s
3# RUN: llvm-mc -mcpu=skylake -filetype=obj -triple x86_64-apple-macos %S/Inputs/pad-align-without-debug.s | llvm-objdump --no-print-imm-hex -d - | FileCheck --check-prefix=DEFAULT %s
4# RUN: llvm-mc -mcpu=skylake -filetype=obj -triple x86_64-apple-macos %S/Inputs/pad-align-with-debug.s | llvm-objdump --no-print-imm-hex -d - | FileCheck --check-prefix=DEFAULT %s
5
6; Test case to show that -x86-pad-for-align causes binary differences in the
7; presence of debug locations. Inputs/pad-align-with-debug.s and
8; Inputs/pad-align-without-debug.s are equivalent, modulo a single .loc, which
9; cause the difference in the binary below. This should be fixed, before
10; x86-pad-for-align=true becomes the default.
11
12; Also see PR48742.
13
14
15; CHECK-LABEL: 0000000000000000 <foo>:
16; CHECK:            0: 48 89 f8                         movq    %rdi, %rax
17; CHECK-NEXT:       3: 0f 1f 44 00 00                   nopl    (%rax,%rax)
18; CHECK-NEXT:       8: 0f b6 10                         movzbl  (%rax), %edx
19; CHECK-NEXT:       b: 80 fa 0a                         cmpb    $10, %dl
20; CHECK-NEXT:       e: 74 30                            je  0x40 <foo+0x40>
21; CHECK-NEXT:      10: 80 fa 64                         cmpb    $100, %dl
22; CHECK-NEXT:      13: 74 31                            je  0x46 <foo+0x46>
23; CHECK-NEXT:      15: 80 fa c8                         cmpb    $-56, %dl
24; CHECK-NEXT:      18: 74 2c                            je  0x46 <foo+0x46>
25; CHECK-NEXT:      1a: 80 fa 2c                         cmpb    $44, %dl
26; CHECK-NEXT:      1d: 75 27                            jne 0x46 <foo+0x46>
27; CHECK-NEXT:      1f: 90                               nop
28; CHECK-NEXT:      20: 48 89 c2                         movq    %rax, %rdx
29; CHECK-NEXT:      23: 48 ff c0                         incq    %rax
30; CHECK-NEXT:      26: 80 38 1e                         cmpb    $30, (%rax)
31
32; DEBUG-NEXT:      29: 75 f5                            jne 0x20 <foo+0x20>
33; DEBUG-NEXT:      2b: 48 8d 42 02                      leaq    2(%rdx), %rax
34; DEBUG-NEXT:      2f: 0f b6 10                         movzbl  (%rax), %edx
35; DEBUG-NEXT:      32: 80 fa 5a                         cmpb    $90, %dl
36; DEBUG-NEXT:      35: 0f 85 d5 ff ff ff                jne 0x10 <foo+0x10>
37; DEBUG-NEXT:      3b: 0f 1f 44 00 00                   nopl    (%rax,%rax)
38
39; NODEBUG-NEXT:      29: 0f 85 f1 ff ff ff              jne 0x20 <foo+0x20>
40; NODEBUG-NEXT:      2f: 48 8d 42 02                    leaq    2(%rdx), %rax
41; NODEBUG-NEXT:      33: 0f b6 10                       movzbl  (%rax), %edx
42; NODEBUG-NEXT:      36: 80 fa 5a                       cmpb    $90, %dl
43; NODEBUG-NEXT:      39: 0f 85 d1 ff ff ff              jne 0x10 <foo+0x10>
44; NODEBUG-NEXT:      3f: 90                             nop
45
46; CHECK-NEXT:      40: 80 78 04 63                      cmpb    $99, 4(%rax)
47; CHECK-NEXT:      44: 74 0b                            je  0x51 <foo+0x51>
48; CHECK-NEXT:      46: 48 ff c0                         incq    %rax
49; CHECK-NEXT:      49: e9 ba ff ff ff                   jmp 0x8 <foo+0x8>
50; CHECK-NEXT:      4e: 66 90                            nop
51; CHECK-NEXT:      50: c3                               retq
52; CHECK-NEXT:      51: c3                               retq
53
54; DEFAULT:            0: 48 89 f8                         movq    %rdi, %rax
55; DEFAULT-NEXT:       3: 0f 1f 44 00 00                   nopl    (%rax,%rax)
56; DEFAULT-NEXT:       8: 0f b6 10                         movzbl  (%rax), %edx
57; DEFAULT-NEXT:       b: 80 fa 0a                         cmpb    $10, %dl
58; DEFAULT-NEXT:       e: 74 30                            je  0x40 <foo+0x40>
59; DEFAULT-NEXT:      10: 80 fa 64                         cmpb    $100, %dl
60; DEFAULT-NEXT:      13: 74 31                            je  0x46 <foo+0x46>
61; DEFAULT-NEXT:      15: 80 fa c8                         cmpb    $-56, %dl
62; DEFAULT-NEXT:      18: 74 2c                            je  0x46 <foo+0x46>
63; DEFAULT-NEXT:      1a: 80 fa 2c                         cmpb    $44, %dl
64; DEFAULT-NEXT:      1d: 75 27                            jne 0x46 <foo+0x46>
65; DEFAULT-NEXT:      1f: 90                               nop
66; DEFAULT-NEXT:      20: 48 89 c2                         movq    %rax, %rdx
67; DEFAULT-NEXT:      23: 48 ff c0                         incq    %rax
68; DEFAULT-NEXT:      26: 80 38 1e                         cmpb    $30, (%rax)
69; DEFAULT-NEXT:      29: 75 f5                            jne 0x20 <foo+0x20>
70; DEFAULT-NEXT:      2b: 48 8d 42 02                      leaq    2(%rdx), %rax
71; DEFAULT-NEXT:      2f: 0f b6 10                         movzbl  (%rax), %edx
72; DEFAULT-NEXT:      32: 80 fa 5a                         cmpb    $90, %dl
73; DEFAULT-NEXT:      35: 75 d9                            jne 0x10 <foo+0x10>
74; DEFAULT-NEXT:      37: 66 0f 1f 84 00 00 00 00 00       nopw    (%rax,%rax)
75; DEFAULT-NEXT:      40: 80 78 04 63                      cmpb    $99, 4(%rax)
76; DEFAULT-NEXT:      44: 74 0b                            je  0x51 <foo+0x51>
77; DEFAULT-NEXT:      46: 48 ff c0                         incq    %rax
78; DEFAULT-NEXT:      49: eb bd                            jmp 0x8 <foo+0x8>
79; DEFAULT-NEXT:      4b: 0f 1f 44 00 00                   nopl    (%rax,%rax)
80; DEFAULT-NEXT:      50: c3                               retq
81; DEFAULT-NEXT:      51: c3                               retq
82