[LLVMdev] pow operator on Windows

David Given dg at cowlark.com
Sat Feb 12 03:34:45 PST 2011


On 12/02/11 04:52, Michael Smith wrote:
[...]
> With "gcc test.c; ./a.exe", the printed result is 6.50260946378542390000
> With "clang -emit-llvm -c test.c -o test.bc; lli test.bc", the printed result is 6.50260946378542480000

The x86 has got several different FPU instruction sets, which don't all
work at the same precision. In particular, using 387 instructions uses
80-bit floats when working with temporaries, while SSE instructions use
64-bit floats.

gcc's default choice is 387, so if clang is defaulting to SSE (which
most compiler software these days does because 387 instructions are
horrible), this might explain the results you get.

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.

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "I have a mind like a steel trap. It's rusty and full of dead mice."
│ --- Anonymous, on rasfc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110212/b943e374/attachment.sig>


More information about the llvm-dev mailing list