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