diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-19 20:55:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-19 20:55:31 +0000 |
commit | b22eb6304fa4083ebb081ee839d11a08030d6fcd (patch) | |
tree | f4f5c0e9b08cd51a64ff6b2440e0d661fcfdd015 /llvm | |
parent | 17f1f1a56cad3421997250d26c6fbf0652b55a55 (diff) | |
download | bcm5719-llvm-b22eb6304fa4083ebb081ee839d11a08030d6fcd.tar.gz bcm5719-llvm-b22eb6304fa4083ebb081ee839d11a08030d6fcd.zip |
Add a note
llvm-svn: 28401
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/X86/README.txt | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/README.txt b/llvm/lib/Target/X86/README.txt index ef819d788f2..34055ddafb8 100644 --- a/llvm/lib/Target/X86/README.txt +++ b/llvm/lib/Target/X86/README.txt @@ -539,3 +539,41 @@ _foo: ret //===---------------------------------------------------------------------===// + +Consider this: + +typedef struct pair { float A, B; } pair; +void pairtest(pair P, float *FP) { + *FP = P.A+P.B; +} + +We currently generate this code with llvmgcc4: + +_pairtest: + subl $12, %esp + movl 20(%esp), %eax + movl %eax, 4(%esp) + movl 16(%esp), %eax + movl %eax, (%esp) + movss (%esp), %xmm0 + addss 4(%esp), %xmm0 + movl 24(%esp), %eax + movss %xmm0, (%eax) + addl $12, %esp + ret + +we should be able to generate: +_pairtest: + movss 4(%esp), %xmm0 + movl 12(%esp), %eax + addss 8(%esp), %xmm0 + movss %xmm0, (%eax) + ret + +The issue is that llvmgcc4 is forcing the struct to memory, then passing it as +integer chunks. It does this so that structs like {short,short} are passed in +a single 32-bit integer stack slot. We should handle the safe cases above much +nicer, while still handling the hard cases. + +//===---------------------------------------------------------------------===// + |