[llvm-commits] Turning off SSE codegen for x86-64?

Török Edwin edwintorok at gmail.com
Sun Feb 1 08:42:28 PST 2009


On 2009-02-01 12:28, Török Edwin wrote:
> On 2009-01-28 23:30, Dale Johannesen wrote:
>   
>>> So far I found that functions with va-args get SSE registers pushed on
>>> the stack on x86-64/linux.
>>> Could you point me to the place where this happens in llvm codegen? If
>>> its not too complicated I may try to propose a patch when I find  
>>> some time.
>>>     
>>>       
>> LowerCALL in X86ISelLowering.cpp, and X86CallingConv.td.  You'll need  
>> to match up with the
>> prolog code which is in LowerFORMAL_ARGUMENTS.
>>   
>>     
>
> Thanks, attached is a patch I've tested on the Linux kernel, with this
> patch it now builds and boots to the login prompt! (with a few
> workarounds [1])
>
> Can I commit the patch? (I would like it to be part of 2.5).
>   

Here's an updated patch to mimic gcc better:
- if float/double is attempted to be returned on x86-64 with SSE turned
off (or on x86-32 with sseregparm CC) an
error message is shown, and abort()-ed. This is similar to gcc, which
shows an error.
- the X86CallingConv.td now falls back to passing FP args on the stack
when SSE is not available on x86-64
This mimics gcc again, where you can still pass FP args (even to vararg
functions!) and it'll fall back to x87 operations
when SSE  is off
- the assert in codegen is now there to check that the CC is right, and
doesn't  use SSE regs when it is turned off, it should never trigger (so
I didn't put abort calls there)
- there's also a testcase now

I wanted to add a testcase for the case where codegen aborts, but I
don't think the test infrastructure supports both testing
for the output, and the failure of a command.

Best regards,
--Edwin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nosse2.patch
Type: text/x-diff
Size: 7003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090201/fa4c464a/attachment.patch>


More information about the llvm-commits mailing list