public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fredrik.hederstierna@securitas-direct.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/61578] [4.9 regression] Code size increase for ARM thumb compared to 4.8.x when compiling with -Os
Date: Thu, 03 Sep 2015 05:16:00 -0000	[thread overview]
Message-ID: <bug-61578-4-BwKWZKhK8a@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61578-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #23 from Fredrik Hederstierna <fredrik.hederstierna@securitas-direct.com> ---
Thanks for your patch, I tried it out, and it solves the small example fine,
the code now is similar to GCC 4.8 for this particular example.

Though when I ran the full CSiBE benchmark, the code size unfortunately grew
approx +150 bytes overall for the full suite. So the patch did not solve the
generic root problem with code size increase unfortunately.

This is strange and I'm thinking of how to continue from here, this issue has
diverged a bit too much (mostly because of my own fault) with several examples
etc. Do you think we should create separate issues for different small examples
that compiles bad perhaps? but on the same time we need to keep track on the
'generic' overall code size issue as eg. CSiBE points out.

Here's is another small example I tested yesterday that also gives unnecessary
moves, both for arm7tdmi, arm966e-s and cortex-m0 tested.

extern void func(int data);
char cdata[4];
void test(void) {
  int *idata = (int*)cdata;
  func(*idata);
}

Compiles with GCC 4.8.5 (cortex-m0):

00000000 <test>:
   0:   b508            push    {r3, lr}
   2:   4b07            ldr     r3, [pc, #28]   ; (20 <test+0x20>)
   4:   7858            ldrb    r0, [r3, #1]
   6:   781a            ldrb    r2, [r3, #0]
   8:   0200            lsls    r0, r0, #8
   a:   4310            orrs    r0, r2
   c:   789a            ldrb    r2, [r3, #2]
   e:   78db            ldrb    r3, [r3, #3]
  10:   0412            lsls    r2, r2, #16
  12:   4310            orrs    r0, r2
  14:   061b            lsls    r3, r3, #24
  16:   4318            orrs    r0, r3
  18:   f7ff fffe       bl      0 <func>
  1c:   bd08            pop     {r3, pc}
  1e:   46c0            nop                     ; (mov r8, r8)
  20:   00000000        .word   0x00000000

With GCC 6 master with latest LRA patch (+4 bytes):

00000000 <test>:
   0:   b510            push    {r4, lr}
   2:   4c08            ldr     r4, [pc, #32]   ; (24 <test+0x24>)
   4:   7863            ldrb    r3, [r4, #1]
   6:   7821            ldrb    r1, [r4, #0]
   8:   78a0            ldrb    r0, [r4, #2]
   a:   021b            lsls    r3, r3, #8
   c:   430b            orrs    r3, r1
   e:   0400            lsls    r0, r0, #16
  10:   001a            movs    r2, r3   ??? MOVE
  12:   0003            movs    r3, r0   ??? MOVE
  14:   78e0            ldrb    r0, [r4, #3]
  16:   4313            orrs    r3, r2
  18:   0600            lsls    r0, r0, #24
  1a:   4318            orrs    r0, r3
  1c:   f7ff fffe       bl      0 <func>
  20:   bd10            pop     {r4, pc}
  22:   46c0            nop                     ; (mov r8, r8)
  24:   00000000        .word   0x00000000

Kind Regards, Fredrik


  parent reply	other threads:[~2015-09-03  5:16 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-21 10:32 [Bug c/61578] New: " fredrik.hederstierna@securitas-direct.com
2014-06-21 10:33 ` [Bug c/61578] " fredrik.hederstierna@securitas-direct.com
2014-06-21 10:34 ` fredrik.hederstierna@securitas-direct.com
2014-06-21 10:34 ` fredrik.hederstierna@securitas-direct.com
2014-06-21 10:35 ` fredrik.hederstierna@securitas-direct.com
2014-06-21 10:35 ` fredrik.hederstierna@securitas-direct.com
2014-07-24 14:42 ` [Bug target/61578] " ramana at gcc dot gnu.org
2014-08-14 14:23 ` vmakarov at gcc dot gnu.org
2014-09-23 21:45 ` fredrik.hederstierna@securitas-direct.com
2014-11-02 20:35 ` fredrik.hederstierna@securitas-direct.com
2014-11-02 20:38 ` fredrik.hederstierna@securitas-direct.com
2014-11-03  1:33 ` zhenqiang.chen at arm dot com
2014-12-12 15:03 ` ramana at gcc dot gnu.org
2015-01-15 11:25 ` [Bug target/61578] [4.9/ 5 regression] " ramana at gcc dot gnu.org
2015-02-09  0:11 ` [Bug target/61578] [4.9/5 " pinskia at gcc dot gnu.org
2015-03-02 10:02 ` fredrik.hederstierna@securitas-direct.com
2015-03-03 16:05 ` law at redhat dot com
2015-06-26 19:57 ` [Bug target/61578] [4.9 " jakub at gcc dot gnu.org
2015-06-26 20:29 ` jakub at gcc dot gnu.org
2015-08-18 14:29 ` fredrik.hederstierna@securitas-direct.com
2015-08-18 14:41 ` fredrik.hederstierna@securitas-direct.com
2015-08-19 10:56 ` fredrik.hederstierna@securitas-direct.com
2015-09-01 14:06 ` vmakarov at gcc dot gnu.org
2015-09-01 14:16 ` fredrik.hederstierna@securitas-direct.com
2015-09-01 19:38 ` vmakarov at gcc dot gnu.org
2015-09-03  5:16 ` fredrik.hederstierna@securitas-direct.com [this message]
2015-09-03 14:59 ` vmakarov at gcc dot gnu.org
2015-09-08 21:38 ` fredrik.hederstierna@securitas-direct.com
2015-09-10 20:18 ` vmakarov at gcc dot gnu.org
2015-09-22 17:13 ` vogt at linux dot vnet.ibm.com
2015-09-22 17:41 ` vogt at linux dot vnet.ibm.com
2015-09-23 12:16 ` vogt at linux dot vnet.ibm.com
2015-09-24 20:38 ` vmakarov at gcc dot gnu.org
2015-09-24 20:41 ` vmakarov at gcc dot gnu.org
2015-09-25  9:12 ` vogt at linux dot vnet.ibm.com
2015-09-28  9:12 ` vogt at linux dot vnet.ibm.com

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-61578-4-BwKWZKhK8a@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).