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