[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / struct-union-BE.c
blobd2b6e98c02772a62d6cd9ac78500df48c95aa9ff
1 // 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
5 #include <stdarg.h>
7 extern void abort(void) __attribute__((noreturn));
9 struct tiny {
10 char c;
13 union data {
14 char c;
17 void 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, ptr %argp.cur, i32 3
26 // MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, ptr %argp.cur, i64 7
27 // ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, ptr %argp.cur, i32 3
30 void 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, ptr %argp.cur, i32 3
39 // MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, ptr %argp.cur, i64 7
40 // ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, ptr %argp.cur, i32 3
43 void foo(void) {
44 struct tiny x[3];
45 union data y;
46 x[0].c = 10;
47 fstr(1, x[0]);
48 funi(1, y);