1*67e74705SXin Li // REQUIRES: x86-registered-target
2*67e74705SXin Li // Play around with backend reporting:
3*67e74705SXin Li // _REGULAR_: Regular behavior, no warning switch enabled.
4*67e74705SXin Li // _PROMOTE_: Promote warning to error.
5*67e74705SXin Li // _IGNORE_: Drop backend warning.
6*67e74705SXin Li //
7*67e74705SXin Li // RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -no-integrated-as -S -o - -triple=i386-apple-darwin 2> %t.err
8*67e74705SXin Li // RUN: FileCheck < %t.err %s --check-prefix=REGULAR --check-prefix=ASM
9*67e74705SXin Li // RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -no-integrated-as -S -o - -triple=i386-apple-darwin -Werror=frame-larger-than= 2> %t.err
10*67e74705SXin Li // RUN: FileCheck < %t.err %s --check-prefix=PROMOTE --check-prefix=ASM
11*67e74705SXin Li // RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -no-integrated-as -S -o - -triple=i386-apple-darwin -Wno-frame-larger-than= 2> %t.err
12*67e74705SXin Li // RUN: FileCheck < %t.err %s --check-prefix=IGNORE --check-prefix=ASM
13*67e74705SXin Li //
14*67e74705SXin Li // RUN: %clang_cc1 %s -S -o - -triple=i386-apple-darwin -verify -no-integrated-as
15*67e74705SXin Li
16*67e74705SXin Li extern void doIt(char *);
17*67e74705SXin Li
18*67e74705SXin Li // REGULAR: warning: stack frame size of {{[0-9]+}} bytes in function 'stackSizeWarning'
19*67e74705SXin Li // PROMOTE: error: stack frame size of {{[0-9]+}} bytes in function 'stackSizeWarning'
20*67e74705SXin Li // IGNORE-NOT: stack frame size of {{[0-9]+}} bytes in function 'stackSizeWarning'
stackSizeWarning()21*67e74705SXin Li void stackSizeWarning() {
22*67e74705SXin Li char buffer[80];
23*67e74705SXin Li doIt(buffer);
24*67e74705SXin Li }
25*67e74705SXin Li
26*67e74705SXin Li // ASM: inline assembly requires more registers than available
inlineAsmError(int x0,int x1,int x2,int x3,int x4,int x5,int x6,int x7,int x8,int x9)27*67e74705SXin Li void inlineAsmError(int x0, int x1, int x2, int x3, int x4,
28*67e74705SXin Li int x5, int x6, int x7, int x8, int x9) {
29*67e74705SXin Li __asm__("hello world": : "r" (x0),"r" (x1),"r" (x2),"r" (x3), // expected-error + {{inline assembly requires more registers than available}}
30*67e74705SXin Li "r" (x4),"r" (x5),"r" (x6),"r" (x7),"r" (x8),"r" (x9));
31*67e74705SXin Li }
32