This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, i386]: Partially fix PR 19398


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.

Attachment: pr19398.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]