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 |
4 | |
5 | #include <stdarg.h> |
6 | |
7 | extern void abort() __attribute__((noreturn)); |
8 | |
9 | struct tiny { |
10 | char c; |
11 | }; |
12 | |
13 | union data { |
14 | char c; |
15 | }; |
16 | |
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, 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 | |
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, 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 | |
43 | void 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 | } |
50 | |