1 ; RUN: llvm-as < %s | llvm-dis > %t1.ll
2 ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3 ; RUN: diff %t1.ll %t2.ll
5 ; Demonstrate all of the variable argument handling intrinsic functions plus
6 ; the va_arg instruction.
8 declare void @llvm.va_start(ptr)
10 declare void @llvm.va_copy(ptr, ptr)
12 declare void @llvm.va_end(ptr)
14 define i32 @test(i32 %X, ...) {
15 ; Allocate two va_list items. On this target, va_list is of type sbyte*
16 %ap = alloca ptr ; <ptr> [#uses=4]
17 %aq = alloca ptr ; <ptr> [#uses=2]
19 ; Initialize variable argument processing
20 call void @llvm.va_start( ptr %ap )
22 ; Read a single integer argument
23 %tmp = va_arg ptr %ap, i32 ; <i32> [#uses=1]
25 ; Demonstrate usage of llvm.va_copy and llvm_va_end
26 %apv = load ptr, ptr %ap ; <ptr> [#uses=1]
27 call void @llvm.va_copy( ptr %aq, ptr %apv )
28 call void @llvm.va_end( ptr %aq )
30 ; Stop processing of arguments.
31 call void @llvm.va_end( ptr %ap )