aboutsummaryrefslogtreecommitdiff
path: root/gcc/read-rtl.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-05-31 16:27:49 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-05-31 16:27:49 +0000
commitf4fde1b378ad68fb2dec6719ed26c1b901488e03 (patch)
treea6089ff5ae9f140f131b42e288966eb32e0b353c /gcc/read-rtl.c
parentb1bb4869e2708c1385352e4d960833e1b258859b (diff)
downloadgcc-f4fde1b378ad68fb2dec6719ed26c1b901488e03.zip
gcc-f4fde1b378ad68fb2dec6719ed26c1b901488e03.tar.gz
gcc-f4fde1b378ad68fb2dec6719ed26c1b901488e03.tar.bz2
New .md construct: define_insn_and_rewrite
Several SVE patterns need define_insn_and_splits that generate the same insn_code, but with different operands. That's probably a niche requirement, but it's cropping up often enough on the ACLE branch that I think it would be good to have a syntactic sugar for it. This patch therefore adds a new construct called define_insn_and_rewrite. It's basically a define_insn_and_split with an implicit split pattern, obtained by copying the insn pattern and replacing match_operands with match_dups and match_operators with match_op_dups. 2019-05-31 Richard Sandiford <richard.sandiford@arm.com> gcc/ * doc/md.texi: Document define_insn_and_rewrite. * rtl.def (DEFINE_INSN_AND_REWRITE): New rtx code. * gensupport.c (queue_elem): Update comment. (replace_operands_with_dups): New function. (gen_rewrite_sequence): Likewise. (process_rtx): Handle DEFINE_INSN_AND_REWRITE. * read-rtl.c (apply_subst_iterator): Likewise. (add_condition_to_rtx, named_rtx_p): Likewise. (rtx_reader::read_rtx_operand): Likewise. * config/aarch64/aarch64-sve.md (while_ult<GPI:mode><PRED_ALL:mode>_cc): Rename to... (*while_ult<GPI:mode><PRED_ALL:mode>_cc): ...this and use define_insn_and_rewrite. (*cond_<optab><mode>_any): Turn into define_insn_and_rewrites. Remove separate define_split. From-SVN: r271815
Diffstat (limited to 'gcc/read-rtl.c')
-rw-r--r--gcc/read-rtl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c
index f72b2c3..f37708f 100644
--- a/gcc/read-rtl.c
+++ b/gcc/read-rtl.c
@@ -286,9 +286,11 @@ apply_subst_iterator (rtx rt, unsigned int, int value)
return;
gcc_assert (GET_CODE (rt) == DEFINE_INSN
|| GET_CODE (rt) == DEFINE_INSN_AND_SPLIT
+ || GET_CODE (rt) == DEFINE_INSN_AND_REWRITE
|| GET_CODE (rt) == DEFINE_EXPAND);
- int attrs = GET_CODE (rt) == DEFINE_INSN_AND_SPLIT ? 7 : 4;
+ int attrs = (GET_CODE (rt) == DEFINE_INSN_AND_SPLIT ? 7
+ : GET_CODE (rt) == DEFINE_INSN_AND_REWRITE ? 6 : 4);
attrs_vec = XVEC (rt, attrs);
/* If we've already added attribute 'current_iterator_name', then we
@@ -549,6 +551,7 @@ add_condition_to_rtx (rtx x, const char *extra)
break;
case DEFINE_INSN_AND_SPLIT:
+ case DEFINE_INSN_AND_REWRITE:
XSTR (x, 2) = add_condition_to_string (XSTR (x, 2), extra);
XSTR (x, 4) = add_condition_to_string (XSTR (x, 4), extra);
break;
@@ -632,6 +635,7 @@ named_rtx_p (rtx x)
case DEFINE_EXPAND:
case DEFINE_INSN:
case DEFINE_INSN_AND_SPLIT:
+ case DEFINE_INSN_AND_REWRITE:
return true;
default:
@@ -1837,8 +1841,8 @@ rtx_reader::read_rtx_operand (rtx return_rtx, int idx)
break;
}
- /* The output template slot of a DEFINE_INSN,
- DEFINE_INSN_AND_SPLIT, or DEFINE_PEEPHOLE automatically
+ /* The output template slot of a DEFINE_INSN, DEFINE_INSN_AND_SPLIT,
+ DEFINE_INSN_AND_REWRITE or DEFINE_PEEPHOLE automatically
gets a star inserted as its first character, if it is
written with a brace block instead of a string constant. */
star_if_braced = (format_ptr[idx] == 'T');
@@ -1855,7 +1859,8 @@ rtx_reader::read_rtx_operand (rtx return_rtx, int idx)
if (*stringbuf == '\0'
&& idx == 0
&& (GET_CODE (return_rtx) == DEFINE_INSN
- || GET_CODE (return_rtx) == DEFINE_INSN_AND_SPLIT))
+ || GET_CODE (return_rtx) == DEFINE_INSN_AND_SPLIT
+ || GET_CODE (return_rtx) == DEFINE_INSN_AND_REWRITE))
{
struct obstack *string_obstack = get_string_obstack ();
char line_name[20];