public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64015] [5.0 Regression] AArch64 ICE due to conditional compare
Date: Mon, 24 Nov 2014 05:39:00 -0000	[thread overview]
Message-ID: <bug-64015-4-tOhBWfLeso@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64015-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Zhenqiang Chen from comment #2)
> 2) How to justify it is valueable (the overhead of ccmp is OK) when
> generating ccmp?

If we ignore the case for swapping.
Try this one:
int
test (int a, int b)
{
  return (a > 252) && b > 252;
}

With my patch to do the forcing:
test:
        cmp     w0, 252
        mov     w0, 252
        ccmp    w1, w0, 4, gt
        cset    w0, gt
        ret

Without:
test:
        cmp     w0, 252
        cset    w2, gt
        cmp     w1, 252
        cset    w0, gt
        and     w0, w2, w0
        ret

Or better yet take:
int
test (int a, int b)
{
  return (a > 321223) && b > 321224;
}
Without:
test:
        mov     w3, 59079
        mov     w2, 59080
        movk    w3, 0x4, lsl 16
        movk    w2, 0x4, lsl 16
        cmp     w0, w3
        cset    w3, gt
        cmp     w1, w2
        cset    w0, gt
        and     w0, w3, w0
        ret

With forcing:
test:
        mov     w3, 59079
        mov     w2, 59080
        movk    w3, 0x4, lsl 16
        movk    w2, 0x4, lsl 16
        cmp     w0, w3
        ccmp    w1, w2, 4, gt
        cset    w0, gt
        ret

--- CUT ---
Also take:
int
test (int a, int b)
{
  return (a > 33) && b > 33;
}
Without:
test:
        cmp     w0, 33
        cset    w2, gt
        cmp     w1, 33
        cset    w0, gt
        and     w0, w2, w0
        ret
With forcing:
test:
        cmp     w0, 33
        mov     w0, 33
        ccmp    w1, w0, 4, gt
        cset    w0, gt
        ret


See how with forcing is always the same size or smaller?


  parent reply	other threads:[~2014-11-24  5:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21  9:46 [Bug target/64015] New: " ktkachov at gcc dot gnu.org
2014-11-21  9:46 ` [Bug target/64015] " ktkachov at gcc dot gnu.org
2014-11-21 12:38 ` rguenth at gcc dot gnu.org
2014-11-21 18:24 ` pinskia at gcc dot gnu.org
2014-11-24  5:29 ` zhenqiang.chen at arm dot com
2014-11-24  5:39 ` pinskia at gcc dot gnu.org [this message]
2014-11-24  5:40 ` pinskia at gcc dot gnu.org
2014-11-24  6:16 ` zhenqiang.chen at arm dot com
2014-11-24 11:24 ` ktkachov at gcc dot gnu.org
2014-11-27  7:36 ` zhenqiang.chen at arm dot com
2015-01-13 14:28 ` StaffLeavers at arm dot com
2015-01-13 14:29 ` StaffLeavers at arm dot com
2015-01-13 14:29 ` StaffLeavers at arm dot com
2015-01-13 14:30 ` StaffLeavers at arm dot com
2015-01-13 14:31 ` StaffLeavers at arm dot com
2015-01-13 14:32 ` StaffLeavers at arm dot com
2015-01-13 14:32 ` StaffLeavers at arm dot com
2015-01-13 14:33 ` StaffLeavers at arm dot com
2015-01-16 11:48 ` jiwang at gcc dot gnu.org
2015-01-16 11:50 ` jiwang 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-64015-4-tOhBWfLeso@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).