Re-post: DFP front-end and other changes

Ben Elliston bje@au1.ibm.com
Tue Dec 13 05:54:00 GMT 2005


(A public version of a reply I've already sent to Richard.)

On Mon, Dec 12, 2005 at 01:34:32PM -0800, Richard Henderson wrote:

> > +  if (flags & CPP_N_DFLOAT) 
> > +    copylen -= 2;
> > +  else 
> > +    {
> > +      if ((flags & CPP_N_WIDTH) != CPP_N_MEDIUM)
> > +	/* Must be an F or L suffix.  */
> > +	copylen--;
> > +      if (flags & CPP_N_IMAGINARY)
> > +	/* I or J suffix.  */
> > +	copylen--;
> > +    }
> 
> The imaginary check is orthogonal to the decimal check.

I'm going to leave this as is, as the C decimal float extension says
in section 3:

  "This Technical Report does not define decimal complex types or
   decimal imaginary types."

> > +builtin_define_decfloat_constants (void)
> 
> Why are all these values hard-coded?  Seems like you should be
> taking them from some header somewhere...

Agreed.  Here are the new diffs to c-cppbuiltin.c as a result:

Index: c-cppbuiltin.c
===================================================================
--- c-cppbuiltin.c      (revision 108458)
+++ c-cppbuiltin.c      (working copy)
@@ -96,6 +96,7 @@ builtin_define_float_constants (const ch
   int decimal_dig;
 
   fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
+  gcc_assert (fmt->b != 10);
 
   /* The radix of the exponent representation.  */
   if (type == float_type_node)
@@ -403,6 +404,9 @@ c_cpp_builtins (cpp_reader *pfile)
     builtin_define_float_constants ("DBL", "", "%s", double_type_node);
   builtin_define_float_constants ("LDBL", "L", "%s", long_double_type_node);
 
+  /* For decfloat.h.  */
+  builtin_define_with_int_value ("__DEC_EVAL_METHOD__", TARGET_DEC_EVAL_METHOD);
+
   /* For use in assembly language.  */
   builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
   builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);

All of the original defines have been moved to ginclude/decfloat.h.

> Otherwise it seems ok.

Thanks.  Re-tested with a quick bootstrap on i686-pc-linux-gnu.

Ben



More information about the Gcc-patches mailing list