diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
commit | 13cc256e404620c1de0cbcc4e43ce1e2dbbc4898 (patch) | |
tree | 2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/CodeGen/le32-regparm.c | |
parent | 657bc3d9848e3be92029b2416031340988cd0111 (diff) | |
download | src-13cc256e404620c1de0cbcc4e43ce1e2dbbc4898.tar.gz src-13cc256e404620c1de0cbcc4e43ce1e2dbbc4898.zip |
Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):vendor/clang/clang-release_32-r168974
Notes
Notes:
svn path=/vendor/clang/dist/; revision=243791
svn path=/vendor/clang/clang-release_32-r168974/; revision=243792; tag=vendor/clang/clang-release_32-r168974
Diffstat (limited to 'test/CodeGen/le32-regparm.c')
-rw-r--r-- | test/CodeGen/le32-regparm.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/CodeGen/le32-regparm.c b/test/CodeGen/le32-regparm.c new file mode 100644 index 000000000000..6ab5a11106b1 --- /dev/null +++ b/test/CodeGen/le32-regparm.c @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -triple le32-unknown-nacl %s -emit-llvm -o - | FileCheck %s + +#define FASTCALL __attribute__((regparm(2))) + +typedef struct { + int aaa; + double bbbb; + int ccc[200]; +} foo; + +// 2 inreg arguments are supported. +void FASTCALL f1(int i, int j, int k); +// CHECK: define void @f1(i32 inreg %i, i32 inreg %j, i32 %k) +void f1(int i, int j, int k) { } + +// inreg structs are not supported. +// CHECK: define void @f2(%struct.foo* inreg %a) +void __attribute__((regparm(1))) f2(foo* a) {} + +// Only the first 2 arguments can be passed inreg, and the first +// non-integral type consumes remaining available registers. +// CHECK: define void @f3(%struct.foo* byval %a, i32 %b) +void __attribute__((regparm(2))) f3(foo a, int b) {} + +// Only 64 total bits are supported +// CHECK: define void @f4(i64 inreg %g, i32 %h) +void __attribute__((regparm(2))) f4(long long g, int h) {} + +typedef void (*FType)(int, int) __attribute ((regparm (2))); +FType bar; +extern void FASTCALL reduced(char b, double c, foo* d, double e, int f); + +int +main(void) { + // The presence of double c means that foo* d is not passed inreg. This + // behavior is different from current x86-32 behavior + // CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %struct.foo* null + reduced(0, 0.0, 0, 0.0, 0); + // CHECK: call void {{.*}}(i32 inreg 1, i32 inreg 2) + bar(1,2); +} |