public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ramana at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/63724] New: [AArch64] Inefficient immediate expansion and hoisting.
Date: Mon, 03 Nov 2014 15:40:00 -0000	[thread overview]
Message-ID: <bug-63724-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 63724
           Summary: [AArch64] Inefficient immediate expansion and
                    hoisting.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ramana at gcc dot gnu.org

For some cases like hmmer in SPEC2k6 we currently generate pretty rubbish code
with AArch64. 

float
P7Viterbi(int **mmx, int L, int M, int **imx, int **dmx)
{
  int k;

  for (k = 0; k <= M; k++)
    mmx[0][k] = imx[0][k] = dmx[0][k] = -987654321;

}

This ends up generating pretty rubbish code at O2. 

tbnz    w2, #31, .L4
    ldr    x5, [x3]
    ldr    x4, [x4]
    ldr    x6, [x0]
    mov    x0, 0
.L3:
    mov    w1, 38735
    mov    w3, w1
    movk    w1, 0xc521, lsl 16
    str    w1, [x4, x0, lsl 2]
    movk    w3, 0xc521, lsl 16
    mov    w1, 38735
    str    w3, [x5, x0, lsl 2]
    movk    w1, 0xc521, lsl 16
    str    w1, [x6, x0, lsl 2]
    add    x0, x0, 1
    cmp    w2, w0
    bge    .L3
.L4:
    fmov    s0, wzr
    ret
    .size    P7Viterbi, .-P7Viterbi

and could well be 


P7Viterbi:
        tbnz    w2, #31, .L4
        ldr     x5, [x3]
        mov     w1, 38735
        ldr     x3, [x4]
        movk    w1, 0xc521, lsl 16
        ldr     x6, [x0]
        mov     x0, 0
.L3:
        str     w1, [x3, x0, lsl 2]
        str     w1, [x5, x0, lsl 2]
        str     w1, [x6, x0, lsl 2]
        add     x0, x0, 1
        cmp     w2, w0
        bge     .L3
.L4:
        fmov    s0, wzr
        ret
        .size   P7Viterbi, .-P7Viterbi

The hoisting is missed because we expand const_int's too early in the AArch64
backend. Given we don't have an "uncse" in the mid-end it's quite hard to
recover when we've expanded to this form rather early in the compiler. The
simple solution is just to move the logic out into a separate splitter
function, additionally we should also investigate what happens if we start
doing the same for our address computations, but that's the subject of a
separate patch. 

Mine.


             reply	other threads:[~2014-11-03 15:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-03 15:40 ramana at gcc dot gnu.org [this message]
2014-11-03 15:40 ` [Bug target/63724] " ramana at gcc dot gnu.org
2014-11-14  9:59 ` ramana at gcc dot gnu.org
2014-11-14 11:03 ` ramana at gcc dot gnu.org
2015-01-11 18:37 ` yroux 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-63724-4@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).