From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9174 invoked by alias); 7 Nov 2010 14:06:04 -0000 Received: (qmail 9163 invoked by uid 22791); 7 Nov 2010 14:06:03 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_DQ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 07 Nov 2010 14:05:56 +0000 Received: from kpbe19.cbf.corp.google.com (kpbe19.cbf.corp.google.com [172.25.105.83]) by smtp-out.google.com with ESMTP id oA7E5qOw025735 for ; Sun, 7 Nov 2010 06:05:53 -0800 Received: from yxt3 (yxt3.prod.google.com [10.190.5.195]) by kpbe19.cbf.corp.google.com with ESMTP id oA7E5ZGO000315 for ; Sun, 7 Nov 2010 06:05:51 -0800 Received: by yxt3 with SMTP id 3so3004230yxt.30 for ; Sun, 07 Nov 2010 06:05:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.150.51.18 with SMTP id y18mr6772071yby.191.1289138750654; Sun, 07 Nov 2010 06:05:50 -0800 (PST) Received: by 10.151.154.13 with HTTP; Sun, 7 Nov 2010 06:05:50 -0800 (PST) In-Reply-To: <201011031304.02720.paul@codesourcery.com> References: <1281516776.3047.177.camel@e102346-lin.cambridge.arm.com> <201011031304.02720.paul@codesourcery.com> Date: Sun, 07 Nov 2010 14:21:00 -0000 Message-ID: Subject: Re: [PATCH: PR target/44999] Replace "and r0, r0, #255" with uxtb in thumb2 From: Carrot Wei To: Paul Brook Cc: gcc-patches@gcc.gnu.org, Richard Earnshaw Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-11/txt/msg00679.txt.bz2 On Wed, Nov 3, 2010 at 9:04 PM, Paul Brook wrote: >> > + =A0 =A0 =A0 =A0 =A0 =A0 operands[1] =3D convert_to_mode (QImode, ope= rands[1], 1); >> > + =A0 =A0 =A0 =A0 =A0 =A0 emit_insn (gen_thumb2_zero_extendqisi2_v6 (o= perands[0], >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0operands[1])); >> > + =A0 =A0 =A0 =A0 =A0 } >> > >> > =A0 =A0 =A0 =A0 =A0} >> >> This is OK. > > No it's not. This code is inside if (TARGET_32BIT). Using thumb specific > patterns in ARM mode is just plain wrong. > You are right. Following is additional patch to fix it. Tested with regression testing in qemu. > Even ignoring that, I don't think this is the right fix. Why do we need t= his > for Thumb mode, and not ARM mode? Why extendqi and not extendhi? In Thumb mode, and with a constant is 32 bit, and uxtb is 16 bit. In ARM mode, both are 32 bit, so it is not beneficial. The test case shows that and with 0xFFFF is already converted to uxth, so it is not handled here. ChangeLog: 2010-11-07 Wei Guozhi * config/arm/arm.md (andsi3): Call gen_thumb2_zero_extendqisi2_v6 o= nly when the target is TARGET_THUMB2. Index: arm.md =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- arm.md (revision 165492) +++ arm.md (working copy) @@ -2015,7 +2015,7 @@ { if (GET_CODE (operands[2]) =3D=3D CONST_INT) { - if (INTVAL (operands[2]) =3D=3D 255 && arm_arch6) + if (INTVAL (operands[2]) =3D=3D 255 && TARGET_THUMB2 && arm_arch6) { operands[1] =3D convert_to_mode (QImode, operands[1], 1); emit_insn (gen_thumb2_zero_extendqisi2_v6 (operands[0],