blob: 672d96a4288fa03653715c5c2015c23c4d140ab9 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; RUN: llvm-upgrade < %s | llvm-as | 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(sbyte** %ap)
10declare void %llvm.va_copy(sbyte** %aq, sbyte** %ap)
11declare void %llvm.va_end(sbyte** %ap)
12
13int %test(int %X, ...) {
14 %ap = alloca sbyte*
15 call void %llvm.va_start(sbyte** %ap)
16 %tmp = va_arg sbyte** %ap, int
17
18 %aq = alloca sbyte*
19 call void %llvm.va_copy(sbyte** %aq, sbyte** %ap)
20 call void %llvm.va_end(sbyte** %aq)
21
22 call void %llvm.va_end(sbyte** %ap)
23 ret int %tmp
24}