This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386] Unify TARGET_SSE_MATH and TARGET_MIX_SSE_I387 ininsn constraints
- From: Uros Bizjak <uros at kss-loka dot si>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 09 Dec 2004 07:44:27 +0100
- Subject: Re: [PATCH, i386] Unify TARGET_SSE_MATH and TARGET_MIX_SSE_I387 ininsn constraints
- References: <41B72A01.4080702@kss-loka.si> <20041208183325.GA17826@redhat.com>
Richard Henderson wrote:
On Wed, Dec 08, 2004 at 05:21:21PM +0100, Uros Bizjak wrote:
There is a big mess regarding TARGET_SSE_MATH and TARGET_MIX_SSE_I387
handling in i386.md file. Actually every pattern handles these macros in
its own way and it is very difficult to figure out the conditions under
which certain pattern is enabled.
I think this is too invasive for stage3. Please hold onto this
for when 4.1 opens. If there is a bug fix in here, perhaps it
can be extracted by itself?
There is a problem with integer conversion from SI -> SF and SI -> DF
for '-march=pentium4 -mfpmath=387' (the default), where SSE cvtsi2ss and
cvtsi2sd are used instead of 387's fild insn. The testcase:
float test1sisf(int x) {
return x;
}
double test1sidf(int x) {
return x;
}
is then compiled into:
test1sisf:
pushl %ebp
movl %esp, %ebp
subl $4, %esp
cvtsi2ss 8(%ebp), %xmm0
movss %xmm0, -4(%ebp)
flds -4(%ebp)
leave
ret
test1sidf:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
cvtsi2sd 8(%ebp), %xmm0
movsd %xmm0, -8(%ebp)
fldl -8(%ebp)
leave
ret
This is quite bad code, compared to what it should produce for both
testcases:
test1sisf:
pushl %ebp
movl %esp, %ebp
fildl 8(%ebp)
popl %ebp
ret
I tried to solve this problem with the minimum patch, but I got lost in
the maze of options. That is why I propose this approach. Actually, the
biggest part of patch is the solution to "float" patterns. The change to
other fop_* patterns is just a rename, so the minimum patch for "float"
patterns would be perhaps some 10 lines shorter...
Uros.