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] Support signbit, signbitf and signbitl as GCC builtins


On Thu, Jan 29, 2004 at 01:42:02PM -0700, Roger Sayle wrote:
> +   /* Check that the floating point format has a sign bit.  */
> +   if (!fmt

I don't believe fmt should ever be null.

>       || !fmt->has_signed_zero

Why check for it?  That simply means that -0.0 isn't a valid
representation, and so it should never be created.

>       || fmt->signbit < 0)

Here "signbit = (f < 0.0)" will work.

> +   /* Check we can represent the signbit as an immediate constant.  */
> +   if (bitpos >= 2 * HOST_BITS_PER_WIDE_INT)
> +     return 0;

This is in the wrong place.  You want this after we've reduced to
rmode.  And after that, the test should always be false.

> +   temp = expand_binop (rmode, and_optab, temp,
> + 		       immed_double_const (lo, hi, rmode),
> + 		       target, 1, OPTAB_LIB_WIDEN);

I think we should canonicalize on 0/1 or 0/MIN_INT.  I know it's
not required, but I don't like the idea of expand_signbit and
fold_signbit producing different results.

Hum.  Perhaps that's even more pointless, since either may or
may not correspond with the libm routine.

Oh, it would be nice to generate (lt temp 0) when the bit is
in the correct position and it's cheaper.  E.g. Alpha.  ;-)


r~


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