1*0a6a1f1dSLionel Sambuc // REQUIRES: powerpc-registered-target
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambuc #include <stdarg.h>
5*0a6a1f1dSLionel Sambuc
testva(int n,...)6*0a6a1f1dSLionel Sambuc void testva (int n, ...)
7*0a6a1f1dSLionel Sambuc {
8*0a6a1f1dSLionel Sambuc va_list ap;
9*0a6a1f1dSLionel Sambuc
10*0a6a1f1dSLionel Sambuc _Complex int i = va_arg(ap, _Complex int);
11*0a6a1f1dSLionel Sambuc // CHECK: %[[VAR40:[A-Za-z0-9.]+]] = load i8** %[[VAR100:[A-Za-z0-9.]+]]
12*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR41:[A-Za-z0-9.]+]] = getelementptr i8* %[[VAR40]], i64 16
13*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i8* %[[VAR41]], i8** %[[VAR100]]
14*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR1:[A-Za-z0-9.]+]] = ptrtoint i8* %[[VAR40]] to i64
15*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR3:[A-Za-z0-9.]+]] = add i64 %[[VAR1]], 8
16*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR4:[A-Za-z0-9.]+]] = inttoptr i64 %[[VAR1]] to i32*
17*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR5:[A-Za-z0-9.]+]] = inttoptr i64 %[[VAR3]] to i32*
18*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR6:[A-Za-z0-9.]+]] = load i32* %[[VAR4]]
19*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR7:[A-Za-z0-9.]+]] = load i32* %[[VAR5]]
20*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR8:[A-Za-z0-9.]+]] = getelementptr inbounds { i32, i32 }* %[[VAR0:[A-Za-z0-9.]+]], i32 0, i32 0
21*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR9:[A-Za-z0-9.]+]] = getelementptr inbounds { i32, i32 }* %[[VAR0]], i32 0, i32 1
22*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 %[[VAR6]], i32* %[[VAR8]]
23*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 %[[VAR7]], i32* %[[VAR9]]
24*0a6a1f1dSLionel Sambuc
25*0a6a1f1dSLionel Sambuc _Complex short s = va_arg(ap, _Complex short);
26*0a6a1f1dSLionel Sambuc // CHECK: %[[VAR50:[A-Za-z0-9.]+]] = load i8** %[[VAR100:[A-Za-z0-9.]+]]
27*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR51:[A-Za-z0-9.]+]] = getelementptr i8* %[[VAR50]], i64 16
28*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i8* %[[VAR51]], i8** %[[VAR100]]
29*0a6a1f1dSLionel Sambuc // CHECK: %[[VAR11:[A-Za-z0-9.]+]] = ptrtoint i8* %{{[A-Za-z0-9.]+}} to i64
30*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR13:[A-Za-z0-9.]+]] = add i64 %[[VAR11]], 8
31*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR14:[A-Za-z0-9.]+]] = inttoptr i64 %[[VAR11]] to i16*
32*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR15:[A-Za-z0-9.]+]] = inttoptr i64 %[[VAR13]] to i16*
33*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR16:[A-Za-z0-9.]+]] = load i16* %[[VAR14]]
34*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR17:[A-Za-z0-9.]+]] = load i16* %[[VAR15]]
35*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR18:[A-Za-z0-9.]+]] = getelementptr inbounds { i16, i16 }* %[[VAR10:[A-Za-z0-9.]+]], i32 0, i32 0
36*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR19:[A-Za-z0-9.]+]] = getelementptr inbounds { i16, i16 }* %[[VAR10]], i32 0, i32 1
37*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i16 %[[VAR16]], i16* %[[VAR18]]
38*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i16 %[[VAR17]], i16* %[[VAR19]]
39*0a6a1f1dSLionel Sambuc
40*0a6a1f1dSLionel Sambuc _Complex char c = va_arg(ap, _Complex char);
41*0a6a1f1dSLionel Sambuc // CHECK: %[[VAR60:[A-Za-z0-9.]+]] = load i8** %[[VAR100:[A-Za-z0-9.]+]]
42*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR61:[A-Za-z0-9.]+]] = getelementptr i8* %[[VAR60]], i64 16
43*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i8* %[[VAR61]], i8** %[[VAR100]]
44*0a6a1f1dSLionel Sambuc // CHECK: %[[VAR21:[A-Za-z0-9.]+]] = ptrtoint i8* %{{[A-Za-z0-9.]+}} to i64
45*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR23:[A-Za-z0-9.]+]] = add i64 %[[VAR21]], 8
46*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR24:[A-Za-z0-9.]+]] = inttoptr i64 %[[VAR21]] to i8*
47*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR25:[A-Za-z0-9.]+]] = inttoptr i64 %[[VAR23]] to i8*
48*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR26:[A-Za-z0-9.]+]] = load i8* %[[VAR24]]
49*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR27:[A-Za-z0-9.]+]] = load i8* %[[VAR25]]
50*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR28:[A-Za-z0-9.]+]] = getelementptr inbounds { i8, i8 }* %[[VAR20:[A-Za-z0-9.]+]], i32 0, i32 0
51*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR29:[A-Za-z0-9.]+]] = getelementptr inbounds { i8, i8 }* %[[VAR20]], i32 0, i32 1
52*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i8 %[[VAR26]], i8* %[[VAR28]]
53*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i8 %[[VAR27]], i8* %[[VAR29]]
54*0a6a1f1dSLionel Sambuc
55*0a6a1f1dSLionel Sambuc _Complex float f = va_arg(ap, _Complex float);
56*0a6a1f1dSLionel Sambuc // CHECK: %[[VAR70:[A-Za-z0-9.]+]] = load i8** %[[VAR100:[A-Za-z0-9.]+]]
57*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR71:[A-Za-z0-9.]+]] = getelementptr i8* %[[VAR70]], i64 16
58*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i8* %[[VAR71]], i8** %[[VAR100]]
59*0a6a1f1dSLionel Sambuc // CHECK: %[[VAR31:[A-Za-z0-9.]+]] = ptrtoint i8* %{{[A-Za-z0-9.]+}} to i64
60*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR33:[A-Za-z0-9.]+]] = add i64 %[[VAR31]], 8
61*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR34:[A-Za-z0-9.]+]] = inttoptr i64 %[[VAR31]] to float*
62*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR35:[A-Za-z0-9.]+]] = inttoptr i64 %[[VAR33]] to float*
63*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR36:[A-Za-z0-9.]+]] = load float* %[[VAR34]]
64*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR37:[A-Za-z0-9.]+]] = load float* %[[VAR35]]
65*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR38:[A-Za-z0-9.]+]] = getelementptr inbounds { float, float }* %[[VAR30:[A-Za-z0-9.]+]], i32 0, i32 0
66*0a6a1f1dSLionel Sambuc // CHECK-NEXT: %[[VAR39:[A-Za-z0-9.]+]] = getelementptr inbounds { float, float }* %[[VAR30]], i32 0, i32 1
67*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store float %[[VAR36]], float* %[[VAR38]]
68*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store float %[[VAR37]], float* %[[VAR39]]
69*0a6a1f1dSLionel Sambuc }
70