public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amodra at bigpond dot net dot au" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/16800] PowerPC - Unnecessary rldicl
Date: Wed, 24 Nov 2004 07:00:00 -0000	[thread overview]
Message-ID: <20041124070017.9553.qmail@sourceware.org> (raw)
In-Reply-To: <20040728170038.16800.steinmtz@us.ibm.com>


------- Additional Comments From amodra at bigpond dot net dot au  2004-11-24 07:00 -------
I believe this problem is caused by rs6000_rtx_costs.  The two following insns
are successfully combined:

(insn 20 19 21 0 (set (reg:DI 126)
        (eq:DI (reg:CCFP 125)
            (const_int 0 [0x0]))) 410 {*rs6000.md:11408} (insn_list:REG_DEP_TRUE
19 (nil))
    (expr_list:REG_DEAD (reg:CCFP 125)
        (nil)))

(insn 21 20 22 0 (set (reg:SI 124)
        (subreg:SI (reg:DI 126) 4)) 280 {*movsi_internal1}
(insn_list:REG_DEP_TRUE 20 (nil))
    (expr_list:REG_DEAD (reg:DI 126)
        (nil)))

to

(insn 21 20 22 0 (set (reg:SI 124)
        (eq:SI (reg:CCFP 125)
            (const_int 0 [0x0]))) 409 {*rs6000.md:11376} (insn_list:REG_DEP_TRUE
20 (nil))
    (expr_list:REG_DEAD (reg:DI 126)
        (nil)))

Following that, the new insn 21 and

(insn 22 21 23 0 (set (reg:DI 121)
        (zero_extend:DI (reg:SI 124))) 24 {*rs6000.md:379}
(insn_list:REG_DEP_TRUE 21 (nil))
    (expr_list:REG_DEAD (reg:SI 124)
        (nil)))

is a combine candidate, with a good result pattern of

(set (reg:DI 121)
    (eq:DI (reg:CCFP 125)
        (const_int 0 [0x0])))

However, rs6000_rtx_costs decides this patten is more expensive than the
previous two instructions.

rejecting combination of insns 21 and 22
original costs 12 + 4 = 16
replacement cost 20

Code in question is as follows.  I don't understand why these particular
comparisons have been singled out, or why the mode == Pmode test.
This contributes 12

    case EQ:
    case GTU:
    case LTU:
      if (mode == Pmode)
	{
	  switch (outer_code)
	    {
	    case SET:
	      *total = COSTS_N_INSNS (3);
	      break;

The (const_int 0) contributes 8!  This is because outer_code is EQ, which
doesn't match anything in the rather long set of outer_code tests for CONST_INT.

An obvious fix is to handle EQ and other comparisons here.



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at gcc dot gnu dot org
   Last reconfirmed|2004-08-02 01:02:22         |2004-11-24 07:00:16
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800


  parent reply	other threads:[~2004-11-24  7:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-28 17:01 [Bug other/16800] New: " gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:39 ` [Bug target/16800] " bangerth at dealii dot org
2004-08-02  1:02 ` pinskia at gcc dot gnu dot org
2004-11-01  0:27 ` pinskia at gcc dot gnu dot org
2004-11-22 22:28 ` steinmtz at us dot ibm dot com
2004-11-24  7:00 ` amodra at bigpond dot net dot au [this message]
2004-11-24  9:41 ` amodra at bigpond dot net dot au
2004-11-24 15:22 ` dje at watson dot ibm dot com
2004-11-27 23:01 ` cvs-commit at gcc dot gnu dot org
2004-11-28  0:07 ` pinskia at gcc dot gnu dot org

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=20041124070017.9553.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).