This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Stricter invalid_e500_subreg (with jump.c:true_regnum fix)
Specifically, how about this revised patch version?
2006-11-29 Joseph Myers <joseph@codesourcery.com>
* config/rs6000/predicates.md (gpc_reg_operand): Check
invalid_e500_subreg.
* config/rs6000/rs6000.c (invalid_e500_subreg): Don't allow any
SImode subregs of SPE vectors.
* config/rs6000/rs6000.md (insv): Fail for invalid E500 subregs.
* jump.c (true_regnum): Require subregs to satisfy
subreg_offset_representable_p.
Index: gcc/jump.c
===================================================================
--- gcc/jump.c (revision 119286)
+++ gcc/jump.c (working copy)
@@ -1994,7 +1994,11 @@
if (GET_CODE (x) == SUBREG)
{
int base = true_regnum (SUBREG_REG (x));
- if (base >= 0 && base < FIRST_PSEUDO_REGISTER)
+ if (base >= 0
+ && base < FIRST_PSEUDO_REGISTER
+ && subreg_offset_representable_p (REGNO (SUBREG_REG (x)),
+ GET_MODE (SUBREG_REG (x)),
+ SUBREG_BYTE (x), GET_MODE (x)))
return base + subreg_regno_offset (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x), GET_MODE (x));
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 119286)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -2555,8 +2555,7 @@
&& GET_CODE (op) == SUBREG
&& mode == SImode
&& REG_P (SUBREG_REG (op))
- && SPE_VECTOR_MODE (GET_MODE (SUBREG_REG (op)))
- && SUBREG_BYTE (op) != 4)
+ && SPE_VECTOR_MODE (GET_MODE (SUBREG_REG (op))))
return true;
return false;
Index: gcc/config/rs6000/predicates.md
===================================================================
--- gcc/config/rs6000/predicates.md (revision 119310)
+++ gcc/config/rs6000/predicates.md (working copy)
@@ -84,10 +84,12 @@
;; Return 1 if op is a register that is not special.
(define_predicate "gpc_reg_operand"
(and (match_operand 0 "register_operand")
- (match_test "GET_CODE (op) != REG
- || (REGNO (op) >= ARG_POINTER_REGNUM
- && !XER_REGNO_P (REGNO (op)))
- || REGNO (op) < MQ_REGNO")))
+ (match_test "(GET_CODE (op) != REG
+ || (REGNO (op) >= ARG_POINTER_REGNUM
+ && !XER_REGNO_P (REGNO (op)))
+ || REGNO (op) < MQ_REGNO)
+ && !((TARGET_E500_DOUBLE || TARGET_SPE)
+ && invalid_e500_subreg (op, mode))")))
;; Return 1 if op is a register that is a condition register field.
(define_predicate "cc_reg_operand"
Index: gcc/config/rs6000/rs6000.md
===================================================================
--- gcc/config/rs6000/rs6000.md (revision 119310)
+++ gcc/config/rs6000/rs6000.md (working copy)
@@ -2856,9 +2856,12 @@
{
/* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
- compiler if the address of the structure is taken later. */
+ compiler if the address of the structure is taken later. Likewise, do
+ not handle invalid E500 subregs. */
if (GET_CODE (operands[0]) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
+ && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
+ || ((TARGET_E500_DOUBLE || TARGET_SPE)
+ && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
FAIL;
if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
--
Joseph S. Myers
joseph@codesourcery.com