aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2018-01-03 07:18:38 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-01-03 07:18:38 +0000
commit00224b1a7642e7e35c0ae080ec93caff1ddd4faf (patch)
tree89b96524133cfefe0f1a3fd01d2aab484841fc3d
parent4871e1ed1728da22d48cfad1cb25a0a37f65d1bc (diff)
downloadgcc-00224b1a7642e7e35c0ae080ec93caff1ddd4faf.zip
gcc-00224b1a7642e7e35c0ae080ec93caff1ddd4faf.tar.gz
gcc-00224b1a7642e7e35c0ae080ec93caff1ddd4faf.tar.bz2
poly_int: process_alt_operands
This patch makes process_alt_operands check that the mode sizes are ordered, so that match_reload can validly treat them as subregs of one another. 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * lra-constraints.c (process_alt_operands): Reject matched operands whose sizes aren't ordered. (match_reload): Refer to this check here. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r256158
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/lra-constraints.c9
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2eea29b..799be1c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -2,6 +2,14 @@
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
+ * lra-constraints.c (process_alt_operands): Reject matched
+ operands whose sizes aren't ordered.
+ (match_reload): Refer to this check here.
+
+2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
+ Alan Hayward <alan.hayward@arm.com>
+ David Sherwood <david.sherwood@arm.com>
+
* builtins.c (expand_ifn_atomic_compare_exchange_into_call): Assert
that the mode size is in the set {1, 2, 4, 8, 16}.
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 73ffba2..59daf11 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -933,6 +933,8 @@ match_reload (signed char out, signed char *ins, signed char *outs,
push_to_sequence (*before);
if (inmode != outmode)
{
+ /* process_alt_operands has already checked that the mode sizes
+ are ordered. */
if (partial_subreg_p (outmode, inmode))
{
reg = new_in_reg
@@ -2112,6 +2114,13 @@ process_alt_operands (int only_alternative)
len = 0;
lra_assert (nop > m);
+ /* Reject matches if we don't know which operand is
+ bigger. This situation would arguably be a bug in
+ an .md pattern, but could also occur in a user asm. */
+ if (!ordered_p (GET_MODE_SIZE (biggest_mode[m]),
+ GET_MODE_SIZE (biggest_mode[nop])))
+ break;
+
this_alternative_matches = m;
m_hregno = get_hard_regno (*curr_id->operand_loc[m], false);
/* We are supposed to match a previous operand.