blob: 69ab1e8dcc4d532f92ffd01c4ce81dd8b39e6fde [file] [log] [blame]
Strahinja Petrovic7ba5bf52016-06-24 13:11:15 +00001// RUN: %clang_cc1 -triple mips-linux-gnu -S -emit-llvm %s -o - | FileCheck %s -check-prefix=MIPS
2// RUN: %clang_cc1 -triple mips64-linux-gnu -S -emit-llvm %s -o - | FileCheck %s -check-prefix=MIPS64
3// RUN: %clang_cc1 -triple armebv7-linux-gnueabihf -S -emit-llvm %s -o - | FileCheck %s -check-prefix=ARM
Strahinja Petrovic515a1eb2016-06-24 12:12:41 +00004
5#include <stdarg.h>
Strahinja Petrovic7ba5bf52016-06-24 13:11:15 +00006
7extern void abort() __attribute__((noreturn));
Strahinja Petrovic515a1eb2016-06-24 12:12:41 +00008
9struct tiny {
10 char c;
11};
12
13union data {
14 char c;
15};
16
17void fstr(int n, ...) {
18 struct tiny x;
19 va_list ap;
20 va_start (ap,n);
21 x = va_arg (ap, struct tiny);
22 if (x.c != 10)
23 abort();
24 va_end (ap);
25// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
26// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
27// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
28}
29
30void funi(int n, ...) {
31 union data x;
32 va_list ap;
33 va_start (ap,n);
34 x = va_arg (ap, union data);
35 if (x.c != 10)
36 abort();
37 va_end (ap);
38// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
39// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
40// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
41}
42
43void foo() {
44 struct tiny x[3];
45 union data y;
46 x[0].c = 10;
47 fstr(1, x[0]);
48 funi(1, y);
49}