public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/12038] New: more optimization with -Os option for arm
@ 2003-08-22 23:39 vittasoft at yahoo dot com
  2003-08-23  0:05 ` [Bug c/12038] " vittasoft at yahoo dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vittasoft at yahoo dot com @ 2003-08-22 23:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: more optimization with -Os option for arm
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vittasoft at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686
  GCC host triplet: i686
GCC target triplet: arm-thumb-elf

If function contains any branches (generated by if/for/do/while), compiler saves
lr register into stack. You can see it in this example:

unsigned int my(char *s){
  if(s == NULL)
     return 1;
  return 0;
};

try to compile it with -mthumb -Os -S and you will see code like this:

        .align  2
        .global my
        .thumb_func
        .type   my,function
my:
        push    {lr}         @ <------ It's because function have a branch
        cmp     r0, #0
        beq     .L11
        mov     r0, #0
.L9:
        @ sp needed for prologue
        pop     {pc}
.L11:
        mov     r0, #1
        b       .L9          
.Lfe2:
        .size   my,.Lfe2-my
@ <--- gcc-3.3.1/gcc/config/arm/arm.c:thumb_far_jump_used_p
@ always returns 1 if branch command founds.
@ in this case get_attr_far_jump (insn) always returns FAR_JUMP_YES on branch,
@ because it's check length of attribute and attribute length always equal 8


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

end of thread, other threads:[~2004-05-21  3:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-22 23:39 [Bug c/12038] New: more optimization with -Os option for arm vittasoft at yahoo dot com
2003-08-23  0:05 ` [Bug c/12038] " vittasoft at yahoo dot com
2003-08-23  2:16 ` pinskia at gcc dot gnu dot org
2003-08-24 19:53 ` vittasoft at yahoo dot com
2003-08-24 19:58 ` [Bug target/12038] " pinskia at gcc dot gnu dot org
2003-09-05 11:08 ` rearnsha at gcc dot gnu dot org
2004-05-22  5:20 ` pinskia at gcc dot gnu dot org

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