public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
To: Bernd Schmidt <bernds@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com
Subject: Re: Extend widening_mul pass to handle fixed-point types
Date: Tue, 27 Jul 2010 12:28:00 -0000	[thread overview]
Message-ID: <1280233130.18689.17.camel@e102325-lin.cambridge.arm.com> (raw)
In-Reply-To: <4C44C948.3050801@codesourcery.com>


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

  reply	other threads:[~2010-07-27 12:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-18 12:03 Richard Sandiford
2010-07-18 20:47 ` Bernd Schmidt
2010-07-19 18:35   ` Richard Sandiford
2010-07-19 21:53     ` Bernd Schmidt
2010-07-27 12:28       ` Ramana Radhakrishnan [this message]
2010-07-27 15:54         ` Bernd Schmidt
2010-07-27 17:10           ` Ramana Radhakrishnan
2010-07-28 15:43           ` Ramana Radhakrishnan
2010-07-28 21:20             ` Richard Sandiford
2010-07-29 10:39               ` Ramana Radhakrishnan
2010-07-31  9:45                 ` Richard Sandiford
2010-07-31  9:45               ` Richard Sandiford
2010-07-31 13:03                 ` Bernd Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280233130.18689.17.camel@e102325-lin.cambridge.arm.com \
    --to=ramana.radhakrishnan@arm.com \
    --cc=bernds@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rdsandiford@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).