xref: /llvm-project/llvm/test/CodeGen/AArch64/win64cc-x18.ll (revision cde9f9df79805a0850310870d6dcc64004292727)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2
3;; Testing that x18 is not clobbered when passing pointers with the nest
4;; attribute on windows
5
6; RUN: llc < %s -mtriple=aarch64-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,CHECK-NO-X18
7; RUN: llc < %s -mtriple=aarch64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-X18
8
9define dso_local i64 @other(ptr nest %p) #0 {
10; CHECK-LABEL: other:
11; CHECK-X18: ldr x0, [x18]
12; CHECK-NO-X18: ldr x0, [x0]
13  %r = load i64, ptr %p
14; CHECK: ret
15  ret i64 %r
16}
17
18define dso_local void @func() #0 {
19; CHECK-LABEL: func:
20
21
22entry:
23  %p = alloca i64
24; CHECK: mov w8, #1
25; CHECK: stp x30, x8, [sp, #-16]
26; CHECK-X18: add x18, sp, #8
27  store i64 1, ptr %p
28; CHECK-NO-X18: add x0, sp, #8
29; CHECK: bl other
30  call void @other(ptr nest %p)
31; CHECK: ldr x30, [sp], #16
32; CHECK: ret
33  ret void
34}
35
36attributes #0 = { nounwind }
37