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

* [Bug target/23355] size optimizer did not eliminateing useless Push and pop instructions at ARM/Thumb machine
  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 ` pinskia at gcc dot gnu dot org
  2005-08-12 22:05 ` rearnsha at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-12 16:49 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


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


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

* [Bug target/23355] size optimizer did not eliminateing useless Push and pop instructions at ARM/Thumb machine
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2005-08-12 22:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2005-08-12 22:04 -------
Please supply a pre-processed testcase.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug target/23355] size optimizer did not eliminateing useless Push and pop instructions at ARM/Thumb machine
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: th dot r dot klein at web dot de @ 2005-08-13 18:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From th dot r dot klein at web dot de  2005-08-13 18:27 -------
I've reduced the function to a useless, but bug still remains.

(sorry: I've forgotten to tar the files so I'm attaching those manualy.)

###########################################################################

~/work/bugreport$ arm-elf-gcc-3.4.4 -v -save-temps -g -Os -fPIC -mthumb
-mlittle-endian -mapcs -march=armv4t-mcallee-super-interworking -c
example_3_4_4.c -o 3_4_4_thumb.o
Reading specs from /usr/local/lib/gcc/arm-elf/3.4.4/specs
Configured with: ../../gcc-3.4.4/configure --target=arm-elf --disable-threads
--disable-nls --without-headers --without-libs --enable-languages=c
Thread model: single
gcc version 3.4.4
 /usr/local/libexec/gcc/arm-elf/3.4.4/cc1 -E -quiet -v -D__ARM_ARCH_4T__
-D__USES_INITFINI__ example_3_4_4.c -mthumb -mlittle-endian -mapcs -march=armv4t
-mcallee-super-interworking -fPIC -fworking-directory -Os -o example_3_4_4.i
ignoring nonexistent directory
"/usr/local/lib/gcc/arm-elf/3.4.4/../../../../arm-elf/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/arm-elf/3.4.4/include
 /usr/local/lib/gcc/arm-elf/3.4.4/../../../../arm-elf/include
End of search list.
 /usr/local/libexec/gcc/arm-elf/3.4.4/cc1 -fpreprocessed example_3_4_4.i -quiet
-dumpbase example_3_4_4.c -mthumb-mlittle-endian -mapcs -march=armv4t
-mcallee-super-interworking -auxbase-strip 3_4_4_thumb.o -g -Os -version -fPIC
-o example_3_4_4.s
GNU C version 3.4.4 (arm-elf)
        compiled by GNU C version 3.4.2 [FreeBSD] 20040728.
GGC heuristics: --param ggc-min-expand=65 --param ggc-min-heapsize=65536
 /usr/local/lib/gcc/arm-elf/3.4.4/../../../../arm-elf/bin/as -EL -march=armv4t
-o 3_4_4_thumb.o example_3_4_4.s

###########################################################################
file example_3_4_4.i
###########################################################################
# 1 "example_3_4_4.c"
# 1 "/home/thomas/work/bugreport//"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "example_3_4_4.c"



typedef char int8_t;
typedef short int16_t;
typedef int int32_t;

typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;


typedef int __attribute__((__mode__(__DI__))) int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
# 34 "example_3_4_4.c"
int progWord(uint32_t base_address,uint32_t address,uint32_t data)
{
 volatile uint32_t *dataPtr;
 uint32_t rd_data;


 *((volatile uint32_t *)(base_address + (0x555uL<<2))) = 0xAAAAaaaa;

 dataPtr = (uint32_t *)address;
 *dataPtr = data;

 return 0;
}
###########################################################################
file example_3_4_4.s
###########################################################################
	.code	16
	.file	"example_3_4_4.c"
	.section	.debug_abbrev,"",%progbits
.Ldebug_abbrev0:
	.section	.debug_info,"",%progbits
.Ldebug_info0:
	.section	.debug_line,"",%progbits
.Ldebug_line0:
	.text
.Ltext0:
	.align	2
	.global	progWord
	.code 32
	.type	progWord, %function
progWord:
.LFB2:
	.file 1 "example_3_4_4.c"
	.loc 1 35 0
	orr	ip, pc, #1
	bx	ip
	.code	16
	.globl .real_start_ofprogWord
	.thumb_func
.real_start_ofprogWord:
	.loc 1 40 0
	ldr	r3, .L2
	add	r0, r0, r3
	ldr	r3, .L2+4
	str	r3, [r0]
	.loc 1 46 0
	mov	r0, #0
	.loc 1 43 0
	str	r2, [r1]
	.loc 1 46 0
	@ sp needed for prologue
	bx	lr
.L3:
	.align	2
.L2:
	.word	5460
	.word	-1431655766
.LFE2:
	.size	progWord, .-progWord
	.section	.debug_frame,"",%progbits
.Lframe0:
	.4byte	.LECIE0-.LSCIE0
.LSCIE0:
	.4byte	0xffffffff
	.byte	0x1
	.ascii	"\000"
	.uleb128 0x1
	.sleb128 -4
	.byte	0xe
	.byte	0xc
	.uleb128 0xd
	.uleb128 0x0
	.align	2
.LECIE0:
.LSFDE0:
	.4byte	.LEFDE0-.LASFDE0
.LASFDE0:
	.4byte	.Lframe0
	.4byte	.LFB2
	.4byte	.LFE2-.LFB2
	.align	2
.LEFDE0:
	.text
.Letext0:
	.section	.debug_info
	.4byte	0xc9
	.2byte	0x2
	.4byte	.Ldebug_abbrev0
	.byte	0x4
	.uleb128 0x1
	.4byte	.Ldebug_line0
	.4byte	.Letext0
	.4byte	.Ltext0
	.4byte	.LASF12
	.byte	0x1
	.4byte	.LASF13
	.4byte	.LASF14
	.uleb128 0x2
	.4byte	.LASF0
	.byte	0x1
	.byte	0x8
	.uleb128 0x2
	.4byte	.LASF1
	.byte	0x2
	.byte	0x5
	.uleb128 0x3
	.ascii	"int\000"
	.byte	0x4
	.byte	0x5
	.uleb128 0x2
	.4byte	.LASF2
	.byte	0x1
	.byte	0x8
	.uleb128 0x2
	.4byte	.LASF3
	.byte	0x2
	.byte	0x7
	.uleb128 0x4
	.4byte	.LASF15
	.byte	0x1
	.byte	0xa
	.4byte	0x53
	.uleb128 0x2
	.4byte	.LASF4
	.byte	0x4
	.byte	0x7
	.uleb128 0x2
	.4byte	.LASF5
	.byte	0x8
	.byte	0x5
	.uleb128 0x2
	.4byte	.LASF6
	.byte	0x8
	.byte	0x7
	.uleb128 0x5
	.4byte	0xc1
	.byte	0x1
	.4byte	.LASF16
	.byte	0x1
	.byte	0x23
	.byte	0x1
	.4byte	0x33
	.4byte	.LFB2
	.4byte	.LFE2
	.byte	0x1
	.byte	0x5d
	.uleb128 0x6
	.4byte	.LASF7
	.byte	0x1
	.byte	0x22
	.4byte	0x48
	.byte	0x1
	.byte	0x50
	.uleb128 0x6
	.4byte	.LASF8
	.byte	0x1
	.byte	0x22
	.4byte	0x48
	.byte	0x1
	.byte	0x51
	.uleb128 0x6
	.4byte	.LASF9
	.byte	0x1
	.byte	0x22
	.4byte	0x48
	.byte	0x1
	.byte	0x52
	.uleb128 0x7
	.4byte	.LASF10
	.byte	0x1
	.byte	0x24
	.4byte	0xc1
	.uleb128 0x7
	.4byte	.LASF11
	.byte	0x1
	.byte	0x25
	.4byte	0x48
	.byte	0x0
	.uleb128 0x8
	.byte	0x4
	.4byte	0xc7
	.uleb128 0x9
	.4byte	0x48
	.byte	0x0
	.section	.debug_abbrev
	.uleb128 0x1
	.uleb128 0x11
	.byte	0x1
	.uleb128 0x10
	.uleb128 0x6
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x25
	.uleb128 0xe
	.uleb128 0x13
	.uleb128 0xb
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x1b
	.uleb128 0xe
	.byte	0x0
	.byte	0x0
	.uleb128 0x2
	.uleb128 0x24
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x3e
	.uleb128 0xb
	.byte	0x0
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x24
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x3e
	.uleb128 0xb
	.byte	0x0
	.byte	0x0
	.uleb128 0x4
	.uleb128 0x16
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x5
	.uleb128 0x2e
	.byte	0x1
	.uleb128 0x1
	.uleb128 0x13
	.uleb128 0x3f
	.uleb128 0xc
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x27
	.uleb128 0xc
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x40
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x6
	.uleb128 0x5
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x2
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x7
	.uleb128 0x34
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x8
	.uleb128 0xf
	.byte	0x0
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x9
	.uleb128 0x35
	.byte	0x0
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.byte	0x0
	.section	.debug_pubnames,"",%progbits
	.4byte	0x1b
	.2byte	0x2
	.4byte	.Ldebug_info0
	.4byte	0xcd
	.4byte	0x68
	.ascii	"progWord\000"
	.4byte	0x0
	.section	.debug_aranges,"",%progbits
	.4byte	0x1c
	.2byte	0x2
	.4byte	.Ldebug_info0
	.byte	0x4
	.byte	0x0
	.2byte	0x0
	.2byte	0x0
	.4byte	.Ltext0
	.4byte	.Letext0-.Ltext0
	.4byte	0x0
	.4byte	0x0
	.section	.debug_str,"MS",%progbits,1
.LASF5:
	.ascii	"long long int\000"
.LASF7:
	.ascii	"base_address\000"
.LASF14:
	.ascii	"/home/thomas/work/bugreport\000"
.LASF12:
	.ascii	"GNU C 3.4.4\000"
.LASF8:
	.ascii	"address\000"
.LASF4:
	.ascii	"long unsigned int\000"
.LASF6:
	.ascii	"long long unsigned int\000"
.LASF13:
	.ascii	"example_3_4_4.c\000"
.LASF2:
	.ascii	"unsigned char\000"
.LASF9:
	.ascii	"data\000"
.LASF15:
	.ascii	"uint32_t\000"
.LASF3:
	.ascii	"short unsigned int\000"
.LASF16:
	.ascii	"progWord\000"
.LASF11:
	.ascii	"rd_data\000"
.LASF1:
	.ascii	"short int\000"
.LASF10:
	.ascii	"dataPtr\000"
.LASF0:
	.ascii	"char\000"
	.ident	"GCC: (GNU) 3.4.4"
	.code	16
	.file	"example_3_4_4.c"
	.section	.debug_abbrev,"",%progbits
.Ldebug_abbrev0:
	.section	.debug_info,"",%progbits
.Ldebug_info0:
	.section	.debug_line,"",%progbits
.Ldebug_line0:
	.text
.Ltext0:
	.align	2
	.global	progWord
	.code 32
	.type	progWord, %function
progWord:
.LFB2:
	.file 1 "example_3_4_4.c"
	.loc 1 35 0
	orr	ip, pc, #1
	bx	ip
	.code	16
	.globl .real_start_ofprogWord
	.thumb_func
.real_start_ofprogWord:
	.loc 1 40 0
	ldr	r3, .L2
	add	r0, r0, r3
	ldr	r3, .L2+4
	str	r3, [r0]
	.loc 1 46 0
	mov	r0, #0
	.loc 1 43 0
	str	r2, [r1]
	.loc 1 46 0
	@ sp needed for prologue
	bx	lr
.L3:
	.align	2
.L2:
	.word	5460
	.word	-1431655766
.LFE2:
	.size	progWord, .-progWord
	.section	.debug_frame,"",%progbits
.Lframe0:
	.4byte	.LECIE0-.LSCIE0
.LSCIE0:
	.4byte	0xffffffff
	.byte	0x1
	.ascii	"\000"
	.uleb128 0x1
	.sleb128 -4
	.byte	0xe
	.byte	0xc
	.uleb128 0xd
	.uleb128 0x0
	.align	2
.LECIE0:
.LSFDE0:
	.4byte	.LEFDE0-.LASFDE0
.LASFDE0:
	.4byte	.Lframe0
	.4byte	.LFB2
	.4byte	.LFE2-.LFB2
	.align	2
.LEFDE0:
	.text
.Letext0:
	.section	.debug_info
	.4byte	0xc9
	.2byte	0x2
	.4byte	.Ldebug_abbrev0
	.byte	0x4
	.uleb128 0x1
	.4byte	.Ldebug_line0
	.4byte	.Letext0
	.4byte	.Ltext0
	.4byte	.LASF12
	.byte	0x1
	.4byte	.LASF13
	.4byte	.LASF14
	.uleb128 0x2
	.4byte	.LASF0
	.byte	0x1
	.byte	0x8
	.uleb128 0x2
	.4byte	.LASF1
	.byte	0x2
	.byte	0x5
	.uleb128 0x3
	.ascii	"int\000"
	.byte	0x4
	.byte	0x5
	.uleb128 0x2
	.4byte	.LASF2
	.byte	0x1
	.byte	0x8
	.uleb128 0x2
	.4byte	.LASF3
	.byte	0x2
	.byte	0x7
	.uleb128 0x4
	.4byte	.LASF15
	.byte	0x1
	.byte	0xa
	.4byte	0x53
	.uleb128 0x2
	.4byte	.LASF4
	.byte	0x4
	.byte	0x7
	.uleb128 0x2
	.4byte	.LASF5
	.byte	0x8
	.byte	0x5
	.uleb128 0x2
	.4byte	.LASF6
	.byte	0x8
	.byte	0x7
	.uleb128 0x5
	.4byte	0xc1
	.byte	0x1
	.4byte	.LASF16
	.byte	0x1
	.byte	0x23
	.byte	0x1
	.4byte	0x33
	.4byte	.LFB2
	.4byte	.LFE2
	.byte	0x1
	.byte	0x5d
	.uleb128 0x6
	.4byte	.LASF7
	.byte	0x1
	.byte	0x22
	.4byte	0x48
	.byte	0x1
	.byte	0x50
	.uleb128 0x6
	.4byte	.LASF8
	.byte	0x1
	.byte	0x22
	.4byte	0x48
	.byte	0x1
	.byte	0x51
	.uleb128 0x6
	.4byte	.LASF9
	.byte	0x1
	.byte	0x22
	.4byte	0x48
	.byte	0x1
	.byte	0x52
	.uleb128 0x7
	.4byte	.LASF10
	.byte	0x1
	.byte	0x24
	.4byte	0xc1
	.uleb128 0x7
	.4byte	.LASF11
	.byte	0x1
	.byte	0x25
	.4byte	0x48
	.byte	0x0
	.uleb128 0x8
	.byte	0x4
	.4byte	0xc7
	.uleb128 0x9
	.4byte	0x48
	.byte	0x0
	.section	.debug_abbrev
	.uleb128 0x1
	.uleb128 0x11
	.byte	0x1
	.uleb128 0x10
	.uleb128 0x6
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x25
	.uleb128 0xe
	.uleb128 0x13
	.uleb128 0xb
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x1b
	.uleb128 0xe
	.byte	0x0
	.byte	0x0
	.uleb128 0x2
	.uleb128 0x24
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x3e
	.uleb128 0xb
	.byte	0x0
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x24
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x3e
	.uleb128 0xb
	.byte	0x0
	.byte	0x0
	.uleb128 0x4
	.uleb128 0x16
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x5
	.uleb128 0x2e
	.byte	0x1
	.uleb128 0x1
	.uleb128 0x13
	.uleb128 0x3f
	.uleb128 0xc
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x27
	.uleb128 0xc
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x40
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x6
	.uleb128 0x5
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x2
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x7
	.uleb128 0x34
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x8
	.uleb128 0xf
	.byte	0x0
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x9
	.uleb128 0x35
	.byte	0x0
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.byte	0x0
	.section	.debug_pubnames,"",%progbits
	.4byte	0x1b
	.2byte	0x2
	.4byte	.Ldebug_info0
	.4byte	0xcd
	.4byte	0x68
	.ascii	"progWord\000"
	.4byte	0x0
	.section	.debug_aranges,"",%progbits
	.4byte	0x1c
	.2byte	0x2
	.4byte	.Ldebug_info0
	.byte	0x4
	.byte	0x0
	.2byte	0x0
	.2byte	0x0
	.4byte	.Ltext0
	.4byte	.Letext0-.Ltext0
	.4byte	0x0
	.4byte	0x0
	.section	.debug_str,"MS",%progbits,1
.LASF5:
	.ascii	"long long int\000"
.LASF7:
	.ascii	"base_address\000"
.LASF14:
	.ascii	"/home/thomas/work/bugreport\000"
.LASF12:
	.ascii	"GNU C 3.4.4\000"
.LASF8:
	.ascii	"address\000"
.LASF4:
	.ascii	"long unsigned int\000"
.LASF6:
	.ascii	"long long unsigned int\000"
.LASF13:
	.ascii	"example_3_4_4.c\000"
.LASF2:
	.ascii	"unsigned char\000"
.LASF9:
	.ascii	"data\000"
.LASF15:
	.ascii	"uint32_t\000"
.LASF3:
	.ascii	"short unsigned int\000"
.LASF16:
	.ascii	"progWord\000"
.LASF11:
	.ascii	"rd_data\000"
.LASF1:
	.ascii	"short int\000"
.LASF10:
	.ascii	"dataPtr\000"
.LASF0:
	.ascii	"char\000"
	.ident	"GCC: (GNU) 3.4.4"

###########################################################################

~/work/bugreport$ arm-elf-gcc-4.0.1 -v -save-temps -g -Os -fPIC -mthumb
-mlittle-endian -mapcs -march=armv4t-mcallee-super-interworking -c example.c -o
4_0_1_thumb.o
Using built-in specs.
Target: arm-elf
Configured with: ../../gcc-4.0.1/configure --target=arm-elf --disable-threads
--disable-nls --without-headers --without-libs --enable-languages=c
Thread model: single
gcc version 4.0.1
 /usr/local/libexec/gcc/arm-elf/4.0.1/cc1 -E -quiet -v -D__USES_INITFINI__
example.c -mthumb -mlittle-endian -mapcs -march=armv4t
-mcallee-super-interworking -fPIC -fworking-directory -Os -fpch-preprocess -o
example.i
ignoring nonexistent directory
"/usr/local/lib/gcc/arm-elf/4.0.1/../../../../arm-elf/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/arm-elf/4.0.1/include
 /usr/local/lib/gcc/arm-elf/4.0.1/../../../../arm-elf/include
End of search list.
 /usr/local/libexec/gcc/arm-elf/4.0.1/cc1 -fpreprocessed example.i -quiet
-dumpbase example.c -mthumb -mlittle-endian -mapcs -march=armv4t
-mcallee-super-interworking -auxbase-strip 4_0_1_thumb.o -g -Os -version -fPIC
-o example.s
GNU C version 4.0.1 (arm-elf)
        compiled by GNU C version 3.4.2 [FreeBSD] 20040728.
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129972
 /usr/local/lib/gcc/arm-elf/4.0.1/../../../../arm-elf/bin/as -EL -march=armv4t
-o 4_0_1_thumb.o example.s

###########################################################################
file example.i
###########################################################################
# 1 "example.c"
# 1 "/home/thomas/work/bugreport//"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "example.c"



typedef char int8_t;
typedef short int16_t;
typedef int int32_t;

typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;


typedef int __attribute__((__mode__(__DI__))) int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
# 34 "example.c"
int progWord(uint32_t base_address,uint32_t address,uint32_t data)
{
 volatile uint32_t *dataPtr;
 uint32_t rd_data;


 *((volatile uint32_t *)(base_address + (0x555uL<<2))) = 0xAAAAaaaa;

 dataPtr = (uint32_t *)address;
 *dataPtr = data;

 return 0;
}
###########################################################################
file example.s
###########################################################################
	.code	16
	.file	"example.c"
	.section	.debug_abbrev,"",%progbits
.Ldebug_abbrev0:
	.section	.debug_info,"",%progbits
.Ldebug_info0:
	.section	.debug_line,"",%progbits
.Ldebug_line0:
	.text
.Ltext0:
	.align	2
	.global	progWord
	.code 32
	.type	progWord, %function
progWord:
.LFB2:
	.file 1 "example.c"
	.loc 1 35 0
	orr	ip, pc, #1
	bx	ip
	.code	16
	.globl .real_start_ofprogWord
	.thumb_func
.real_start_ofprogWord:
	push	{r7}
.LCFI0:
	mov	r7, sl
	push	{r7}
.LCFI1:
.LVL0:
	.loc 1 40 0
	ldr	r3, .L3
	add	r0, r0, r3
.LVL1:
	ldr	r3, .L3+4
	str	r3, [r0]
	.loc 1 46 0
	mov	r0, #0
	.loc 1 43 0
	str	r2, [r1]
	.loc 1 46 0
	@ sp needed for prologue
	pop	{r2}
	mov	sl, r2
	pop	{r7}
	bx	lr
.L4:
	.align	2
.L3:
	.word	5460
	.word	-1431655766
.LFE2:
	.size	progWord, .-progWord
	.section	.debug_frame,"",%progbits
.Lframe0:
	.4byte	.LECIE0-.LSCIE0
.LSCIE0:
	.4byte	0xffffffff
	.byte	0x1
	.ascii	"\000"
	.uleb128 0x1
	.sleb128 -4
	.byte	0xe
	.byte	0xc
	.uleb128 0xd
	.uleb128 0x0
	.align	2
.LECIE0:
.LSFDE0:
	.4byte	.LEFDE0-.LASFDE0
.LASFDE0:
	.4byte	.Lframe0
	.4byte	.LFB2
	.4byte	.LFE2-.LFB2
	.byte	0x4
	.4byte	.LCFI0-.LFB2
	.byte	0xe
	.uleb128 0x4
	.byte	0x87
	.uleb128 0x1
	.byte	0x4
	.4byte	.LCFI1-.LCFI0
	.byte	0xe
	.uleb128 0x8
	.byte	0x8a
	.uleb128 0x2
	.align	2
.LEFDE0:
	.text
.Letext0:
	.section	.debug_loc,"",%progbits
.Ldebug_loc0:
.LLST0:
	.4byte	.LVL0-.Ltext0
	.4byte	.LVL1-.Ltext0
	.2byte	0x1
	.byte	0x50
	.4byte	0x0
	.4byte	0x0
	.section	.debug_info
	.4byte	0xcc
	.2byte	0x2
	.4byte	.Ldebug_abbrev0
	.byte	0x4
	.uleb128 0x1
	.4byte	.Ldebug_line0
	.4byte	.Letext0
	.4byte	.Ltext0
	.4byte	.LASF12
	.byte	0x1
	.4byte	.LASF13
	.4byte	.LASF14
	.uleb128 0x2
	.4byte	.LASF0
	.byte	0x1
	.byte	0x8
	.uleb128 0x2
	.4byte	.LASF1
	.byte	0x2
	.byte	0x5
	.uleb128 0x3
	.ascii	"int\000"
	.byte	0x4
	.byte	0x5
	.uleb128 0x2
	.4byte	.LASF2
	.byte	0x1
	.byte	0x8
	.uleb128 0x2
	.4byte	.LASF3
	.byte	0x2
	.byte	0x7
	.uleb128 0x4
	.4byte	.LASF15
	.byte	0x1
	.byte	0xa
	.4byte	0x53
	.uleb128 0x2
	.4byte	.LASF4
	.byte	0x4
	.byte	0x7
	.uleb128 0x2
	.4byte	.LASF5
	.byte	0x8
	.byte	0x5
	.uleb128 0x2
	.4byte	.LASF6
	.byte	0x8
	.byte	0x7
	.uleb128 0x5
	.4byte	0xc4
	.byte	0x1
	.4byte	.LASF16
	.byte	0x1
	.byte	0x23
	.byte	0x1
	.4byte	0x33
	.4byte	.LFB2
	.4byte	.LFE2
	.byte	0x2
	.byte	0x7d
	.sleb128 0
	.uleb128 0x6
	.4byte	.LASF7
	.byte	0x1
	.byte	0x22
	.4byte	0x48
	.4byte	.LLST0
	.uleb128 0x7
	.4byte	.LASF8
	.byte	0x1
	.byte	0x22
	.4byte	0x48
	.byte	0x1
	.byte	0x51
	.uleb128 0x7
	.4byte	.LASF9
	.byte	0x1
	.byte	0x22
	.4byte	0x48
	.byte	0x1
	.byte	0x52
	.uleb128 0x8
	.4byte	.LASF10
	.byte	0x1
	.byte	0x24
	.4byte	0xc4
	.uleb128 0x8
	.4byte	.LASF11
	.byte	0x1
	.byte	0x25
	.4byte	0x48
	.byte	0x0
	.uleb128 0x9
	.byte	0x4
	.4byte	0xca
	.uleb128 0xa
	.4byte	0x48
	.byte	0x0
	.section	.debug_abbrev
	.uleb128 0x1
	.uleb128 0x11
	.byte	0x1
	.uleb128 0x10
	.uleb128 0x6
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x25
	.uleb128 0xe
	.uleb128 0x13
	.uleb128 0xb
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x1b
	.uleb128 0xe
	.byte	0x0
	.byte	0x0
	.uleb128 0x2
	.uleb128 0x24
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x3e
	.uleb128 0xb
	.byte	0x0
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x24
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x3e
	.uleb128 0xb
	.byte	0x0
	.byte	0x0
	.uleb128 0x4
	.uleb128 0x16
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x5
	.uleb128 0x2e
	.byte	0x1
	.uleb128 0x1
	.uleb128 0x13
	.uleb128 0x3f
	.uleb128 0xc
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x27
	.uleb128 0xc
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x40
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x6
	.uleb128 0x5
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x2
	.uleb128 0x6
	.byte	0x0
	.byte	0x0
	.uleb128 0x7
	.uleb128 0x5
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x2
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x8
	.uleb128 0x34
	.byte	0x0
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x9
	.uleb128 0xf
	.byte	0x0
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0xa
	.uleb128 0x35
	.byte	0x0
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.byte	0x0
	.section	.debug_pubnames,"",%progbits
	.4byte	0x1b
	.2byte	0x2
	.4byte	.Ldebug_info0
	.4byte	0xd0
	.4byte	0x68
	.ascii	"progWord\000"
	.4byte	0x0
	.section	.debug_aranges,"",%progbits
	.4byte	0x1c
	.2byte	0x2
	.4byte	.Ldebug_info0
	.byte	0x4
	.byte	0x0
	.2byte	0x0
	.2byte	0x0
	.4byte	.Ltext0
	.4byte	.Letext0-.Ltext0
	.4byte	0x0
	.4byte	0x0
	.section	.debug_str,"MS",%progbits,1
.LASF5:
	.ascii	"long long int\000"
.LASF7:
	.ascii	"base_address\000"
.LASF12:
	.ascii	"GNU C 4.0.1\000"
.LASF14:
	.ascii	"/home/thomas/work/bugreport\000"
.LASF8:
	.ascii	"address\000"
.LASF4:
	.ascii	"long unsigned int\000"
.LASF6:
	.ascii	"long long unsigned int\000"
.LASF2:
	.ascii	"unsigned char\000"
.LASF9:
	.ascii	"data\000"
.LASF15:
	.ascii	"uint32_t\000"
.LASF13:
	.ascii	"example.c\000"
.LASF3:
	.ascii	"short unsigned int\000"
.LASF16:
	.ascii	"progWord\000"
.LASF11:
	.ascii	"rd_data\000"
.LASF1:
	.ascii	"short int\000"
.LASF10:
	.ascii	"dataPtr\000"
.LASF0:
	.ascii	"char\000"
	.ident	"GCC: (GNU) 4.0.1"




-- 


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


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

* [Bug target/23355] size optimizer did not eliminateing useless Push and pop instructions at ARM/Thumb machine
  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
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2005-08-15  9:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2005-08-15 09:33 -------
Confirmed.  thumb_compute_save_reg_mask() should use similar logic to
arm_compute_save_reg0_reg12_mask() so that the pic register is only saved when
required.

BTW.  Next time can you add files to the attachments panel in bugzilla, rather
than pasting them in.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rearnsha at gcc dot gnu dot
                   |                            |org
             Status|WAITING                     |NEW
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
           Priority|P2                          |P3
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-15 09:33:43
               date|                            |


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


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

* [Bug target/23355] size optimizer did not eliminateing useless Push and pop instructions at ARM/Thumb machine
  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
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-16  9:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-16 09:28 -------
Subject: Bug 23355

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rearnsha@gcc.gnu.org	2005-08-16 09:27:58

Modified files:
	gcc            : ChangeLog 
	gcc/config/arm : arm.c 

Log message:
	PR target/23355
	* arm.c (thumb_compute_save_reg_mask): Use similar logic to
	arm_compure_save_reg0_reg12_mask to determine when the PIC register
	must be saved.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9740&r2=2.9741
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.c.diff?cvsroot=gcc&r1=1.472&r2=1.473



-- 


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


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

* [Bug target/23355] size optimizer did not eliminateing useless Push and pop instructions at ARM/Thumb machine
  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
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2005-08-16  9:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2005-08-16 09:29 -------
Fixed on trunk.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


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


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

* [Bug target/23355] size optimizer did not eliminateing useless Push and pop instructions at ARM/Thumb machine
  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
                   ` (5 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: th dot r dot klein at web dot de @ 2005-08-16 18:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From th dot r dot klein at web dot de  2005-08-16 18:13 -------
This is working.
Thanks a lot

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |VERIFIED


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