+2018-12-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/88188
+ * config/rs6000/rs6000.c (ccr_bit): Return -1 instead of assertion
+ failures.
+ (print_operand): Use REG_P instead of GET_CODE == REG.
+ <case 'D'>: Also check CR_REGNO_P (REGNO (x)).
+ <case 't'>: Likewise. Remove GET_MODE check.
+ * config/rs6000/rs6000.md (scc patterns): Assert ccr_bit didn't
+ return -1.
+
2018-12-04 Martin Sebor <msebor@redhat.com>
* doc/extend.texi (attribute aligned): Expand.
reg = XEXP (op, 0);
- gcc_assert (GET_CODE (reg) == REG && CR_REGNO_P (REGNO (reg)));
+ if (!REG_P (reg) || !CR_REGNO_P (REGNO (reg)))
+ return -1;
cc_mode = GET_MODE (reg);
cc_regnum = REGNO (reg);
/* When generating a sCOND operation, only positive conditions are
allowed. */
- gcc_assert (!scc_p
- || code == EQ || code == GT || code == LT || code == UNORDERED
- || code == GTU || code == LTU);
+ if (scc_p)
+ switch (code)
+ {
+ case EQ:
+ case GT:
+ case LT:
+ case UNORDERED:
+ case GTU:
+ case LTU:
+ break;
+ default:
+ return -1;
+ }
switch (code)
{
return scc_p ? base_bit + 3 : base_bit + 1;
default:
- gcc_unreachable ();
+ return -1;
}
}
\f
case 'D':
/* Like 'J' but get to the GT bit only. */
- if (!REG_P (x))
+ if (!REG_P (x) || !CR_REGNO_P (REGNO (x)))
{
output_operand_lossage ("invalid %%D value");
return;
case 'E':
/* X is a CR register. Print the number of the EQ bit of the CR */
- if (GET_CODE (x) != REG || ! CR_REGNO_P (REGNO (x)))
+ if (!REG_P (x) || !CR_REGNO_P (REGNO (x)))
output_operand_lossage ("invalid %%E value");
else
fprintf (file, "%d", 4 * (REGNO (x) - CR0_REGNO) + 2);
case 'f':
/* X is a CR register. Print the shift count needed to move it
to the high-order four bits. */
- if (GET_CODE (x) != REG || ! CR_REGNO_P (REGNO (x)))
+ if (!REG_P (x) || !CR_REGNO_P (REGNO (x)))
output_operand_lossage ("invalid %%f value");
else
fprintf (file, "%d", 4 * (REGNO (x) - CR0_REGNO));
case 'F':
/* Similar, but print the count for the rotate in the opposite
direction. */
- if (GET_CODE (x) != REG || ! CR_REGNO_P (REGNO (x)))
+ if (!REG_P (x) || !CR_REGNO_P (REGNO (x)))
output_operand_lossage ("invalid %%F value");
else
fprintf (file, "%d", 32 - 4 * (REGNO (x) - CR0_REGNO));
case 'R':
/* X is a CR register. Print the mask for `mtcrf'. */
- if (GET_CODE (x) != REG || ! CR_REGNO_P (REGNO (x)))
+ if (!REG_P (x) || !CR_REGNO_P (REGNO (x)))
output_operand_lossage ("invalid %%R value");
else
fprintf (file, "%d", 128 >> (REGNO (x) - CR0_REGNO));
case 't':
/* Like 'J' but get to the OVERFLOW/UNORDERED bit. */
- if (!REG_P (x) || GET_MODE (x) != CCmode)
+ if (!REG_P (x) || !CR_REGNO_P (REGNO (x)))
{
output_operand_lossage ("invalid %%t value");
return;