xref: /llvm-project/llvm/test/CodeGen/X86/same-align-bytes-with-llasm-llobj.ll (revision e6bf48d11047e970cb24554a01b65b566d6b5d22)
1; RUN: llc %s -o - -filetype=obj --mcpu=znver2 | llvm-objdump -dr  - | FileCheck %s
2; RUN: llc %s -o - -filetype=asm --mcpu=znver2 | llvm-mc - -o - --mcpu=znver2 -filetype=obj -triple x86_64-unknown-linux-gnu | llvm-objdump -dr  - | FileCheck %s
3; RUN: llc %s -o - -filetype=asm --mcpu=znver2 | FileCheck %s --check-prefix=ASM
4
5;; Check that we produce a push, then an align-to-16-bytes p2align.
6;
7; ASM:        # %bb.0:
8; ASM-NEXT:   pushq   %rax
9; ASM-NEXT:   .cfi_def_cfa_offset 16
10; ASM-NEXT:   .p2align 4{{$}}
11
12;; When we assemble the file, either using the built-in asssembler or going
13;; via a textual assembly file, we should get the same padding between the
14;; initial push and the next block for alignment. It's a single 15 byte
15;; nop.
16
17; CHECK:        0:   50
18; CHECK-NEXT:   66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:(%rax,%rax)
19
20;; Note that we specify a CPU to ensure the same nop patterns are selected
21;; between llvm-mc and llc, just in case defaults changed, which one isn't
22;; important.
23
24target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
25target triple = "x86_64-unknown-linux-gnu"
26
27; Function Attrs: noreturn nounwind uwtable
28define dso_local void @b() local_unnamed_addr {
29entry:
30  br label %for.cond
31
32for.cond:
33  tail call void (...) @a()
34  br label %for.cond
35}
36
37declare void @a(...) local_unnamed_addr
38
39!llvm.module.flags = !{!0, !1, !2, !3}
40!llvm.ident = !{!4}
41
42!0 = !{i32 1, !"wchar_size", i32 4}
43!1 = !{i32 8, !"PIC Level", i32 2}
44!2 = !{i32 7, !"PIE Level", i32 2}
45!3 = !{i32 7, !"uwtable", i32 2}
46!4 = !{!"clang"}
47