octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Please build the JIT branch


From: Michael Goffioul
Subject: Re: Please build the JIT branch
Date: Sat, 14 Jul 2012 18:07:46 +0100

On Sat, Jul 14, 2012 at 1:49 PM, Max Brister <address@hidden> wrote:
This seems to be a little out of date. LLVM does allow for aggregate
values to be passed as atomic values now, however I think the problem
pointed in that post exists (it's unclear to LLVM how multiple values
should be returned).

Yes, it's a bit outdated. But it explained partially what's happening. You declared a return typed as {double,double} and LLVM translated that into returning into ST(0)/ST(1). I don't think this is compatible with x86-32 ABI. The post mentions that on some ABI, "double _Complex" are returned in these registers, but when I compile a simple test sample with GCC under Linux 32bits, I don't see that (form the assembly, it looks like it's using a hidden pointer on the stack). I don't know what platform they're referring to.

Note that the problem theoretically only occurs when interfacing with non-LLVM code. Within LLVM, such functions would use a compatible ABI.
 
> For the record, I finally got it working. I had to hack the calling
> conventions in LLVM to disable the use of ST(0)/ST(1) registers to return
> multiple floating-point values. Then the generated assembly is compatible
> with MSVC ABI. What I don't understand is why that problem does not occur on
> 32-bits Linux. AFAIK the ABI to return aggregates are the same (except for
> who's popping the hidden pointer argument).

Thank you for looking into this. Calling conventions are a real pain.
I'm not sure if disabling ST(0)/ST(1) is a good long term solution as
we might run into issues trying to return some other type. I should
look at clang to see how they handle this issue (this might take some
time though).

I didn't disable ST(0)/ST(1), I just removed ST(1) as a possible return register. So {double,double} are now returned as a hidden pointer (while a single double is returned in ST(0), as it should be). I didn't test, but I'm wondering what LLVM will generate for code returning {float,float}. On x86-32 it should use EAX:EDX.
 
This problem might also appear on 32bit linux. I have a machine
running 32bit linux and am trying it now.

I wanted to try on my F16 box, but it only has LLVM 2.9. Is LLVM 3.0 absolutely required? The configure script succeeded, but the compilation failed as it couldn't find llvm/Support/TargetSelect.h.

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]