target/5170: Supicious code in arm.md

Richard Earnshaw rearnsha@arm.com
Fri Jan 4 09:46:00 GMT 2002


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.
 
 
 



More information about the Gcc-prs mailing list