From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18362 invoked by alias); 4 Jan 2002 17:46:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 18331 invoked by uid 71); 4 Jan 2002 17:46:02 -0000 Date: Fri, 04 Jan 2002 09:46:00 -0000 Message-ID: <20020104174602.18327.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Richard Earnshaw Subject: Re: target/5170: Supicious code in arm.md Reply-To: Richard Earnshaw X-SW-Source: 2002-01/txt/msg00157.txt.bz2 List-Id: The following reply was made to PR target/5170; it has been noted by GNATS. From: Richard Earnshaw 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.