[LLVMdev] pow operator on Windows

Frits van Bommel fvbommel at gmail.com
Sat Feb 12 05:14:20 PST 2011


On Sat, Feb 12, 2011 at 1:06 PM, Dimitry Andric <dimitry at andric.com> wrote:
> On 2011-02-12 12:34, David Given wrote:
>> You might want to look at the generated machine code to see how they
>> differ. If this *is* the problem, you can tell gcc to use a particular
>> instruction set with -mfpmath=386 or -mfpmath=sse.
>
> I think you mean -mfpmath=387, instead. :)
>
> Btw, this option is also not supported by clang... any idea how it could
> be implemented, if at all?

Shouldn't be that hard for 32-bit x86 since -mattr=-sse already works
when passed to llc (but not clang) so you should be able to just copy
that code.

For x86-64 it's trickier, as the calling convention uses SSE registers
so -mattr=-sse ICEs when returning floats etc. ("LLVM ERROR: SSE
register return with SSE disabled").
This would need either
a) a more selective option to disable SSE *math* only (but allow use
of SSE registers for parameters and return values), or
b) change the calling convention to use x87 registers instead. This
which would require recompiling anything that accepts or returns
floating-point numbers, including printf(), sqrt() and friends, etc.



More information about the llvm-dev mailing list