blob: 0cc4d43606568a784b2a1d730cea5b4cf49ab2f3 [file] [log] [blame]
Reid Spencerc0948362007-01-16 18:08:22 +00001; RUN: llvm-as %s -o - | llvm-dis > %t1.ll;
2; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3; RUN: diff %t1.ll %t2.ll
4
5; Demonstrate all of the variable argument handling intrinsic functions plus
6; the va_arg instruction.
7
8implementation
9declare void %llvm.va_start(i8** %ap)
10declare void %llvm.va_copy(i8** %aq, i8** %ap)
11declare void %llvm.va_end(i8** %ap)
12
13define i33 %test(i33 %X, ...) {
14 %ap = alloca i8*
15 call void %llvm.va_start(i8** %ap)
16 %tmp = va_arg i8** %ap, i33
17
18 %aq = alloca i8*
19 call void %llvm.va_copy(i8** %aq, i8** %ap)
20 call void %llvm.va_end(i8** %aq)
21
22 call void %llvm.va_end(i8** %ap)
23 ret i33 %tmp
24}