On Wed, Sep 12, 2012 at 4:15 AM, Sisyphus <[email protected]> wrote:
>
> ----- Original Message -----
> From: "Lajos Foldy" <[email protected]>
> To: <[email protected]>
> Sent: Wednesday, September 12, 2012 12:29 AM
> Subject: Re: [Mingw-w64-public] -ffloat-store not needed with 64-bit
> compiler
>
>
>> On Tue, Sep 11, 2012 at 3:01 PM, Sisyphus <[email protected]>
>> wrote:
>>>
>>> Is there a way to get the same output with the 64-bit mingw compiler ?
>>
>> i686 uses the x87 FPU (80 bit internal precision), x86_64 uses SSE2
>> (64 bit precision). -ffloat-store enforces 64 bit precision through
>> memory stores/loads. You can use the -mfpmath=... option to
>> enable/disable x87 or SSE2.
>
> Thanks Lajos - things start to fall into place.
>
> I gather, however (and probably incorrectly), that if I build demo.exe with:
>
> gcc -o demo.exe -mfpmath=387 demo.c
>
> then demo.exe should ouptut the same result, irrespective if whether I used
> the 32-bit gcc or the 64-bit gcc.
>
> With 32-bit gcc:
>
> #####################################
> C:\_32\C>gcc -o demo.exe -mfpmath=387 demo.c
>
> C:\_32\C>demo
> 1..1
> #     a = [ 0  1  2  2  4  5  5  6  8  9 10 ]
> #     b = [ 0  1  2  2  4  4  5  6  8  8  9 ]
> # a - b = [ 0  0  0  0  0  1  0  0  0  1  1 ]
> not ok 1 - lists are equal
>
> C:\_32\C>
> #####################################
>
> With 64-bit gcc:
>
> #####################################
> C:\_32\C>gcc -o demo.exe -mfpmath=387 demo.c
>
> C:\_32\C>demo
> 1..1
> #     a = [ 0  1  2  2  4  5  5  6  8  9 10 ]
> #     b = [ 0  1  2  2  4  5  5  6  8  9 10 ]
> # a - b = [ 0  0  0  0  0  0  0  0  0  0  0 ]
> ok 1 - lists are equal
>
> C:\_32\C>
> #####################################
>
> Cheers,
> Rob
>

I think that the system ABIs require that floating point function
arguments should be passed in x87 and SSE2 registers, respectively.
This can not be overridden. Try to move all the calculations into a
single function body. Also, you can check the generated code with -S
-fverbose-asm.

regards,
Lajos

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to