diff mbox

expansion of vector shifts...

Message ID 20121116.003305.2180726158176000063.davem@redhat.com
State New
Headers show

Commit Message

David Miller Nov. 16, 2012, 5:33 a.m. UTC
From: Richard Sandiford <rdsandiford@googlemail.com>
Date: Mon, 29 Oct 2012 10:14:53 +0000

> ...given that the code is like you say written:
> 
>   if (SHIFT_COUNT_TRUNCATED)
>     {
>       if (CONST_INT_P (op1)
>         ...
>       else if (GET_CODE (op1) == SUBREG
> 	       && subreg_lowpart_p (op1)
> 	       && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1))))
> 	op1 = SUBREG_REG (op1);
>     }
> 
> INTEGRAL_MODE_P (GET_MODE (op1)) might be better than an explicit
> VECTOR_MODE_P check.  The code really doesn't make sense for anything
> other than integers.
> 
> (It amounts to the same thing in practice, of course...)

Agreed, I've just committed the following.  Thanks!
diff mbox

Patch

====================
Fix gcc.c-torture/compile/pr53410-2.c on sparc.

	* expmed.c (expand_shift_1): Don't strip non-integral SUBREGs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193547 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog | 2 ++
 gcc/expmed.c  | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9abd396..62bde4e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,7 @@ 
 2012-11-15  David S. Miller  <davem@davemloft.net>
 
+	* expmed.c (expand_shift_1): Don't strip non-integral SUBREGs.
+
 	* configure.ac: Add check for assembler SPARC4 instruction
 	support.
 	* configure: Rebuild.
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 5b697a1..8640427 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -2165,7 +2165,8 @@  expand_shift_1 (enum tree_code code, enum machine_mode mode, rtx shifted,
 		       % GET_MODE_BITSIZE (mode));
       else if (GET_CODE (op1) == SUBREG
 	       && subreg_lowpart_p (op1)
-	       && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1))))
+	       && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1)))
+	       && INTEGRAL_MODE_P (GET_MODE (op1)))
 	op1 = SUBREG_REG (op1);
     }