public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "undefinedopcode2 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/106415] loop-ivopts prevents correct usage of dbra with 16-bit loop counters on m68k
Date: Tue, 26 Jul 2022 05:01:51 +0000	[thread overview]
Message-ID: <bug-106415-4-MPZL9d2QZ9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106415-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Undefined Opcode <undefinedopcode2 at gmail dot com> ---
As an experiment, I added the following logic to m68k_rtx_costs():
      case PLUS:
      // <omitted a few lines related to LEA>
      if(TUNE_68000_10 && !(mode == QImode || mode == HImode))
        {
          *total = 400; // make non-byte/word ADD outrageously expensive
          return true;
        }

Sure enough, the costs for all non-short IV shot up. However, it's still
choosing candidate 7, same as before:
<Candidate Costs>:
  cand  cost
force_expr_to_var_cost size costs:
  integer 2
  symbol 4
  address 4
  other 16

force_expr_to_var_cost speed costs:
  integer 2
  symbol 4
  address 4
  other 16

  0     401
  1     5
  2     5
  3     4
  4     5
  5     5
  6     5
  7     401
  8     401

Later, when we get to group costs, the results aren't what I'd expect:
<Group-candidate Costs>:
Group 0:
  cand  cost    compl.  inv.expr.       inv.vars
  0     400     0       NIL;    NIL;
  7     0       0       NIL;    NIL;
  8     400     0       NIL;    NIL;

Group 1:
  cand  cost    compl.  inv.expr.       inv.vars
  0     0       0       NIL;    NIL;
  1     0       0       NIL;    NIL;
  2     0       0       NIL;    NIL;
  3     0       0       NIL;    NIL;
  4     0       0       NIL;    NIL;
  5     0       0       NIL;    NIL;
  6     -1      0       NIL;    NIL;
  7     0       0       NIL;    NIL;
  8     0       0       NIL;    NIL;

I'm not entirely sure what's going on here. Why does candidate 7 suddenly cost
0?

  parent reply	other threads:[~2022-07-26  5:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 17:32 [Bug tree-optimization/106415] New: " undefinedopcode2 at gmail dot com
2022-07-22 18:50 ` [Bug tree-optimization/106415] " undefinedopcode2 at gmail dot com
2022-07-25 16:51 ` [Bug target/106415] " pinskia at gcc dot gnu.org
2022-07-25 17:27 ` undefinedopcode2 at gmail dot com
2022-07-26  5:01 ` undefinedopcode2 at gmail dot com [this message]
2022-07-26  5:59 ` linkw at gcc dot gnu.org
2022-07-27 18:28 ` undefinedopcode2 at gmail dot com
2022-08-01 23:44 ` undefinedopcode2 at gmail dot com

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-106415-4-MPZL9d2QZ9@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).