public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "law at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/63347] [5 regression] m68k misoptimisation with -fschedule-insns
Date: Mon, 09 Feb 2015 20:57:00 -0000	[thread overview]
Message-ID: <bug-63347-4-HPsAMxhmLG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-63347-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63347

--- Comment #12 from Jeffrey A. Law <law at redhat dot com> ---
Right.  I know we've got the SCHED_GROUP_P handling in prune_ready_list, but
it's not sufficient.

This is a regression with the trunk.

Take the code from c#0 and run it through a m68k-elf compiler with -O1
-fschedule-insns -mcpu=5208.

Prior to scheduling we have:
(insn 25 24 26 3 (set (cc0)
        (compare (reg/v:SI 32 [ haddr ]) 
            (const_int 0 [0]))) j.c:5 4 {*tstsi_internal_68020_cf}
     (expr_list:REG_DEAD (reg/v:SI 32 [ haddr ])
        (nil)))
(insn 26 25 27 3 (set (reg:QI 54)
        (eq:QI (cc0)
            (const_int 0 [0]))) j.c:5 364 {*m68k.md:5773}
     (nil)) 
(insn 27 26 28 3 (set (reg:SI 53)
        (sign_extend:SI (reg:QI 54))) j.c:5 82 {*68k_extendqisi2}
     (expr_list:REG_DEAD (reg:QI 54)
        (nil)))


After scheduling we get:

(insn 25 24 30 3 (set (cc0)
        (compare (reg/v:SI 32 [ haddr ])
            (const_int 0 [0]))) j.c:5 4 {*tstsi_internal_68020_cf}
     (expr_list:REG_DEAD (reg/v:SI 32 [ haddr ])
        (nil))) 
(insn 30 25 26 3 (set (mem:SI (pre_dec:SI (reg/f:SI 15 %sp)) [0  S4 A16])
        (const_int 10 [0xa])) j.c:17 33 {pushexthisi_const}
     (expr_list:REG_ARGS_SIZE (const_int 4 [0x4])
        (nil)))
(insn 26 30 27 3 (set (reg:QI 54) 
        (eq:QI (cc0)
            (const_int 0 [0]))) j.c:5 364 {*m68k.md:5773}
     (nil))
(insn 27 26 28 3 (set (reg:SI 53)
        (sign_extend:SI (reg:QI 54))) j.c:5 82 {*68k_extendqisi2}
     (expr_list:REG_DEAD (reg:QI 54)
        (nil))) 


Which is obviously wrong with the insertion of insn 30 between the cc-setter
and user.

When I looked at this a month ago my conclusion was that prior to your changes
when we saw the SCHED_GROUP_P flag set, we'd just advance the cycle counter the
appropriate number of cycles to ensure the insn with SCHED_GROUP_P was ready. 

With your changes we schedule the setter, but the result isn't ready for 2
cycles, so we queue the user.  On the next cycle, insn 30 has become ready and
it fires while the user (insn 26) is still queued.  Then 26 issues and we've
got incorrect code.

This history mentions some problem with the old code and the tic6x, but not
enough details for me to know if any changes I might suggest to fix this bug
would in turn mess up the tic6x.


  parent reply	other threads:[~2015-02-09 20:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-63347-4@http.gcc.gnu.org/bugzilla/>
2014-09-23 22:07 ` [Bug target/63347] " schwab@linux-m68k.org
2014-09-26 18:39 ` jifl-bugzilla at jifvik dot org
2014-10-04 19:27 ` mikpelinux at gmail dot com
2014-10-06 22:10 ` mikpelinux at gmail dot com
2014-10-10 15:41 ` schwab@linux-m68k.org
2014-12-09  5:09 ` jifl-bugzilla at jifvik dot org
2014-12-09  8:44 ` schwab@linux-m68k.org
2014-12-15 21:07 ` mikpelinux at gmail dot com
2015-01-19 22:30 ` law at redhat dot com
2015-02-09 12:46 ` [Bug target/63347] [5 regression] " bernds at gcc dot gnu.org
2015-02-09 20:57 ` law at redhat dot com [this message]
2015-02-10 13:32 ` bernds at gcc dot gnu.org
2015-02-11 18:51 ` law at redhat dot com
2015-02-11 23:29 ` law at gcc dot gnu.org
2015-02-12  5:07 ` [Bug target/63347] [4.9 " law at redhat dot com
2015-02-12  5:14 ` law at redhat dot com
2015-03-13 10:08 ` rguenth at gcc dot gnu.org
2015-06-26 19:53 ` jakub at gcc dot gnu.org
2015-06-26 20:27 ` jakub at gcc dot gnu.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=bug-63347-4-HPsAMxhmLG@http.gcc.gnu.org/bugzilla/ \
    --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).