This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Support signbit, signbitf and signbitl as GCC builtins
- From: Roger Sayle <roger at eyesopen dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Ulrich Weigand <weigand at i1 dot informatik dot uni-erlangen dot de>, <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 5 Feb 2004 09:09:32 -0700 (MST)
- Subject: Re: [PATCH] Support signbit, signbitf and signbitl as GCC builtins
On Wed, 4 Feb 2004, Richard Henderson wrote:
> On Thu, Feb 05, 2004 at 03:13:23AM +0100, Ulrich Weigand wrote:
> > The first alternative allows you to access any *low* part of a register
> > (e.g. (subreg:QI (reg:SI) 3) or (subreg:HI (reg:SI) 2)), while the second
> > alternative allows you to access any word of a multi-word value.
>
> Quite right. Using subreg is *not* a substitute for an extraction.
Sorry. My misunderstanding!
> If imode <= word_mode, and the signbit in imode is outside rmode,
> you should use extract_bit_field on the imode version.
I'm preparing a patch to do this.
> Indeed, it might be cleaner to just use extract_bit_field all the
> time. It does force the result to 0/1 in the case we actually
> store the value, but... that's ok too.
I'll do some experiments to assess the code quality of using
extract_bit_field even for the gen_lowpart case. If the RTL
optimizers can figure out what's going on and avoid shifting to
produce a 0/1 result when used as "if (signbit (x))", then I
agree that always using extract_bit_field is preferable.
If not, and x86 doesn't generate "(imode)x < 0", then I'd prefer
to keep the gen_lowpart whilst the RTL optimizers are sufficiently
improved.
Sorry again for my misunderstanding. I hadn't appreciated that
the middle-end's use of SUBREG was complicated by the target's
value of "wordmode".
Roger
--