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

Chris Lattner clattner at apple.com
Sun Feb 1 10:00:42 PST 2009


On Feb 1, 2009, at 2:28 AM, 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).

Yes, with one change:

+      assert((Subtarget->hasSSE1() || !NumXMMRegs) &&
+             "SSE register cannot be used when SSE is disabled!");

Please change these into something like this:
   if (..) {
     cerr << "user message here";
     exit(1);
   }

assuming that you can trigger it with the right input.

Thanks Edwin!

-Chris

> It should only have an effect if the user uses -mno-sse, or llc's
> -mattr=-sse, everything should work as before otherwise. Of course you
> won't be able to pass floating point values (since that requires an  
> SSE
> register), but the kernel doesn't use floating point, and gcc gives an
> error (trying to use SSE register when SSE is disabled) anyway if you
> try to do so, so llvm would mimic gcc's behaviour here quite well I  
> hope.
>
> [1]
> Workarounds:
> arch/x86/boot compiled with gcc
> http://llvm.org/bugs/show_bug.cgi?id=2989#c2 patch applied to llvm-gcc
> the put_user() fix applied to the linux kernel
> a workaround for a bug in lib/vsprintf.c (undefined behaviour: pointer
> arithmetic that overflows)
>
> Best regards,
> --Edwin
> <nosse.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list