From patchwork Mon Oct 8 02:15:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 189880 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 64CED2C00D9 for ; Mon, 8 Oct 2012 13:16:22 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1350267383; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:Content-Transfer-Encoding:Mime-Version:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=yMUpoFCBzg3oSSFvQ/Brmg4/XJk=; b=GTJYb6NR93GysgXiHbV6onm16RsrrFnAb8PTOUv3c/fp/PHQV/Z2Hq1gqj1MQ2 3nkmgOE2XWZKQ0JVAZTKPLG2h7beAZGyvEV8oEErOxoCQfOkpkoPlvrGzqKkkiij rZ1aBTkZ8HOoLYrUMMoSEGcQeSINziV4Q05BFsNmTKOCg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=o1NavlUKVVYj27WSIhyk1YmcuikvBuJCst0duS5YaN+tsXXUKnsKsIwOEqu/x+ 8zV5x0XAMaCnl7/B+yls6MabXMDj35QUOI41PGzfg7UjqPL7KVFr2ezpvuc778Sr oFsJK3atQhlfs9KlJAy7c4QcfGNWs59ztCDPXE8r4ocVA=; Received: (qmail 24578 invoked by alias); 8 Oct 2012 02:16:15 -0000 Received: (qmail 24526 invoked by uid 22791); 8 Oct 2012 02:16:13 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout01.t-online.de (HELO mailout01.t-online.de) (194.25.134.80) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Oct 2012 02:16:07 +0000 Received: from fwd54.aul.t-online.de (fwd54.aul.t-online.de ) by mailout01.t-online.de with smtp id 1TL2t3-0001wD-Bl; Mon, 08 Oct 2012 04:16:05 +0200 Received: from [192.168.0.100] (TtwnivZrohlKg7pQiCiOtIgOsXSNk79lG+uJmh2x8Rf7e9jAd3OhZsJ+MhFC5qpZGS@[93.218.177.229]) by fwd54.t-online.de with esmtp id 1TL2sv-1p47nM0; Mon, 8 Oct 2012 04:15:57 +0200 Message-ID: <1349662554.21984.32.camel@yam-132-YW-E178-FTW> Subject: Re: [SH] PR 54685 - unsigned int comparison with 0x7FFFFFFF From: Oleg Endo To: Kaz Kojima Cc: gcc-patches@gcc.gnu.org Date: Mon, 08 Oct 2012 04:15:54 +0200 In-Reply-To: <1349661200.21984.29.camel@yam-132-YW-E178-FTW> References: <1349522019.9306.302.camel@yam-132-YW-E178-FTW> <20121008.094547.474755276.kkojima@rr.iij4u.or.jp> <1349661200.21984.29.camel@yam-132-YW-E178-FTW> Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Mon, 2012-10-08 at 03:53 +0200, Oleg Endo wrote: > On Mon, 2012-10-08 at 09:45 +0900, Kaz Kojima wrote: > > Oleg Endo wrote: > > > The attached patch improves comparisons such as > > > 'unsigned int <= 0x7FFFFFFF' on SH. > > > As mentioned in the PR, for some reason, those comparisons do not go > > > through the cstore expander. As a consequence the comparison doesn't > > > get the chance to be canonicalized by the target code and ends up as > > > '(~x) >> 31'. > > > I've not investigated this further and just fixed the symptoms on SH. I > > > don't know whether it's also an issue on other targets. > > > > > > Tested on rev 192142 with > > > make -k check RUNTESTFLAGS="--target_board=sh-sim > > > \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}" > > > > > > and no new failures. > > > OK? > > > > I've run CSiBE with and without the patch for sh4-unknown-linux-gnu > > at -O2. Only one difference in the resulted sizes: jpeg-6b/jcphuff > > increases 5336 bytes to 5340 bytes with the patch. Could you look > > into it? > > Yep, that's actually the only place in the CSiBE set where this case > hits. The function in question is encode_mcu_AC_refine. The increase > seems to be due to different register allocation and different spill > code :T > I've attached the asm diff. I've just checked this against current trunk (rev 192193). The problem seems to be gone. There's also a total decrease of 152 bytes on this file without the patch. So it seems it was a different issue. The diff is now: Cheers, Oleg --- CSiBE/m4-single-ml-O2/jpeg-6b/jcphuff_.s +++ CSiBE/m4-single-ml-O2/jpeg-6b/jcphuff.s @@ -2626,13 +2626,12 @@ add r0,r0 mov.l r3,@(24,r13) bf/s .L502 - mov.w @(r0,r1),r11 + mov.w @(r0,r1),r7 mov.l @(12,r15),r0 - not r11,r11 - shll r11 + cmp/pz r7 mov.l @(12,r15),r10 + movt r11 neg r0,r2 - movt r11 add #23,r2 shld r2,r11 add #1,r10