Patchwork [1/3] Fix 0 != CODE_FOR_nothing thinko

login
register
mail settings
Submitter Richard Henderson
Date July 19, 2012, 6:52 p.m.
Message ID <1342723978-30066-1-git-send-email-rth@redhat.com>
Download mbox | patch
Permalink /patch/172025/
State New
Headers show

Comments

Richard Henderson - July 19, 2012, 6:52 p.m.
I discovered the vectorizable_operation while trying to figure out why
ia64 wasn't generating the mul_highpart pattern as I expected: we always
force CODE_FOR_nothing to 0.  Oops.

The change to expr.c was just to satisfy the grep I did to make sure
there were not other occurrences of a similar problem.


r~


        * expr.c (store_constructor): Initialize icode with CODE_FOR_nothing.
        * tree-vect-stmts.c (vectorizable_operation): Use LAST_INSN_CODE for
        dummy != CODE_FOR_nothing value.
---
 gcc/ChangeLog         |    6 ++++++
 gcc/expr.c            |    2 +-
 gcc/tree-vect-stmts.c |    2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)
Jakub Jelinek - July 19, 2012, 8:35 p.m.
On Thu, Jul 19, 2012 at 11:52:56AM -0700, Richard Henderson wrote:
> I discovered the vectorizable_operation while trying to figure out why
> ia64 wasn't generating the mul_highpart pattern as I expected: we always
> force CODE_FOR_nothing to 0.  Oops.

icode = 0; was chosen as something that wouldn't match a real insn, yet was
different from CODE_FOR_nothing.  CODE_FOR_nothing changed to 0 only
10 days ago...  Thanks for spotting this.

	Jakub
Richard Henderson - July 19, 2012, 8:48 p.m.
On 07/19/2012 01:35 PM, Jakub Jelinek wrote:
> On Thu, Jul 19, 2012 at 11:52:56AM -0700, Richard Henderson wrote:
>> I discovered the vectorizable_operation while trying to figure out why
>> ia64 wasn't generating the mul_highpart pattern as I expected: we always
>> force CODE_FOR_nothing to 0.  Oops.
> 
> icode = 0; was chosen as something that wouldn't match a real insn, yet was
> different from CODE_FOR_nothing.  CODE_FOR_nothing changed to 0 only
> 10 days ago...  Thanks for spotting this.

Ah, good.  I thought I was just going crazy remembering C_F_N != 0.
I havn't gotten back as far as Steven's patch in my post-vacation mail queue yet...


r~

Patch

diff --git a/gcc/expr.c b/gcc/expr.c
index 5aec53e..9650863 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6130,7 +6130,7 @@  store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
 	constructor_elt *ce;
 	int i;
 	int need_to_clear;
-	int icode = 0;
+	int icode = CODE_FOR_nothing;
 	tree elttype = TREE_TYPE (type);
 	int elt_size = tree_low_cst (TYPE_SIZE (elttype), 1);
 	enum machine_mode eltmode = TYPE_MODE (elttype);
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index fb05063..bb42cbc 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -3531,7 +3531,7 @@  vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
   if (code == MULT_HIGHPART_EXPR)
     {
       if (can_mult_highpart_p (vec_mode, TYPE_UNSIGNED (vectype)))
-	icode = 0;
+	icode = LAST_INSN_CODE;
       else
 	icode = CODE_FOR_nothing;
     }