Printing shortest decimal form of floating point number with Mir

9il ilyayaroshenko at gmail.com
Wed Jan 6 09:31:59 UTC 2021


On Wednesday, 6 January 2021 at 02:30:30 UTC, Walter Bright wrote:
> On 1/5/2021 2:42 AM, 9il wrote:
>> On Tuesday, 5 January 2021 at 09:47:41 UTC, Walter Bright 
>> wrote:
>>> On 1/4/2021 11:22 PM, 9il wrote:
>>>> I can't reproduce the same DMD output as you.
>>>
>>> I did it on Windows 32 bit. I tried it on Linux 32, which 
>>> does indeed show the behavior you mentioned. At the moment I 
>>> don't know why the different behaviors.
>>>
>>> https://issues.dlang.org/show_bug.cgi?id=21526
>>>
>>>
>>>> It just uses SSE, which I think a good way to go, haha.
>>>
>>> As I mentioned upthread, it will use SSE when SSE is baseline 
>>> on the CPU target, and it will always round to precision.
>> 
>> Does this mean that DMD Linux 32-bit executables should 
>> compile with SSE codes?
>
> The baseline Linux target does not have SSE.
>
>
>> I ask because DMD compiles Linux 32-bit executables with x87 
>> codes when -O is passed and with SSE if no -O is passed. That 
>> is very weird.
>
> Example, please?

DMD with flag -m32 generates

https://cpp.godbolt.org/z/GMGMra
         assume  CS:.text._D7example1fFffZf
                 push    EBP
                 mov     EBP,ESP
                 sub     ESP,018h
                 movss   XMM0,0Ch[EBP]
                 movss   XMM1,8[EBP]
                 addss   XMM0,XMM1
                 movss   -8[EBP],XMM0
                 subss   XMM0,XMM1
                 movss   -4[EBP],XMM0
                 movss   -018h[EBP],XMM0
                 fld     float ptr -018h[EBP]
                 leave
                 ret     8
                 add     [EAX],AL

It has been provided in the thread
https://forum.dlang.org/post/gqzdiicrvtlicurxyvby@forum.dlang.org



More information about the Digitalmars-d-announce mailing list