xref: /llvm-project/llvm/test/CodeGen/X86/probe-stack-x32.ll (revision b75c8fc6fbac57e0bde233516fa125f65b36af84)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnux32 -verify-machineinstrs | FileCheck %s
3
4target datalayout = "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128"
5target triple = "x86_64-unknown-linux-gnux32"
6
7; probe-stack + dynamic size alloca
8define void @test1(i32 %size) nounwind #0 {
9; CHECK-LABEL: test1:
10; CHECK:       # %bb.0: # %start
11; CHECK-NEXT:    pushq %rbp
12; CHECK-NEXT:    movl %esp, %ebp
13; CHECK-NEXT:    # kill: def $edi killed $edi def $rdi
14; CHECK-NEXT:    leal 15(%rdi), %eax
15; CHECK-NEXT:    andl $-16, %eax
16; CHECK-NEXT:    callq __rust_probestack
17; CHECK-NEXT:    subl %eax, %esp
18start:
19  %alloca = alloca i8, i32 %size
20  unreachable
21}
22
23; probe-stack + no-stack-arg-probe + dynamic size alloca
24define void @test2(i32 %size) nounwind #1 {
25; CHECK-LABEL: test2:
26; CHECK:       # %bb.0: # %start
27; CHECK-NEXT:    pushq %rbp
28; CHECK-NEXT:    movl %esp, %ebp
29; CHECK-NEXT:    addl $15, %edi
30; CHECK-NEXT:    andl $-16, %edi
31; CHECK-NEXT:    subl %edi, %esp
32start:
33  %alloca = alloca i8, i32 %size
34  unreachable
35}
36
37; probe-stack + fixed size alloca not in entry block
38define void @test3() nounwind #0 {
39; CHECK-LABEL: test3:
40; CHECK:       # %bb.0: # %start
41; CHECK-NEXT:    pushq %rbp
42; CHECK-NEXT:    movl %esp, %ebp
43; CHECK-NEXT:    pushq %rax
44; CHECK-NEXT:    subl $1992, %esp # imm = 0x7C8
45start:
46  br label %block
47
48block:
49  %alloca = alloca i8, i32 2000
50  unreachable
51}
52
53attributes #0 = { "probe-stack"="__rust_probestack" }
54attributes #1 = { "probe-stack"="__rust_probestack" "no-stack-arg-probe" }
55