This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Support signbit, signbitf and signbitl as GCC builtins
- From: Richard Henderson <rth at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Date: Thu, 29 Jan 2004 14:56:05 -0800
- Subject: Re: [PATCH] Support signbit, signbitf and signbitl as GCC builtins
- References: <Pine.LNX.email@example.com>
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. ;-)