1 ; RUN: llc -mtriple=arm64_32-apple-ios %s -o - | FileCheck %s
3 define void @test_va_copy(i8* %dst, i8* %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(i8* %dst, i8* %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 i8*, align 4
17 %list = bitcast i8** %slot to i8*
18 call void @llvm.va_start(i8* %list)
22 define void @test_va_start_odd([8 x i64], i32, ...) {
23 ; CHECK-LABEL: test_va_start_odd:
24 ; CHECK: add x[[LIST:[0-9]+]], sp, #20
25 ; CHECK: str w[[LIST]],
26 %slot = alloca i8*, align 4
27 %list = bitcast i8** %slot to i8*
28 call void @llvm.va_start(i8* %list)
32 define i8* @test_va_arg(i8** %list) {
33 ; CHECK-LABEL: test_va_arg:
34 ; CHECK: ldr w[[LOC:[0-9]+]], [x0]
35 ; CHECK: add [[NEXTLOC:w[0-9]+]], w[[LOC]], #4
36 ; CHECK: str [[NEXTLOC]], [x0]
37 ; CHECK: ldr w0, [x[[LOC]]]
38 %res = va_arg i8** %list, i8*
42 define i8* @really_test_va_arg(i8** %list, i1 %tst) {
43 ; CHECK-LABEL: really_test_va_arg:
44 ; CHECK: ldr w[[LOC:[0-9]+]], [x0]
45 ; CHECK: add [[NEXTLOC:w[0-9]+]], w[[LOC]], #4
46 ; CHECK: str [[NEXTLOC]], [x0]
47 ; CHECK: ldr w[[VAARG:[0-9]+]], [x[[LOC]]]
48 ; CHECK: csel x0, x[[VAARG]], xzr
49 %tmp = va_arg i8** %list, i8*
50 %res = select i1 %tst, i8* %tmp, i8* null
54 declare void @llvm.va_start(i8*)
56 declare void @llvm.va_copy(i8*, i8*)