1 ; RUN: llc -mtriple=arm64_32-apple-ios %s -o - | FileCheck %s
3 define void @test_va_copy(ptr %dst, ptr %src) {
4 ; CHECK-LABEL: test_va_copy:
5 ; CHECK: ldr [[PTR:w[0-9]+]], [x1]
6 ; CHECK: str [[PTR]], [x0]
8 call void @llvm.va_copy(ptr %dst, ptr %src)
12 define void @test_va_start(i32, ...) {
13 ; CHECK-LABEL: test_va_start
14 ; CHECK: add x[[LIST:[0-9]+]], sp, #16
15 ; CHECK: str w[[LIST]],
16 %slot = alloca ptr, align 4
17 call void @llvm.va_start(ptr %slot)
21 define void @test_va_start_odd([8 x i64], i32, ...) {
22 ; CHECK-LABEL: test_va_start_odd:
23 ; CHECK: add x[[LIST:[0-9]+]], sp, #20
24 ; CHECK: str w[[LIST]],
25 %slot = alloca ptr, align 4
26 call void @llvm.va_start(ptr %slot)
30 define ptr @test_va_arg(ptr %list) {
31 ; CHECK-LABEL: test_va_arg:
32 ; CHECK: ldr w[[LOC:[0-9]+]], [x0]
33 ; CHECK: add [[NEXTLOC:w[0-9]+]], w[[LOC]], #4
34 ; CHECK: str [[NEXTLOC]], [x0]
35 ; CHECK: ldr w0, [x[[LOC]]]
36 %res = va_arg ptr %list, ptr
40 define ptr @really_test_va_arg(ptr %list, i1 %tst) {
41 ; CHECK-LABEL: really_test_va_arg:
42 ; CHECK: ldr w[[LOC:[0-9]+]], [x0]
43 ; CHECK: add [[NEXTLOC:w[0-9]+]], w[[LOC]], #4
44 ; CHECK: str [[NEXTLOC]], [x0]
45 ; CHECK: ldr w[[VAARG:[0-9]+]], [x[[LOC]]]
46 ; CHECK: csel x0, x[[VAARG]], xzr
47 %tmp = va_arg ptr %list, ptr
48 %res = select i1 %tst, ptr %tmp, ptr null
52 declare void @llvm.va_start(ptr)
54 declare void @llvm.va_copy(ptr, ptr)