[LLVMbugs] [Bug 10441] New: LLVM Function with structure parameter is not compatible with VS2010
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jul 22 04:37:18 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10441
Summary: LLVM Function with structure parameter is not
compatible with VS2010
Product: new-bugs
Version: 2.9
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: wuye9036 at gmail.com
CC: llvmbugs at cs.uiuc.edu
Hi, I was wrote a function as following:
===================================================
%float3 = <{float, float, float}>
define float dot_prod( %float3 %lhs, %float3 %rhs ){
// blah blah blah
}
===================================================
And I have a function to invoke it:
===================================================
struct float3{ float x, y, z; };
float3 a, b;
// Initialize a,b
// get JIT-ed pointer
float r = dot_prod( a, b ); // *ERROR*.
===================================================
That's disassembly told us:
caller:
110: float f = test_dot_f3(lhs, rhs);
000000013FEBF4A1 lea rax,[rsp+1D8h]
000000013FEBF4A9 mov qword ptr [rsp+1E8h],rax
000000013FEBF4B1 lea rax,[rsp+1F0h]
000000013FEBF4B9 mov qword ptr [rsp+200h],rax
000000013FEBF4C1 lea rdx,[rsp+118h]
000000013FEBF4C9 mov rcx,qword ptr [rsp+1E8h]
000000013FEBF4D1 call eflib::vec3::vec3 (13FEB27C0h)
000000013FEBF4D6 mov qword ptr [rsp+300h],rax
000000013FEBF4DE lea rdx,[rsp+0E8h]
000000013FEBF4E6 mov rcx,qword ptr [rsp+200h]
000000013FEBF4EE call eflib::vec3::vec3 (13FEB27C0h)
000000013FEBF4F3 mov rcx,qword ptr [rsp+300h]
000000013FEBF4FB mov rdx,rcx
000000013FEBF4FE mov rcx,rax
000000013FEBF501 call qword ptr [rsp+98h]
000000013FEBF508 movss dword ptr [rsp+144h],xmm0
callee(dot_prod):
00000000002C0013 db 38h
00000000002C0014 movss xmm4,dword ptr [rsp+68h]
00000000002C001A movss xmm5,dword ptr [rsp+60h]
00000000002C0020 movss dword ptr [rsp+20h],xmm5
00000000002C0026 movss dword ptr [rsp+28h],xmm4
00000000002C002C mov rax,0F0010h
00000000002C0036 call rax ; It's another function.
00000000002C0038 add rsp,38h
00000000002C003C ret
And MSDN said if struct is bigger than 64bit, it will save the pointer to rcx
and rdx as arguments. So I don't know what I mistake on it.
Thank you.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list