This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
apparent typo in combine.c
- To: gcc at gcc dot gnu dot org
- Subject: apparent typo in combine.c
- From: Zack Weinberg <zackw at panix dot com>
- Date: Fri, 17 Aug 2001 15:24:20 -0400
This code from combine.c::make_compound_operation() looks wrong to me.
case LSHIFTRT:
/* If the sign bit is known to be zero, replace this with an
arithmetic shift. */
if (ashr_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing
&& lshr_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing
&& mode_width <= HOST_BITS_PER_WIDE_INT
&& (nonzero_bits (XEXP (x, 0), mode) & (1 << (mode_width - 1))) == 0)
{
new = gen_rtx_ASHIFTRT (mode,
make_compound_operation (XEXP (x, 0),
next_code),
XEXP (x, 1));
break;
}
As I read it, this means: if we are working on a logical shift right,
and we *don't* have an arithmetic shift right for this mode, and we *do*
have a logical shift right, and some other stuff, then replace the logical
shift with an arithmetic shift.
Now how can that be right? Generate an arithmetic shift only if we
*don't* have an arithmetic shift insn for this mode? I would think
that either the != and == should be swapped in the first two lines,
or we should change the first line to != and lose the test of lshr_optab
entirely (on the theory that we prefer generating arithmetic shifts).
Comments?
zw