Re: Alternative to fprintf to load value from register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 21, 2023 at 11:26 AM Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
>
>
>
> On Thu, 21 Sept 2023, 09:59 Mathieu Malaterre via Gcc-help, <gcc-help@xxxxxxxxxxx> wrote:
>>
>> Hi all,
>>
>> I am tracking an issue in my code. I can make the symptom go away with a simple:
>>
>>   fprintf(stdout, "%.17g\n", value);
>>
>> However this has a rather large impact on the generated code (diffstat
>> of assembly code is ~~789). Is there any other trick to pretend to
>> load value from FPU into the stack ?
>
>
> Maybe something like:
> __asm ("" : "m" (value));

The following worked for me:

  asm volatile("" : "+r"(value) : : "memory");

Thanks !
>>
>> I tried a naive
>>
>> volatile double dbg = value; (void)dbg;
>>
>> but that did not work.
>>
>> For reference: g++-13 / x86 (-m32 -fexcess-precision=fast).
>>
>> Thanks,
>> --
>> Mathieu



-- 
Mathieu




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux