xref: /llvm-project/llvm/test/CodeGen/AArch64/win-alloca.ll (revision a6065f0fa55aaf694b5f85ecad7badec5cc02425)
1; RUN: llc -mtriple aarch64-windows -verify-machineinstrs -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-OPT
2; RUN: llc -mtriple aarch64-windows -verify-machineinstrs -filetype asm -o - %s -O0 | FileCheck %s
3; RUN: llc -mtriple arm64ec-windows-msvc -verify-machineinstrs -filetype asm -o - %s | FileCheck -check-prefix=CHECK-ARM64EC %s
4
5define void @func(i64 %a) {
6entry:
7  %0 = alloca i8, i64 %a, align 16
8  call void @func2(ptr nonnull %0)
9  ret void
10}
11
12declare void @func2(ptr)
13
14; The -O0 version here ends up much less elegant, so just check the
15; details of the optimized form, but check that -O0 at least emits the
16; call to __chkstk.
17
18; CHECK: add [[REG1:x[0-9]+]], x0, #15
19; CHECK-OPT: lsr x15, [[REG1]], #4
20; CHECK: bl __chkstk
21; CHECK-OPT: sub [[REG3:x[0-9]+]], sp, x15, lsl #4
22; CHECK-OPT: mov sp, [[REG3]]
23; CHECK: bl func2
24; CHECK-ARM64EC: bl "#__chkstk_arm64ec"
25