diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-07-24 21:40:17 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-07-24 21:40:17 +0000 |
commit | cde227bc2a52c6e05c083df47eb08a01a94a09b1 (patch) | |
tree | 2b5f4d8c39d09dde0e161121b557fe8d636be38b /test/CodeGen/X86 | |
parent | 16b7dd64e91f1b05b40ebfeb64b49f3ac17cb426 (diff) | |
download | external_llvm-cde227bc2a52c6e05c083df47eb08a01a94a09b1.zip external_llvm-cde227bc2a52c6e05c083df47eb08a01a94a09b1.tar.gz external_llvm-cde227bc2a52c6e05c083df47eb08a01a94a09b1.tar.bz2 |
In order to correctly compile
struct s {
double x1;
float x2;
};
__attribute__((regparm(3))) struct s f(int a, int b, int c);
void g(void) {
f(41, 42, 43);
}
We need to be able to represent passing the address of s to f (sret) in a
register (inreg). Turns out that all that is needed is to not mark them as
mutually incompatible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160695 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86')
-rw-r--r-- | test/CodeGen/X86/inreg.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/CodeGen/X86/inreg.ll b/test/CodeGen/X86/inreg.ll new file mode 100644 index 0000000..8981033 --- /dev/null +++ b/test/CodeGen/X86/inreg.ll @@ -0,0 +1,19 @@ +; RUN: llc < %s -march=x86 | FileCheck %s + +%struct.s = type { double, float } + +define void @g() nounwind { +entry: + %tmp = alloca %struct.s, align 4 + call void @f(%struct.s* inreg sret %tmp, i32 inreg 41, i32 inreg 42, i32 43) + ret void + ; CHECK: g: + ; CHECK: subl {{.*}}, %esp + ; CHECK-NEXT: $43, (%esp) + ; CHECK-NEXT: leal 16(%esp), %eax + ; CHECK-NEXT: movl $41, %edx + ; CHECK-NEXT: movl $42, %ecx + ; CHECK-NEXT: calll f +} + +declare void @f(%struct.s* inreg sret, i32 inreg, i32 inreg, i32) |