summaryrefslogtreecommitdiff
path: root/gcc/genemit.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-02 09:19:28 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-02 09:19:28 +0000
commit0f7b96100726743d382b0dd7d9ec41ee4e375a19 (patch)
tree9bdb7b7a6aa1ef3d390e533d7e1b59fb6cab5053 /gcc/genemit.c
parent024143e3591ae38b399bf6fd2d54e62ebfc1265c (diff)
downloadgcc-0f7b96100726743d382b0dd7d9ec41ee4e375a19.tar.gz
PR tree-optimization/79345
* gensupport.h (struct pattern_stats): Add min_scratch_opno field. * gensupport.c (get_pattern_stats_1) <case MATCH_SCRATCH>: Update it. (get_pattern_stats): Initialize it. * genemit.c (gen_expand): Verify match_scratch numbers come after match_operand/match_dup numbers. * config/i386/i386.md (<s>mul<mode>3_highpart): Swap match_dup and match_scratch numbers. * config/i386/sse.md (avx2_gathersi<mode>, avx2_gatherdi<mode>): Likewise. * config/s390/s390.md (trunctdsd2): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245833 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genemit.c')
-rw-r--r--gcc/genemit.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 4ef29e9f216..7bf745d1727 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -448,6 +448,10 @@ gen_expand (md_rtx_info *info)
/* Find out how many operands this function has. */
get_pattern_stats (&stats, XVEC (expand, 1));
+ if (stats.min_scratch_opno != -1
+ && stats.min_scratch_opno <= MAX (stats.max_opno, stats.max_dup_opno))
+ fatal_at (info->loc, "define_expand for %s needs to have match_scratch "
+ "numbers above all other operands", XSTR (expand, 0));
/* Output the function name and argument declarations. */
printf ("rtx\ngen_%s (", XSTR (expand, 0));
@@ -479,8 +483,6 @@ gen_expand (md_rtx_info *info)
make a local variable. */
for (i = stats.num_generator_args; i <= stats.max_dup_opno; i++)
printf (" rtx operand%d;\n", i);
- for (; i <= stats.max_scratch_opno; i++)
- printf (" rtx operand%d ATTRIBUTE_UNUSED;\n", i);
printf (" rtx_insn *_val = 0;\n");
printf (" start_sequence ();\n");
@@ -516,7 +518,7 @@ gen_expand (md_rtx_info *info)
(unless we aren't going to use them at all). */
if (XVEC (expand, 1) != 0)
{
- for (i = 0; i < stats.num_operand_vars; i++)
+ for (i = 0; i <= MAX (stats.max_opno, stats.max_dup_opno); i++)
{
printf (" operand%d = operands[%d];\n", i, i);
printf (" (void) operand%d;\n", i);