[PATCH, i386]: Partially fix PR 19398

Uros Bizjak uros.bizjak@kss-loka.si
Tue Nov 8 15:55:00 GMT 2005


Hello!

This patch is based on an observation that using fix_trunc?f?i_sse patterns for
'-msse2 -mfpmath=387', x87->mem->XMM reload sequences are produced to satisfy
input constraints of fix_trunc?f?i_sse insn pattern.

This sequence is not optimal, as cvttsd2si (and similar) instructions also
accept memory operand as its input.

Without patch, following asm is generated:

 8054c11:	dd 55 e0             	fstl   0xffffffe0(%ebp)
 8054c14:	f2 0f 10 45 e0       	movsd  0xffffffe0(%ebp),%xmm0
 8054c19:	f2 0f 2c f8          	cvttsd2si %xmm0,%edi

And with patch:

 8054c01:	dd 55 e0             	fstl   0xffffffe0(%ebp)
 8054c04:	f2 0f 2c 7d e0       	cvttsd2si 0xffffffe0(%ebp),%edi

This patch doesn't fix all generic reload problems with secondary memory and
memory inputs (PR 19398), but fixes IMO the most problematic case.

The transformation is disabled for TARGET_K8 as it results in vector decoded
form of instruction.

2005-11-08  Uros Bizjak  <uros@kss-loka.si>

	* config/i386/i386.md (fix_trunc?f?i_sse): Add peephole2
	patterns to use memory input operand in x87->mem->XMM
	reload sequences.  Skip transformation for TARGET_K8.

Patch is regtested on i686-pc-linux-gnu for c and c++. OK for 4.2?

Uros.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr19398.diff
Type: application/octet-stream
Size: 1073 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20051108/cff7eadb/attachment.obj>


More information about the Gcc-patches mailing list