[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW librarie
From: |
David Kastrup |
Subject: |
Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden) |
Date: |
Tue, 04 Feb 2020 17:06:03 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Jonas Hahnfeld <address@hidden> writes:
> Am Dienstag, den 04.02.2020, 16:57 +0100 schrieb David Kastrup:
>> Dan Eble <
>> address@hidden
>> > writes:
>>
>> > On Feb 4, 2020, at 09:44, Masamichi Hosoda <
>> > address@hidden
>> > > wrote:
>> > > +// FIXME: workaround: In GUB, g++ 4.9.4 for darwin-x86,
>> > > +// it seems that static cast from `unsigned long long` to `double`
>> > > +// by x86 SSE2 raises an internal compile error.
>> > > +// However, static cast from `signed long long` to `double`
>> > > +// does not raise the error.
>> > > +// So we use it for a workaround.
>> > > +#if defined (__i386__) && defined (__APPLE__) && \
>> > > + defined (__SSE2_MATH__) && __GNUC__ < 5
>> > > + {
>> > > + I64 inum = num_;
>> > > + I64 iden = den_;
>> > > + return static_cast<double> (sign_) *
>> > > + static_cast<double> (inum) / static_cast<double> (iden);
>> > > + }
>> > > +#else
>> > > return (double)sign_ * (double)num_ / (double)den_;
>> > > +#endif
>> >
>> > Is the conditional code really necessary? Why not boil it down to the
>> > working code and a comment explaining the extra conversion to signed
>> > numbers?
>>
>> That would be my impulse as well. It is not like this code appears to
>> have notable drawbacks for the unafflicted platforms.
>
> Except for very funny overflows and negative signs if the value is too
> large to fit into I64 ;-P
>
> unsigned long long a = 0xC0000000;
> signed long long b = a;
> printf("%d\n", b);
> -> -1073741824
Halving the useful range before overflows is a problem, so I'll stick
with most of the guards. Though I am skeptical that stuff exceeding I64
has much of a chance of working well, anyway.
--
David Kastrup
- Re: New build:, (continued)
- Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), David Kastrup, 2020/02/04
- Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), Masamichi Hosoda, 2020/02/04
- Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), Phil Holmes, 2020/02/04
- Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), Dan Eble, 2020/02/04
- Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), David Kastrup, 2020/02/04
- Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), Jonas Hahnfeld, 2020/02/04
- Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden),
David Kastrup <=
- Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), David Kastrup, 2020/02/04
- Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), Dan Eble, 2020/02/04
- Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), Jonas Hahnfeld, 2020/02/04
Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), ArnoldTheresius, 2020/02/03
Re: Inline assembler fallback for _FPU_SETCW() missing in MINGW libraries (issue 577450043 by address@hidden), ArnoldTheresius, 2020/02/03