public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <rguenther@suse.de>
To: Hans-Peter Nilsson <hp@bitrange.com>
Cc: Eric Botcazou <ebotcazou@adacore.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Cleanup expand_shift
Date: Fri, 06 May 2011 09:39:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.00.1105061124080.810@zhemvz.fhfr.qr> (raw)
In-Reply-To: <alpine.BSF.2.00.1105052240590.56860@dair.pair.com>

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  <rguenther@suse.de>
> >
> > 	* 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  <rguenther@suse.de>

	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);
  

  reply	other threads:[~2011-05-06  9:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-03 14:42 Richard Guenther
2011-05-04 15:34 ` Eric Botcazou
2011-05-04 15:43   ` Richard Guenther
2011-05-04 16:09     ` Eric Botcazou
2011-05-04 16:10       ` Richard Guenther
2011-05-05 12:38         ` Richard Guenther
2011-05-06  4:50           ` Hans-Peter Nilsson
2011-05-06  9:39             ` Richard Guenther [this message]
2011-05-06 21:52               ` Eric Botcazou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1105061124080.810@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hp@bitrange.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).