This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [committed] clean up preprocessor conditional (Re: [PATCH 4/5] distinguish likely and unlikely results (PR 78703))


On 27 January 2017 at 03:49, Martin Sebor <msebor@gmail.com> wrote:
> I committed the patch below to clean up the "mess."
>
> Thanks
> Martin
>
> Index: gcc/gimple-ssa-sprintf.c
> ===================================================================
> --- gcc/gimple-ssa-sprintf.c    (revision 244957)
> +++ gcc/gimple-ssa-sprintf.c    (working copy)
> @@ -1686,20 +1686,10 @@ format_floating (const directive &dir, tree arg)
>         prec[0] = -1;
>        if (prec[1] < 0)
>         {
> -#ifdef HAVE_XFmode
> -         /* When L is specified use long double, otherwise double.  */
> -         unsigned fmtprec
> -           = (dir.modifier == FMT_LEN_L
> -              ? REAL_MODE_FORMAT (XFmode)->p
> -              : REAL_MODE_FORMAT (DFmode)->p);
> -#elif defined HAVE_DFmode
> -         /* No long double support, use double precision for both.  */
> -         unsigned fmtprec = REAL_MODE_FORMAT (DFmode)->p;
> -#else
> -         /* No long double or double support.  */
> -         unsigned fmtprec = 0;
> -#endif
> -         /* The precision of the IEEE 754 double format is 53.
> +          unsigned fmtprec
> +           = REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (arg)))->p;
> +
> +              /* The precision of the IEEE 754 double format is 53.
>              The precision of all other GCC binary double formats
>              is 56 or less.  */
>           prec[1] = fmtprec <= 56 ? 13 : 15;
>
> Thanks
> Martin
>

I confirm the builds now succeed on my side (since r244957).
Thanks for the prompt fix.

Christophe.


> On 01/26/2017 06:12 PM, Andrew Pinski wrote:
>>
>> On Thu, Jan 26, 2017 at 3:17 PM, Martin Sebor <msebor@gmail.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> With this patch all my builds for aarch64/arm failed:
>>>> /gcc/gimple-ssa-sprintf.c: In function
>>>> ‘<unnamed>::fmtresult<unnamed>::format_floating(const<unnamed>::direc
>>>> tive&, tree_node*)’:
>>>> /gcc/gimple-ssa-sprintf.c:1643: error: ‘XFmode’ was not declared in this
>>>> scope
>>>>
>>>> Is this fixed later in the series?
>>>
>>>
>>>
>>> It isn't.  I just reproduced it with an aarch64 cross-compiler so
>>> I hope to be able to fix it quickly.
>>
>>
>> This actually broke any non-x86 targeted GCC.
>>
>> Even the current code is wrong:
>> #ifdef HAVE_XFmode
>>           /* When L is specified use long double, otherwise double.  */
>>           unsigned fmtprec
>>             = (dir.modifier == FMT_LEN_L
>>                ? REAL_MODE_FORMAT (XFmode)->p
>>                : REAL_MODE_FORMAT (DFmode)->p);
>> #elif defined HAVE_DFmode
>>           /* No long double support, use double precision for both.  */
>>           unsigned fmtprec = REAL_MODE_FORMAT (DFmode)->p;
>> #else
>>           /* No long double or double support.  */
>>           unsigned fmtprec = 0;
>> #endif
>>
>>
>> Shouldn't this be based instead on long_double_type_node instead?
>> Because different targets might have an option to select different
>> modes.
>>
>> So it just becomes something like which simplifies the mess you have
>> currently:
>>           /* When L is specified use long double, otherwise double.  */
>>           unsigned fmtprec
>>             = (dir.modifier == FMT_LEN_L
>>                ? REAL_MODE_FORMAT (TYPE_MODE (long_double_type_node))->p
>>                : REAL_MODE_FORMAT (TYPE_MODE ((double_type_node))->p);
>>
>>
>> Thanks,
>> Andrew
>>
>>>
>>> Martin
>>>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]