xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/regparm.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc #define FASTCALL __attribute__((regparm(2)))
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc typedef struct {
6*f4a2713aSLionel Sambuc   int aaa;
7*f4a2713aSLionel Sambuc   double bbbb;
8*f4a2713aSLionel Sambuc   int ccc[200];
9*f4a2713aSLionel Sambuc } foo;
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc typedef void (*FType)(int, int)      __attribute ((regparm (3), stdcall));
12*f4a2713aSLionel Sambuc FType bar;
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc extern void FASTCALL reduced(char b, double c, foo* d, double e, int f);
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc // PR7025
17*f4a2713aSLionel Sambuc void FASTCALL f1(int i, int j, int k);
18*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f1(i32 inreg %i, i32 inreg %j, i32 %k)
f1(int i,int j,int k)19*f4a2713aSLionel Sambuc void f1(int i, int j, int k) { }
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc int
main(void)22*f4a2713aSLionel Sambuc main(void) {
23*f4a2713aSLionel Sambuc   // CHECK: call void @reduced(i8 inreg signext 0, {{.*}} %struct.foo* inreg null
24*f4a2713aSLionel Sambuc   reduced(0, 0.0, 0, 0.0, 0);
25*f4a2713aSLionel Sambuc   // CHECK: call x86_stdcallcc void {{.*}}(i32 inreg 1, i32 inreg 2)
26*f4a2713aSLionel Sambuc   bar(1,2);
27*f4a2713aSLionel Sambuc }
28