]> git.proxmox.com Git - rustc.git/blame - src/test/assembly/stack-probes.rs
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / assembly / stack-probes.rs
CommitLineData
6a06907d
XL
1// min-llvm-version: 11.0.1
2// revisions: x86_64 i686
3// assembly-output: emit-asm
4//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
5//[i686] compile-flags: --target i686-unknown-linux-gnu
6// compile-flags: -C llvm-args=--x86-asm-syntax=intel
7
8#![feature(no_core, lang_items)]
9#![crate_type = "lib"]
10#![no_core]
11
12#[lang = "sized"]
13trait Sized {}
14#[lang = "copy"]
15trait Copy {}
16
17impl Copy for u8 {}
18
19// Check that inline-asm stack probes are generated correctly.
20// To avoid making this test fragile to slight asm changes,
21// we only check that the stack pointer is decremented by a page at a time,
22// instead of matching the whole probe sequence.
23
24// CHECK-LABEL: small_stack_probe:
25#[no_mangle]
26pub fn small_stack_probe(x: u8, f: fn([u8; 8192])) {
27 // CHECK-NOT: __rust_probestack
28 // x86_64: sub rsp, 4096
29 // i686: sub esp, 4096
30 let a = [x; 8192];
31 f(a);
32}
33
34// CHECK-LABEL: big_stack_probe:
35#[no_mangle]
36pub fn big_stack_probe(x: u8, f: fn([u8; 65536])) {
37 // CHECK-NOT: __rust_probestack
38 // x86_64: sub rsp, 4096
39 // i686: sub esp, 4096
40 let a = [x; 65536];
41 f(a);
42}