This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: target/5170: Supicious code in arm.md
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 4 Jan 2002 17:46:02 -0000
- Subject: Re: target/5170: Supicious code in arm.md
- Reply-to: Richard Earnshaw <rearnsha at arm dot com>
The following reply was made to PR target/5170; it has been noted by GNATS.
From: Richard Earnshaw <rearnsha@arm.com>
To: Klaus.k.pedersen@nokia.com
Cc: gcc-gnats@gcc.gnu.org, Richard.Earnshaw@arm.com
Subject: Re: target/5170: Supicious code in arm.md
Date: Fri, 04 Jan 2002 17:41:38 +0000
> I think that there is a bug here:
>
> > for (i = 0; i < 25; i++)
> > if ((val & (mask << i)) == val)
> > break;
> >
> > if (i == 0)
> > FAIL;
The test is correct. We don't want to use the split pattern if we can
handle the constant with a single instruction. That could lead to a
recursive split of the instruction.
That is, the pattern is looking for cases of
mov Rn, #const
that are invalid, but can be represented as
mov Rn, #(const >> i)
lsr Rn, #i
Clearly we don't want to do this when i == 0, since a shift of zero is a
no-op (and recursive attempts to split the initial mov instruction would
never terminate).
There is no need to test for i == 25, since the predicate for the pattern
has already told us that the constant is OK.