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: [PATCH] Making double precision constants work with -fsingle-precision-constant


Carlos O'Donell wrote:

>      {
>        sprintf (buf, "0x1p%d", (fmt->emin - fmt->p) * fmt->log2_b);
>        builtin_define_with_hex_fp_value (name, type, decimal_dig,
> -					buf, fp_suffix);
> +					buf, fp_suffix, fp_cast);
> +      /* denorm is present */
> +      sprintf (name, "__%s_HAS_DENORM__", name_prefix);
> +      builtin_define_with_value (name, "1", 0);
>      }
>    else
>      {
>        sprintf (buf, "0.0%s", fp_suffix);
>        builtin_define_with_value (name, buf, 0);
> +      /* denorm is not present */
> +      sprintf (name, "__%s_HAS_DENORM__", name_prefix);
> +      builtin_define_with_value (name, "0", 0);
>      }

Better to share this code; let's do:

      sprintf (name, "__%s_HAS_DENORM__", name_prefix);
      builtin_define_with_value (name, fmt->has_denorm ? "1" : "0", 0);

outside of the if-statement.

I'll approve the patch with that change, since Gaby has already approved
the V3 bits, and RTH has approved the rest of the patch, from a
technical point of view.  However, before committing the patch, please
give RTH 24 hours to object to the idea of fixing this in principle, as
opposed to removing the option.

Actually, you also need to create a test-case for the problem before you
check this patch in; it should go in testsuite/gcc.dg.  You will want
something like:

  /* { dg-options "-fsingle-precision-constant" } */

to make the compiler use the option when running the test.  Please post
the testcase so we can review that too.

Thanks,

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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