public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "solar-gcc at openwall dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/51017] GCC 4.6 performance regression (vs. 4.4/4.5)
Date: Mon, 16 Feb 2015 01:10:00 -0000	[thread overview]
Message-ID: <bug-51017-4-ZrdgGIG58r@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51017-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from Alexander Peslyak <solar-gcc at openwall dot com> ---
I decided to take a look at the generated code.  Compared to 4.6.2, GCC 4.9.2
started generating lots of xorps, orps, andps, andnps where it previously
generated pxor, por, pand, pandn.  Changing those with:

sed -i 's/xorps/pxor/g; s/orps/por/g; s/andps/pand/g; s/andnps/pandn/g'

made no difference for performance on this machine (still 4.9.2's poor
performance).

The next suspect were the varieties of MOV instructions.  In 4.9.2's generated
code, there were 1319 movaps, 721 movups.  In 4.6.2's, there were 1258 movaps,
465 movups.  Simply changing all movups to movaps in 4.9.2's original code with
sed (thus, with no other changes except for this one), resulting in a total of
2040 movaps, brought the performance to levels similar to GCC 4.4 and 4.5's
(and is better than 4.6's, but worse than 4.3's).  So movups appear to be the
main culprit.  The same hack for 4.6.2's code brought its performance almost to
4.3's level (still 5% worse, though), and significantly above 4.9.2's (so
there's still some other, smaller regression with 4.9.2).

Here are my new results:

4.1.0o - 2960K c/s, 28182 bytes, 1758 movaps, 0 movups
4.3.6o - 2956K c/s, 28229 bytes, 1755 movaps, 0 movups
4.4.6o - 2694K c/s, 29316 bytes, 1709 movaps, 7 movups
4.4.6h - 2714K c/s, 29316 bytes, 1716 movaps, 0 movups
4.5.3o - 2709K c/s, 29203 bytes, 1669 movaps, 0 movups
4.6.2o - 2121K c/s, 29624 bytes, 1258 movaps, 465 movups
4.6.2h - 2817K c/s, 29624 bytes, 1723 movaps, 0 movups
4.9.2o - 1852K c/s, 28256 bytes, 1319 movaps, 721 movups
4.9.2h - 2688K c/s, 28256 bytes, 2040 movaps, 0 movups

"o" means original, "h" means hacked generated assembly code (all movups
changed to movaps).  (BTW, there were no movdqa/movdqu in any of these code
versions.)

Now I am wondering to what extent this is a GCC issue and to what extent it
might be my source code's, if GCC is somehow unsure it can assume alignment. 
What are the conditions when GCC should in fact use movups?  Is it intentional
that newer versions of GCC are being more careful at this, resulting in worse
performance?


  parent reply	other threads:[~2015-02-16  1:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08  0:43 [Bug middle-end/51017] New: " solar-gcc at openwall dot com
2011-11-08  0:57 ` [Bug middle-end/51017] " solar-gcc at openwall dot com
2011-11-08  1:05 ` solar-gcc at openwall dot com
2011-12-15  0:34 ` pinskia at gcc dot gnu.org
2012-01-03  4:46 ` solar-gcc at openwall dot com
2012-01-04 19:39 ` solar-gcc at openwall dot com
2012-01-04 22:43 ` jakub at gcc dot gnu.org
2012-01-04 23:00 ` solar-gcc at openwall dot com
2015-02-09  0:12 ` pinskia at gcc dot gnu.org
2015-02-16  0:08 ` solar-gcc at openwall dot com
2015-02-16  1:10 ` solar-gcc at openwall dot com [this message]
2015-02-16 10:51 ` [Bug tree-optimization/51017] GCC 4.6 performance regression (vs. 4.4/4.5), PRE increases register pressure rguenth at gcc dot gnu.org
2015-02-17  2:21 ` solar-gcc at openwall dot com
2015-02-17  2:56 ` solar-gcc at openwall dot com
2015-02-17  3:11 ` solar-gcc at openwall dot com
2015-02-17  9:25 ` rguenth at gcc dot gnu.org
2015-02-17  9:27 ` rguenth at gcc dot gnu.org
2015-02-18  0:03 ` solar-gcc at openwall dot com
2015-02-18  1:25 ` solar-gcc at openwall dot com
2015-02-18  3:20 ` solar-gcc at openwall dot com
2015-02-18 10:32 ` [Bug tree-optimization/51017] [4.8/4.9/5 Regression] GCC performance regression (vs. 4.4/4.5), PRE increases register pressure too much rguenth at gcc dot gnu.org
2015-02-18 11:09 ` rguenth at gcc dot gnu.org
2015-02-25 14:26 ` law at redhat dot com
2015-06-23  8:14 ` [Bug tree-optimization/51017] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 20:04 ` [Bug tree-optimization/51017] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:33 ` jakub at gcc dot gnu.org
2021-05-14  9:46 ` [Bug tree-optimization/51017] [9/10/11/12 Regression] GCC performance regression (vs. 4.4/4.5), PRE/LIM increase " jakub at gcc dot gnu.org
2021-06-01  8:05 ` rguenth at gcc dot gnu.org
2022-05-27  9:34 ` [Bug tree-optimization/51017] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-07-07 10:29 ` [Bug tree-optimization/51017] [11/12/13/14 " rguenth 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-51017-4-ZrdgGIG58r@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).