Hi,

  With -Os option, open64 does not generate the following code as we wanted,
while gcc does

int x,y,z;
void b(){
  y-=2;
}
int a(){
  if (z == 1){
    x +=y;
    return x;
  }
  if (z == 2){
    z ++;
    x +=y;
    return x;
  }
  if (z ==3){
    b();
    x +=y;
    return x;
  }
}



open64 produces:
.LBB9_a:
        movl %ebp,%eax                  # [0]
        movl 0(%esp),%ebp               # [0] _temp_gra_spill0
        movl 4(%esp),%ebx               # [0] _temp_gra_spill1
        addl $12,%esp                   # [1]
        ret
  # [1]
.LBB2_a:
        movl x,%eax                     # [0] id:20 x+0x0
        movl y,%ebp                     # [0] id:22 y+0x0
        addl %eax,%ebp                  # [3]
        movl %ebp,x                     # [4] id:20 x+0x0
        .loc    1       8       0
        jmp .LBB9_a                     # [4]
.LBB4_a:
        movl x,%eax                     # [0] id:20 x+0x0
        movl y,%ebp                     # [0] id:22 y+0x0
        leal 1(%edx),%ebx               # [0]
        movl %ebx,z                     # [2] id:21 z+0x0
        addl %eax,%ebp                  # [3]
        movl %ebp,x                     # [4] id:20 x+0x0
        jmp .LBB9_a                     # [4]
.LBB6_a:
        call b                          # [0] b
.LBB7_a:
        movl x,%eax                     # [0] id:20 x+0x0
        movl y,%ebp                     # [0] id:22 y+0x0
        addl %eax,%ebp                  # [3]
        movl %ebp,x                     # [4] id:20 x+0x0
        jmp .LBB9_a                     # [4]
.LDWend_a:

while gcc produces:
a:
        movl    z, %eax
        pushl   %ebp
        movl    %esp, %ebp
        cmpl    $1, %eax
        je      .L7
.L3:
        cmpl    $2, %eax
        jne     .L5
        movl    $3, z
        jmp     .L7
.L5:
        cmpl    $3, %eax
        jne     .L6
        call    b
.L7:
        movl    y, %eax
        addl    x, %eax
        movl    %eax, x
        jmp     .L2
.L6:
.L2:
        popl    %ebp
        ret

Any options or hints?

Thanks


Gang
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to