This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Extend widening_mul pass to handle fixed-point types


On Mon, 2010-07-19 at 23:53 +0200, Bernd Schmidt wrote:
> That's pretty much what I had in mind.  Ok if it passes testing.

This broke bootstraps on arm-linux-gnueabi and caused
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45067 . 

Taking a brief look at it this morning, I think the problem here is that
the call to optab_for_tree_code is made with the wrong type of the
expression. The presence of a widening optab for a WIDEN_MULT_PLUS_EXPR
should be based on the type of ops->op2 rather than opnd0 because you
have something like intval0 = shortval1 * shortval2 + intval1 whereas
the expander is testing for a widening mult and plus where the results
are into a HImode value and thus effectively for a widening operation
into an HImode value.

The assert that fails is because 
gcc_assert (icode != CODE_FOR_nothing);

Something like this fixes the problem for the test-cases under question
or would you prefer something else. A full bootstrap and test is
underway.

Ok to commit if no regressions ? 

cheers
Ramana

2010-07-27  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

        PR bootstrap/45067
        * optabs.c (expand_widen_pattern_expr): Initialize
widen_pattern_optab correctly for WIDEN_MULT_PLUS_EXPR and
WIDEN_MULT_MINUS_EXPR.

Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c        (revision 162526)
+++ gcc/optabs.c        (working copy)
@@ -511,14 +511,20 @@
 
   oprnd0 = ops->op0;
   tmode0 = TYPE_MODE (TREE_TYPE (oprnd0));
-  widen_pattern_optab =
-    optab_for_tree_code (ops->code, TREE_TYPE (oprnd0), optab_default);
   if (ops->code == WIDEN_MULT_PLUS_EXPR
       || ops->code == WIDEN_MULT_MINUS_EXPR)
-    icode = (int) optab_handler (widen_pattern_optab,
+    {
+      widen_pattern_optab =
+       optab_for_tree_code (ops->code, TREE_TYPE (ops->op2),
optab_default);
+      icode = (int) optab_handler (widen_pattern_optab,
                                 TYPE_MODE (TREE_TYPE (ops->op2)));
+    }
   else
-    icode = (int) optab_handler (widen_pattern_optab, tmode0);
+    {
+      widen_pattern_optab =
+       optab_for_tree_code (ops->code, TREE_TYPE (oprnd0),
optab_default);
+      icode = (int) optab_handler (widen_pattern_optab, tmode0);
+    }
   gcc_assert (icode != CODE_FOR_nothing);
   xmode0 = insn_data[icode].operand[1].mode;
 



> 
> 
> Bernd


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]