From: Stefan Schulze Frielinghaus <[email protected]>
Combine may come up with insns of the form:
Trying 230 -> 231:
230: %cc:CCZ=unspec[r82:DF,0xfc0]TDC_INSN
231: r83:SI=unspec[%cc:CCZ]CC_TO_INT
REG_DEAD %cc:CCZ
Failed to match this instruction:
(set (reg:SI 83 [ _38 ])
(unspec:SI [
(unspec:CCZ [
(reg:DF 82 [ _37 ])
(const_int 4032 [0xfc0])
] UNSPEC_TDC_INSN)
] UNSPEC_CC_TO_INT))
where the operand for UNSPEC_CC_TO_INT is not a register. Deal with
this during s390_canonicalize_comparison.
While on it canonicalize GET_CODE (x) == REG to REG_P (x).
gcc/ChangeLog:
* config/s390/s390.cc (s390_canonicalize_comparison): Verify op0
for an UNSPEC_CC_TO_INT is a register.
---
gcc/config/s390/s390.cc | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index 955cf1ebd60..038eb57759e 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -1796,7 +1796,7 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx
*op1,
&& XINT (*op0, 1) == UNSPEC_STRCMPCC_TO_INT
&& XVECLEN (*op0, 0) == 1
&& GET_MODE (XVECEXP (*op0, 0, 0)) == CCUmode
- && GET_CODE (XVECEXP (*op0, 0, 0)) == REG
+ && REG_P (XVECEXP (*op0, 0, 0))
&& REGNO (XVECEXP (*op0, 0, 0)) == CC_REGNUM
&& *op1 == const0_rtx)
{
@@ -1823,7 +1823,7 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx
*op1,
if (GET_CODE (*op0) == UNSPEC
&& XINT (*op0, 1) == UNSPEC_CC_TO_INT
&& XVECLEN (*op0, 0) == 1
- && GET_CODE (XVECEXP (*op0, 0, 0)) == REG
+ && REG_P (XVECEXP (*op0, 0, 0))
&& REGNO (XVECEXP (*op0, 0, 0)) == CC_REGNUM
&& CONST_INT_P (*op1))
{
@@ -1859,6 +1859,7 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx
*op1,
&& GET_CODE (XEXP (*op0, 0)) == UNSPEC
&& XINT (XEXP (*op0, 0), 1) == UNSPEC_CC_TO_INT
&& XVECLEN (XEXP (*op0, 0), 0) == 1
+ && REG_P (XVECEXP (XEXP (*op0, 0), 0, 0))
&& REGNO (XVECEXP (XEXP (*op0, 0), 0, 0)) == CC_REGNUM
&& CONST_INT_P (XEXP (*op0, 1))
&& CONST_INT_P (*op1)
@@ -1882,6 +1883,7 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx
*op1,
&& GET_CODE (XEXP (*op0, 0)) == UNSPEC
&& XINT (XEXP (*op0, 0), 1) == UNSPEC_CC_TO_INT
&& XVECLEN (XEXP (*op0, 0), 0) == 1
+ && REG_P (XVECEXP (XEXP (*op0, 0), 0, 0))
&& REGNO (XVECEXP (XEXP (*op0, 0), 0, 0)) == CC_REGNUM
&& CONST_INT_P (XEXP (*op0, 1))
&& CONST_INT_P (*op1)
@@ -1918,6 +1920,7 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx
*op1,
if (GET_CODE (*op0) == UNSPEC
&& XINT (*op0, 1) == UNSPEC_CC_TO_INT
&& XVECLEN (*op0, 0) == 1
+ && REG_P (XVECEXP (*op0, 0, 0))
&& REGNO (XVECEXP (*op0, 0, 0)) == CC_REGNUM
&& CONST_INT_P (*op1))
{
--
2.54.0