aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-03-02 10:19:28 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-03-02 10:19:28 +0100
commitd5a216fa21f6c67e75a91b7063d1767cff00138b (patch)
tree9bdb7b7a6aa1ef3d390e533d7e1b59fb6cab5053 /gcc
parentda403f3178095ddf49c62994874f52650e3f5a4a (diff)
downloadgcc-d5a216fa21f6c67e75a91b7063d1767cff00138b.zip
gcc-d5a216fa21f6c67e75a91b7063d1767cff00138b.tar.gz
gcc-d5a216fa21f6c67e75a91b7063d1767cff00138b.tar.bz2
re PR tree-optimization/79345 (passing yet-uninitialized member as argument to base class constructor should warn (-Wunitialized))
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. From-SVN: r245833
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/config/i386/i386.md6
-rw-r--r--gcc/config/i386/sse.md12
-rw-r--r--gcc/config/s390/s390.md8
-rw-r--r--gcc/genemit.c8
-rw-r--r--gcc/gensupport.c5
-rw-r--r--gcc/gensupport.h3
7 files changed, 39 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5bd3094..0909183 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2017-03-02 Jakub Jelinek <jakub@redhat.com>
+
+ 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.
+
2017-03-02 Richard Biener <rguenther@suse.de>
* wide-int.h (wide_int_storage::operator=): Implement in terms
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 23f2ea0..f23c2d54 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -7364,11 +7364,11 @@
(match_operand:SWI48 1 "nonimmediate_operand"))
(any_extend:<DWI>
(match_operand:SWI48 2 "register_operand")))
- (match_dup 4))))
- (clobber (match_scratch:SWI48 3))
+ (match_dup 3))))
+ (clobber (match_scratch:SWI48 4))
(clobber (reg:CC FLAGS_REG))])]
""
- "operands[4] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));")
+ "operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));")
(define_insn "*<s>muldi3_highpart_1"
[(set (match_operand:DI 0 "register_operand" "=d")
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index c69bcfe..a6f1de7 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -18873,7 +18873,7 @@
(unspec:VEC_GATHER_MODE
[(match_operand:VEC_GATHER_MODE 1 "register_operand")
(mem:<ssescalarmode>
- (match_par_dup 7
+ (match_par_dup 6
[(match_operand 2 "vsib_address_operand")
(match_operand:<VEC_GATHER_IDXSI>
3 "register_operand")
@@ -18881,10 +18881,10 @@
(mem:BLK (scratch))
(match_operand:VEC_GATHER_MODE 4 "register_operand")]
UNSPEC_GATHER))
- (clobber (match_scratch:VEC_GATHER_MODE 6))])]
+ (clobber (match_scratch:VEC_GATHER_MODE 7))])]
"TARGET_AVX2"
{
- operands[7]
+ operands[6]
= gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
operands[5]), UNSPEC_VSIBADDR);
})
@@ -18934,7 +18934,7 @@
(unspec:VEC_GATHER_MODE
[(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
(mem:<ssescalarmode>
- (match_par_dup 7
+ (match_par_dup 6
[(match_operand 2 "vsib_address_operand")
(match_operand:<VEC_GATHER_IDXDI>
3 "register_operand")
@@ -18942,10 +18942,10 @@
(mem:BLK (scratch))
(match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
UNSPEC_GATHER))
- (clobber (match_scratch:VEC_GATHER_MODE 6))])]
+ (clobber (match_scratch:VEC_GATHER_MODE 7))])]
"TARGET_AVX2"
{
- operands[7]
+ operands[6]
= gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
operands[5]), UNSPEC_VSIBADDR);
})
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index cbf8c0a..7d2659e 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -5074,15 +5074,15 @@
(define_expand "trunctdsd2"
[(parallel
- [(set (match_dup 3)
+ [(set (match_dup 2)
(float_truncate:DD (match_operand:TD 1 "register_operand" "")))
(unspec:DI [(const_int DFP_RND_PREP_FOR_SHORT_PREC)] UNSPEC_ROUND)
- (clobber (match_scratch:TD 2 ""))])
+ (clobber (match_scratch:TD 3 ""))])
(set (match_operand:SD 0 "register_operand" "")
- (float_truncate:SD (match_dup 3)))]
+ (float_truncate:SD (match_dup 2)))]
"TARGET_HARD_DFP"
{
- operands[3] = gen_reg_rtx (DDmode);
+ operands[2] = gen_reg_rtx (DDmode);
})
;
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 4ef29e9..7bf745d 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);
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index cef0a0c..874e677 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -3000,6 +3000,10 @@ get_pattern_stats_1 (struct pattern_stats *stats, rtx x)
break;
case MATCH_SCRATCH:
+ if (stats->min_scratch_opno == -1)
+ stats->min_scratch_opno = XINT (x, 0);
+ else
+ stats->min_scratch_opno = MIN (stats->min_scratch_opno, XINT (x, 0));
stats->max_scratch_opno = MAX (stats->max_scratch_opno, XINT (x, 0));
break;
@@ -3032,6 +3036,7 @@ get_pattern_stats (struct pattern_stats *stats, rtvec pattern)
stats->max_opno = -1;
stats->max_dup_opno = -1;
+ stats->min_scratch_opno = -1;
stats->max_scratch_opno = -1;
stats->num_dups = 0;
diff --git a/gcc/gensupport.h b/gcc/gensupport.h
index 693166f..5db6b0f 100644
--- a/gcc/gensupport.h
+++ b/gcc/gensupport.h
@@ -199,7 +199,8 @@ struct pattern_stats
/* The largest match_dup, match_op_dup or match_par_dup number found. */
int max_dup_opno;
- /* The largest match_scratch number found. */
+ /* The smallest and largest match_scratch number found. */
+ int min_scratch_opno;
int max_scratch_opno;
/* The number of times match_dup, match_op_dup or match_par_dup appears