This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Condition branch on least significant bit
- From: Jim Wilson <wilson at tuliptree dot org>
- To: Jan Hoogerbrugge <hoogerbrugge at hotmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 25 Jun 2003 11:32:33 -0700
- Subject: Re: Condition branch on least significant bit
- References: <Law9-F121dVvsO3Hv1300004501@hotmail.com>
Jan Hoogerbrugge wrote
> - Should GET_CLASS_NARROWEST_MODE (MODE_INT) return BImode instead of
> SImode which it currently seems to do?
There is a comment in rtl.c that explains why GET_CLASS_NARROWEST_MODE
is QImode instead of BImode.
Since I can't think of any benefit of ever having a BImode add, a
possible way to solve this is to exclude BImode in
MODES_OK_FOR_MOVE2ADD. This may not be most efficient way to solve the
problem though, since this will add a lot of BImode checks, and the
modes here will rarely be BImode.
The alternative solution would be to add a special check for BImode
before or in this loop. If this is the only place in move2add where
BImode causes problems, then this may be a reasonable solution.
It is OK for the have_insn_for call here to always return false. That
is the normal case.
The loop must test only modes smaller than the original mode, so looping
until mode != VOIDmode would not be correct here, as then we would be
looping over larger modes when the reg is BImode. We could use a
GET_MODE_SIZE test, but this is slower, and only useful if the reg mode
is BImode, so it is simpler to just handle the BImode case specially.
If the reg mode is BImode, then there is no point in entering the loop.
We could change the "else" above the loop to "else if (GET_MODE (reg)
!= BImode)".
Jim