public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ysrumyan at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64691] Suboptimal register allocation for bytes comparison on i386
Date: Tue, 12 May 2015 09:58:00 -0000	[thread overview]
Message-ID: <bug-64691-4-bd6SjC6gLe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64691-4@http.gcc.gnu.org/bugzilla/>

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

Yuri Rumyantsev <ysrumyan at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ysrumyan at gmail dot com

--- Comment #1 from Yuri Rumyantsev <ysrumyan at gmail dot com> ---
I found another register allocation deficiency which can be exhibited at the
attached test-case extracted from important benchmark. If we look at inner loop
    for(i = 0; i < size; i++) {
        byte xr, xg, xb, t1;
        sbyte t2, t3;
        x1 = read[0];
        x2 = read[1];
        x3 = read[2];
        t1 = (byte) (((C1 * x1) + (C2 * x2) + (C3 * x3) +
                (1 << (SCALE - 1))) >> SCALE);
        t2 = (sbyte) (((C4 * x1) + (C5 * x2) + (C6 * x3) +
                (1 << (SCALE - 1))) >> SCALE);
        t3 = (sbyte) (((C7 * x1) + (C8 * x2) + (C9 * x3) +
                (1 << (SCALE - 1))) >> SCALE);
        write[0] = t1;
        write[1] = (byte) t2;
        write[2] = (byte) t3;
        read += 3;
        write += 3;
    }
we can see that 7 registers is enough to keep all variable (except for upper
loop bound): 3 registers for x1,x2,x3, 2 registers for read and write pointers
and 2 registers for computation one for t1,t2,t3  computations and one scratch
register for multiplications (but since consumers of t1,t2,t3 is byte store
this register must belong also to Q_REQS subset, i.e. AREG,BREG,CREG or DREG).
But LRA does not perform such allocation and this leads to redundant
spill/fills and results in performance degradation. Assembly file produced 6.0
compiler with "-O2 -m32 -march=slm" options is attached too.


  reply	other threads:[~2015-05-12  9:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 15:26 [Bug target/64691] New: " enkovich.gnu at gmail dot com
2015-05-12  9:58 ` ysrumyan at gmail dot com [this message]
2015-05-12 10:01 ` [Bug target/64691] " ysrumyan at gmail dot com
2021-12-25  7:59 ` pinskia 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-64691-4-bd6SjC6gLe@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).