public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/39942] Nonoptimal code - leaveq; xchg   %ax,%ax; retq
Date: Thu, 14 May 2009 15:16:00 -0000	[thread overview]
Message-ID: <20090514151555.3232.qmail@sourceware.org> (raw)
In-Reply-To: <bug-39942-17483@http.gcc.gnu.org/bugzilla/>



------- Comment #31 from jakub at gcc dot gnu dot org  2009-05-14 15:15 -------
Some -O2 code size data from today's trunk bootstraps.  The first .text line
is always vanilla bootstrap, the second one with
http://gcc.gnu.org/ml/gcc-patches/2009-05/msg00702.html
only, the third one with that patch and
http://gcc.gnu.org/ml/gcc-patches/2009-05/msg00703.html
and the last with additional:
--- i386.c.jj3  2009-05-14 12:41:24.000000000 +0200
+++ i386.c      2009-05-14 14:48:24.000000000 +0200
@@ -27202,7 +27202,7 @@ x86_function_profiler (FILE *file, int l
 static int
 min_insn_size (rtx insn)
 {
-  int l = 0;
+  int l = 0, len;

   if (!INSN_P (insn) || !active_insn_p (insn))
     return 0;
@@ -27222,7 +27222,8 @@ min_insn_size (rtx insn)
       && symbolic_reference_mentioned_p (PATTERN (insn))
       && !SIBLING_CALL_P (insn))
     return 5;
-  if (get_attr_length (insn) <= 1)
+  len = get_attr_length (insn);
+  if (len <= 1)
     return 1;

   /* For normal instructions we may rely on the sizes of addresses
@@ -27230,6 +27231,9 @@ min_insn_size (rtx insn)
      This is not the case for jumps where references are PC relative.  */
   if (!JUMP_P (insn))
     {
+      if (get_attr_type (insn) != TYPE_MULTI)
+       return len;
+
       l = get_attr_length_address (insn);
       if (l < 4 && symbolic_reference_mentioned_p (PATTERN (insn)))
        l = 4;
to see how the code size changes with much more accurate (though sometimes not
minimum but maximum bound) insn sizing for the algorithm.
64-bit cc1plus
  [12] .text             PROGBITS        000000000047f990 07f990 8c3ba8 00  AX 
0   0 16
  [12] .text             PROGBITS        000000000047f990 07f990 89b1e8 00  AX 
0   0 16
  [12] .text             PROGBITS        000000000047f9c0 07f9c0 899f78 00  AX 
0   0 16
  [12] .text             PROGBITS        000000000047f9c0 07f9c0 88eaf8 00  AX 
0   0 16
32-bit cc1plus
  [12] .text             PROGBITS        080b24e0 06a4e0 8f8cac 00  AX  0   0
16
  [12] .text             PROGBITS        080b24e0 06a4e0 8d516c 00  AX  0   0
16
  [12] .text             PROGBITS        080b2510 06a510 8d507c 00  AX  0   0
16
  [12] .text             PROGBITS        080b2510 06a510 8cbd7c 00  AX  0   0
16
For 64-bit cc1plus that's 1.8%, 1.86%, 2.36% smaller binary with the 1, 2 resp.
3 patches, for 32-bit cc1plus 1.55%, 1.56%, 1.96% smaller binary.
So the first patch is the most important and something like the third one,
perhaps with more exceptions, also makes a difference.  I'll now try to update
my awk script to check for the AMD rules, namely that the last byte of the
branch insn counts rather than the first.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39942


  parent reply	other threads:[~2009-05-14 15:16 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 12:20 [Bug c/39942] New: " vvv at ru dot ru
2009-04-28 13:42 ` [Bug target/39942] " pinskia at gcc dot gnu dot org
2009-04-28 17:05 ` vvv at ru dot ru
2009-04-28 17:10 ` vvv at ru dot ru
2009-04-28 17:15 ` vvv at ru dot ru
2009-04-28 17:37 ` ubizjak at gmail dot com
2009-04-28 21:19 ` vvv at ru dot ru
2009-04-28 21:23 ` pinskia at gcc dot gnu dot org
2009-04-28 21:47 ` ubizjak at gmail dot com
2009-04-28 21:53 ` pinskia at gcc dot gnu dot org
2009-04-28 21:54 ` ubizjak at gmail dot com
2009-04-29  7:46 ` vvv at ru dot ru
2009-04-29  7:55 ` vvv at ru dot ru
2009-04-29  9:32 ` jakub at gcc dot gnu dot org
2009-04-29 10:13 ` jakub at gcc dot gnu dot org
2009-04-29 19:17 ` vvv at ru dot ru
2009-04-30  9:07 ` jakub at gcc dot gnu dot org
2009-05-12 16:41 ` vvv at ru dot ru
2009-05-13  8:31 ` jakub at gcc dot gnu dot org
2009-05-13 11:43 ` vvv at ru dot ru
2009-05-13 13:32 ` rguenth at gcc dot gnu dot org
2009-05-13 17:13 ` vvv at ru dot ru
2009-05-13 18:22 ` ubizjak at gmail dot com
2009-05-13 18:34 ` rguenth at gcc dot gnu dot org
2009-05-13 18:45 ` hjl dot tools at gmail dot com
2009-05-13 18:57 ` vvv at ru dot ru
2009-05-13 19:06 ` vvv at ru dot ru
2009-05-13 19:09 ` jakub at gcc dot gnu dot org
2009-05-13 19:19 ` vvv at ru dot ru
2009-05-13 21:44 ` hjl dot tools at gmail dot com
2009-05-14  9:01 ` vvv at ru dot ru
2009-05-14 15:16 ` jakub at gcc dot gnu dot org [this message]
2009-05-14 15:58 ` hjl dot tools at gmail dot com
2009-05-14 18:37 ` hjl dot tools at gmail dot com
2009-05-14 19:44 ` vvv at ru dot ru
2009-05-15  2:23 ` hjl dot tools at gmail dot com
2009-05-15  4:32 ` hjl dot tools at gmail dot com
2009-05-15  7:56 ` jakub at gcc dot gnu dot org
2009-05-15 12:11 ` jakub at gcc dot gnu dot org
2009-05-15 12:12 ` jakub at gcc dot gnu dot org
2009-05-15 14:35 ` hjl dot tools at gmail dot com
2009-05-15 16:25 ` jakub at gcc dot gnu dot org
2009-05-15 18:18 ` jakub at gcc dot gnu dot org
2009-05-15 18:23 ` jakub at gcc dot gnu dot org
2009-05-15 23:06 ` hjl dot tools at gmail dot com
2009-05-16  6:38 ` jakub at gcc dot gnu dot org
2009-05-16  7:10 ` jakub at gcc dot gnu dot org
2009-05-16  7:12 ` jakub at gcc dot gnu dot org
2009-05-18 17:21 ` hjl at gcc dot gnu dot org
2009-05-20 21:38 ` vvv at ru dot ru
2009-05-20 22:09 ` jakub at gcc dot gnu dot org
2009-05-21 13:22 ` jakub at gcc dot gnu dot org
2009-05-21 13:26 ` jakub at gcc dot gnu dot org
     [not found] <bug-39942-4@http.gcc.gnu.org/bugzilla/>
2020-04-14 21:20 ` peter at cordes dot ca

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=20090514151555.3232.qmail@sourceware.org \
    --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).