From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7499 invoked by alias); 23 Aug 2011 13:53:55 -0000 Received: (qmail 7489 invoked by uid 22791); 23 Aug 2011 13:53:54 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mo-p00-ob.rzone.de (HELO mo-p00-ob.rzone.de) (81.169.146.160) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Aug 2011 13:53:39 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT2k715jHQaJercGObUOFkj18odoYNahU4Q== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.22] (business-188-111-022-002.static.arcor-ip.net [188.111.22.2]) by post.strato.de (mrclete mo3) (RZmta 26.2) with ESMTPA id g024f6n7NCuxGP ; Tue, 23 Aug 2011 15:53:00 +0200 (MEST) Message-ID: <4E53B0BA.5030309@gjlay.de> Date: Tue, 23 Aug 2011 14:54:00 -0000 From: Georg-Johann Lay User-Agent: Thunderbird 2.0.0.24 (X11/20100302) MIME-Version: 1.0 To: Jakub Jelinek CC: Bernd Schmidt , Eric Botcazou , Richard Sandiford , Richard Henderson , GCC Patches Subject: Re: [PATCH] For FFS/CLZ/CTZ/CLRSB/POPCOUNT/PARITY/BSWAP require operand mode equal to operation mode (or VOIDmode) (PR middle-end/50161) References: <4DF9FA9A.8040505@codesourcery.com> <4DFA2E85.2030601@redhat.com> <4DFFA1AE.7070405@codesourcery.com> <20110823090549.GC2687@tyan-ft48-01.lab.bos.redhat.com> <4E53744B.6040502@codesourcery.com> <20110823095243.GD2687@tyan-ft48-01.lab.bos.redhat.com> <4E5379A6.1020905@codesourcery.com> <20110823120605.GE2687@tyan-ft48-01.lab.bos.redhat.com> In-Reply-To: <20110823120605.GE2687@tyan-ft48-01.lab.bos.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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: 2011-08/txt/msg01892.txt.bz2 Jakub Jelinek wrote: > On Tue, Aug 23, 2011 at 11:57:58AM +0200, Bernd Schmidt wrote: >> On 08/23/11 11:52, Jakub Jelinek wrote: >>> On Tue, Aug 23, 2011 at 11:35:07AM +0200, Bernd Schmidt wrote: >>>>> cse_process_notes_1 >>>>> perhaps could be changed for VOIDmode new_rtx to try to >>>>> simplify_replace_rtx it... >>>> Is this where the problem came from? Sounds like it's worth a try. >>> In this case, yes. But there are many other places all around the >>> compiler that need to disallow unary op with VOIDmode operand. >>> In cse.c alone e.g. fold_rtx (twice), in combine.c e.g. in do_SUBST, >>> subst, etc. Do we want to special case all those 7 unary ops there too? >>> Is it really worth it to save one subreg or truncate in the md patterns >>> for rarely used rtxes? >> Maybe not. I'll approve a patch to change it back, even if I think it's >> not a good representation. > > We can remove that restriction again once CONST_INTs are no longer VOIDmode. > > Here is an untested patch, will bootstrap/regtest it now on x86_64-linux > and i686-linux, on c6x it should make no difference IMHO (looked like a typo > in the expander which wasn't used anyway), can somebody test it on AVR and Tested you patch against r177949 on avr-unknown-none for C/C++. There are no regressions and the new test case passes fine. Johann > BFIN? My grepping through *.md didn't find any other places where the > operand wouldn't have the same mode as operation. > > 2011-08-23 Jakub Jelinek > > PR middle-end/50161 > * simplify-rtx.c (simplify_const_unary_operation): If > op is CONST_INT, don't look at op_mode, but use instead > mode. > * optabs.c (add_equal_note): For FFS, CLZ, CTZ, > CLRSB, POPCOUNT, PARITY and BSWAP use operand mode for > operation and TRUNCATE/ZERO_EXTEND if needed. > * doc/rtl.texi (ffs, clrsb, clz, ctz, popcount, parity, bswap): > Document that operand mode must be same as operation mode, > or VOIDmode. > * config/avr/avr.md (paritysi2, *parityqihi2.libgcc, > *paritysihi2.libgcc, popcountsi2, *popcountsi2.libgcc, > *popcountqihi2.libgcc, clzsi2, *clzsihi2.libgcc, ctzsi2, > *ctzsihi2.libgcc, ffssi2, *ffssihi2.libgcc): For unary ops > use the mode of operand for the operation and add truncate > or zero_extend around if needed. > * config/c6x/c6x.md (ctzdi2): Likewise. > * config/bfin/bfin.md (clrsbsi2, signbitssi2): Likewise. > > * gcc.dg/pr50161.c: New test.