This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
optimization/6562: useless subl/addl $12, %esp in small functions involving sse2
- From: Sylvain dot Pion at sophia dot inria dot fr
- To: gcc-gnats at gcc dot gnu dot org
- Cc: Sylvain dot Pion at sophia dot inria dot fr
- Date: 5 May 2002 04:27:19 -0000
- Subject: optimization/6562: useless subl/addl $12, %esp in small functions involving sse2
- Reply-to: Sylvain dot Pion at sophia dot inria dot fr
>Number: 6562
>Category: optimization
>Synopsis: useless subl/addl $12, %esp in small functions involving sse2
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Sat May 04 21:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Sylvain Pion
>Release: 3.1 and 3.2 20020502
>Organization:
>Environment:
Configured with: /u/zosma/0/prisme/spion/gcc/gcc_trunc/configure --disable-shared --disable-nls --enable-languages=c++ --prefix=/u/zosma/0/prisme/spion/gcc/Linux_trunc --with-gnu-as --with-gnu-ld --with-as=/u/zosma/0/prisme/spion/gcc/Binutils/Linux/bin/as --with-ld=/u/zosma/0/prisme/spion/gcc/Binutils/Linux/bin/ld
Thread model: single
gcc version 3.2 20020502 (experimental)
>Description:
Compiling small functions sometimes adds unnecessary
"subl $12, %esp" and "addl $12, %esp".
For example, the attached function involving SSE2, which
produces the x86 assembly :
add:
subl $12, %esp
movsd 24(%esp), %xmm0
addsd 16(%esp), %xmm0
movsd %xmm0, (%esp)
fldl (%esp)
addl $12, %esp
ret
A similar problem appears with C++ try blocks (see PR 3962), so it's not SSE related.
>How-To-Repeat:
Compile the following function with :
gcc -S -O2 -fomit-frame-pointer -mfpmath=sse -march=pentium4 foo.c
double add(double a, double b) { return a+b; }
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: