50 lines · c
1// RUN: %clang_cc1 -triple mips-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=MIPS2// RUN: %clang_cc1 -triple mips64-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=MIPS643// RUN: %clang_cc1 -triple armebv7-linux-gnueabihf -emit-llvm %s -o - | FileCheck %s -check-prefix=ARM4 5#include <stdarg.h>6 7extern void abort(void) __attribute__((noreturn));8 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, ptr %argp.cur, i32 326// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, ptr %argp.cur, i64 727// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, ptr %argp.cur, i32 328}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, ptr %argp.cur, i32 339// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, ptr %argp.cur, i64 740// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, ptr %argp.cur, i32 341}42 43void 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);49}50