[llvm-exegesis] Improve Register Setup.
[llvm-core.git] / test / Instrumentation / AddressSanitizer / X86 / asm_rsp_mem_op.s
blobe40ecde0daaf8fd1b4862df709ac9ed4491b94a8
1 # The test verifies that memory references through %rsp are correctly
2 # adjusted after instrumentation.
4 # RUN: llvm-mc %s -triple=x86_64-unknown-linux-gnu -asm-instrumentation=address -asan-instrument-assembly | FileCheck %s
6 # CHECK-LABEL: rsp_access
7 # CHECK: leaq -128(%rsp), %rsp
8 # CHECK: pushq %rax
9 # CHECK: pushq %rdi
10 # CHECK: pushfq
11 # CHECK: leaq 160(%rsp), %rdi
12 # CHECK: callq __asan_report_load8@PLT
13 # CHECK: popfq
14 # CHECK: popq %rdi
15 # CHECK: popq %rax
16 # CHECK: leaq 128(%rsp), %rsp
17 # CHECK: movq 8(%rsp), %rax
18 # CHECK: retq
20 .text
21 .globl rsp_access
22 .type rsp_access,@function
23 rsp_access:
24 movq 8(%rsp), %rax
25 retq
27 # CHECK-LABEL: rsp_32bit_access
28 # CHECK: leaq -128(%rsp), %rsp
29 # CHECK: pushq %rax
30 # CHECK: pushq %rdi
31 # CHECK: pushfq
32 # CHECK: leaq 2147483647(%rsp), %rdi
33 # CHECK: leaq 145(%rdi), %rdi
34 # CHECK: callq __asan_report_load8@PLT
35 # CHECK: popfq
36 # CHECK: popq %rdi
37 # CHECK: popq %rax
38 # CHECK: leaq 128(%rsp), %rsp
39 # CHECK: movq 2147483640(%rsp), %rax
40 # CHECK: retq
41 .globl rsp_32bit_access
42 .type rsp_32bit_access,@function
43 rsp_32bit_access:
44 movq 2147483640(%rsp), %rax
45 retq