public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23355] New: size optimizer did not eliminateing useless Push and pop instructions at ARM/Thumb machine
@ 2005-08-12 16:43 th dot r dot klein at web dot de
  2005-08-12 16:49 ` [Bug target/23355] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: th dot r dot klein at web dot de @ 2005-08-12 16:43 UTC (permalink / raw)
  To: gcc-bugs

The older version of gcc produces code e.g.:

arm-elf-gcc-3.4.4 -g -Os -fPIC -mthumb -mlittle-endian -mapcs \
      -march=armv4t -mcallee-super-interworking \
      -c progWord.c -o 3_4_4_thumb.o

3_4_4_thumb.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <progWord>:
   0:	e38fc001 	orr	ip, pc, #1	; 0x1
   4:	e12fff1c 	bx	ip

00000008 <.real_start_ofprogWord>:
   8:	b570      	push	{r4, r5, r6, lr}
   .
   register r10 (sl) never been used
   so it is neither pushed nor poped
   .
  52:	2000      	movs	r0, #0
  54:	bc70      	pop	{r4, r5, r6}
  56:	bc02      	pop	{r1}
  58:	4708      	bx	r1

The newer version generats the code

arm-elf-gcc-4.0.1 -g -Os -fPIC -mthumb -mlittle-endian -mapcs \
      -march=armv4t -mcallee-super-interworking \
      -c progWord.c -o 4_0_1_thumb.o

4_0_1_thumb.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <progWord>:
   0:	e38fc001 	orr	ip, pc, #1	; 0x1
   4:	e12fff1c 	bx	ip

00000008 <.real_start_ofprogWord>:
   8:	b570      	push	{r4, r5, r6, lr}
   a:	4656      	mov	r6, sl
   c:	b440      	push	{r6}
   .
   register r10 (sl) never been used
   .
  56:	2000      	movs	r0, #0
  58:	bc04      	pop	{r2}
  5a:	4692      	mov	sl, r2
  5c:	bc70      	pop	{r4, r5, r6}
  5e:	bc02      	pop	{r1}
  60:	4708      	bx	r1

The register sl isn't used within the function so push and pop of this not what
I'm expecting if switch -Os is given.

-- 
           Summary: size optimizer did not eliminateing useless Push and pop
                    instructions at ARM/Thumb machine
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: th dot r dot klein at web dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i386-elf-freebsd
GCC target triplet: arm-elf


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-08-16 18:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-12 16:43 [Bug c/23355] New: size optimizer did not eliminateing useless Push and pop instructions at ARM/Thumb machine th dot r dot klein at web dot de
2005-08-12 16:49 ` [Bug target/23355] " pinskia at gcc dot gnu dot org
2005-08-12 22:05 ` rearnsha at gcc dot gnu dot org
2005-08-13 18:27 ` th dot r dot klein at web dot de
2005-08-15  9:33 ` rearnsha at gcc dot gnu dot org
2005-08-16  9:30 ` cvs-commit at gcc dot gnu dot org
2005-08-16  9:59 ` rearnsha at gcc dot gnu dot org
2005-08-16 18:23 ` th dot r dot klein at web dot de

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).