Gcc generates different 32bit assembly codes in 32bit and 64bit hosts:

1. On 64bit host,

[EMAIL PROTECTED] stage1-gcc]$ cat x.i
_Decimal128 test (void)
{
  return 1234123412341234.123412341234dl;
}
[EMAIL PROTECTED] stage1-gcc]$ ./xgcc -B./ -msse -S -m32  -march=i386 
-mtune=generic
x.i
[EMAIL PROTECTED] stage1-gcc]$ cat x.s
        .file   "x.i"
        .text
.globl test
        .type   test, @function
test:
        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %eax
        movaps  .LC0, %xmm0
        movaps  %xmm0, (%eax)
        popl    %ebp
        ret     $4
        .size   test, .-test
        .section        .rodata
        .align 16
.LC0:
        .long   84673010
        .long   1025550150
        .long   66901964
        .long   807927808
        .ident  "GCC: (GNU) 4.4.0 20080304 (experimental) [trunk revision
132852]"
        .section        .note.GNU-stack,"",@progbits
[EMAIL PROTECTED] stage1-gcc]$

2. On 32bit host,

[EMAIL PROTECTED] stage1-gcc]$ cat x.i
_Decimal128 test (void)
{
  return 1234123412341234.123412341234dl;
}
[EMAIL PROTECTED] stage1-gcc]$ ./xgcc -B./ -msse -S -m32 -march=i386 
-mtune=generic
x.i
[EMAIL PROTECTED] stage1-gcc]$ cat x.s
        .file   "x.i"
        .text
.globl test
        .type   test, @function
test:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $24, %esp
        movl    8(%ebp), %eax
        movaps  .LC0, %xmm0
        movaps  %xmm0, -24(%ebp)
        movaps  -24(%ebp), %xmm0
        movaps  %xmm0, (%eax)
        leave
        ret     $4
        .size   test, .-test
        .section        .rodata
        .align 16
.LC0:
        .long   84673010
        .long   1025550150
        .long   66901964
        .long   807927808
        .ident  "GCC: (GNU) 4.4.0 20080304 (experimental) [trunk revision
132852]"
        .section        .note.GNU-stack,"",@progbits
[EMAIL PROTECTED] stage1-gcc]$

Where does "subl    $24, %esp" on 32bit host come from?


-- 
           Summary: Different assembly codes on 32bit and 64bit hosts
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com
GCC target triplet: x86_64-unknown-linux-gnu


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

Reply via email to