From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29501 invoked by alias); 6 May 2011 09:27:25 -0000 Received: (qmail 29487 invoked by uid 22791); 6 May 2011 09:27:23 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 May 2011 09:27:09 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 9A5FA867E2; Fri, 6 May 2011 11:27:07 +0200 (CEST) Date: Fri, 06 May 2011 09:39:00 -0000 From: Richard Guenther To: Hans-Peter Nilsson Cc: Eric Botcazou , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Cleanup expand_shift In-Reply-To: Message-ID: References: <201105041732.49116.ebotcazou@adacore.com> <201105041805.43662.ebotcazou@adacore.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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-05/txt/msg00492.txt.bz2 On Thu, 5 May 2011, Hans-Peter Nilsson wrote: > On Thu, 5 May 2011, Richard Guenther wrote: > > On Wed, 4 May 2011, Richard Guenther wrote: > > > On Wed, 4 May 2011, Eric Botcazou wrote: > > > Hm. I guess people will scream if something breaks (I can't imagine > > > what though). > > AAAaaarghh! Building cris-elf is now broken. > > > I have applied the following after re-bootstrapping and testing on > > x86_64-unknown-linux-gnu and re-checking the mipsel cross testcase. > > > > Richard. > > > > 2011-05-05 Richard Guenther > > > > * expmed.c (expand_variable_shift): Rename to ... > > (expand_shift_1): ... this. Take an expanded shift amount. > > For rotates recurse directly not building trees for the shift amount. > > (expand_variable_shift): Wrap around expand_shift_1. > > (expand_shift): Adjust. > > PR 48908. Ok, it seems simplify_gen_binary doesn't like VOIDmode. The following side-steps the issue of choosing an appropriate mode for a constant shift amount and instead computes it in HWI. Similar to the SHIFT_COUNT_TRUNCATED path we don't bother about a CONST_DOUBLE shift amount. I'm going to bootstrap & regtest this on x86_64-unknown-linux-gnu (with again zero testing coverage ...). The patch fixes the reported ICE with a cross to cris-elf, more testing is appreciated (though I guess autotesters will pick it up). Does it look sane? Thanks, Richard. 2011-05-06 Richard Guenther PR middle-end/48908 * expmed.c (expand_shift_1): Compute adjusted constant shift amount manually. Index: gcc/expmed.c =================================================================== *** gcc/expmed.c (revision 173473) --- gcc/expmed.c (working copy) *************** expand_shift_1 (enum tree_code code, enu *** 2141,2151 **** rtx new_amount, other_amount; rtx temp1; new_amount = op1; ! other_amount ! = simplify_gen_binary (MINUS, GET_MODE (op1), ! GEN_INT (GET_MODE_BITSIZE (mode)), ! op1); shifted = force_reg (mode, shifted); --- 2141,2156 ---- rtx new_amount, other_amount; rtx temp1; + op1_mode = GET_MODE (op1); new_amount = op1; ! if (op1_mode == VOIDmode) ! other_amount = GEN_INT (GET_MODE_BITSIZE (mode) ! - INTVAL (op1)); ! else ! other_amount ! = simplify_gen_binary (MINUS, op1_mode, ! GEN_INT (GET_MODE_BITSIZE (mode)), ! op1); shifted = force_reg (mode, shifted);