[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / bolt / test / X86 / shrinkwrapping-and-rsp.s
blob2e5918e857e62d46b6f48b175289f3400cb6361e
1 # This checks that shrink wrapping does attempt at accessing stack elements
2 # using RSP when the function is aligning RSP and changing offsets.
4 # REQUIRES: system-linux
6 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
7 # RUN: %s -o %t.o
8 # RUN: link_fdata %s %t.o %t.fdata
9 # RUN: llvm-strip --strip-unneeded %t.o
10 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
11 # RUN: llvm-bolt %t.exe -o %t.out --data %t.fdata \
12 # RUN: --frame-opt=all --simplify-conditional-tail-calls=false \
13 # RUN: --eliminate-unreachable=false | FileCheck %s
15 # Here we have a function that aligns the stack at prologue. Stack pointer
16 # analysis can't try to infer offset positions after AND because that depends
17 # on the runtime value of the stack pointer of callee (whether it is misaligned
18 # or not).
19 .globl _start
20 .type _start, %function
21 _start:
22 .cfi_startproc
23 # FDATA: 0 [unknown] 0 1 _start 0 0 1
24 push %rbp
25 mov %rsp, %rbp
26 push %rbx
27 push %r14
28 and $0xffffffffffffffe0,%rsp
29 subq $0x20, %rsp
30 b: je hot_path
31 # FDATA: 1 _start #b# 1 _start #hot_path# 0 1
32 cold_path:
33 mov %r14, %rdi
34 mov %rbx, %rdi
35 # Block push-pop mode by using an instruction that requires the
36 # stack to be aligned to 128B. This will force the pass
37 # to try to index stack elements by using RSP +offset directly, but
38 # we do not know how to access individual elements of the stack thanks
39 # to the alignment.
40 movdqa %xmm8, (%rsp)
41 addq $0x20, %rsp
42 pop %r14
43 pop %rbx
44 pop %rbp
45 ret
46 hot_path:
47 addq $0x20, %rsp
48 pop %r14
49 pop %rbx
50 pop %rbp
51 ret
52 .cfi_endproc
53 .size _start, .-_start
55 # CHECK: BOLT-INFO: Shrink wrapping moved 0 spills inserting load/stores and 0 spills inserting push/pops