This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386]: Rewrite x87 sqrt patterns, take 2a (macroized)
- From: Roger Sayle <roger at eyesopen dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: Michael Matz <matz at suse dot de>, Andrew Haley <aph at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 24 Nov 2006 18:53:28 -0700 (MST)
- Subject: Re: [PATCH, i386]: Rewrite x87 sqrt patterns, take 2a (macroized)
Hi Uros,
On Fri, 24 Nov 2006, Uros Bizjak wrote:
> 2006-11-24 Uros Bizjak <ubizjak@gmail.com>
>
> config/i386/i386.md (UNSPEC_TRUNC_NOOP): New unspec definition.
> (X87MODEF): New mode macro.
> (ssemodefsuffix): New mode attribute.
> (truncxf<mode>2_i387_noop_unspec): New insn pattern.
> (sqrt_extend<mode>xf2_i387): New insn pattern.
> (sqrt<mode>2): For non-SSE sqrt, emit sqrt_extend<mode>xf2_i387
> insn and truncate result back to original mode using
> UNSPEC_TRUNC_NOOP truncation.
> (*sqrt<mode>2_sse): Implement using SSEMODEF mode macro and
> ssemodefsuffix mode attribute.
> (*sqrtsf2_mixed, *sqrtsf2_i387, *sqrtdf2_mixed, *sqrtdf2_i387)
> (*sqrtextendsfdf2_i387, *sqrtextendsfxf2_i387)
> (*sqrtextenddfxf2_i387): Remove insn patterns.
>
> (fmodsf3, fmoddf3, remaindersf3, remainderdf3): Use noop
> truncation patterns.
>
> reg-stack.c (get_true_reg): Handle UNSPEC_TRUNC_NOOP.
This patch looks like a step in the right direction. Ok for mainline.
However my brain isn't working at the moment, so I'm unsure whether and
how the UNSPEC_TRUNC_NOOP gets optimized away with -ffast-math. For
example, i386.c's output_387_reg_move doesn't appear to do anything
clever when operands[0] == operands[1]. However even without
understanding exactly what's going on, I agree with the philosophy
of making the XFmode operations more explicit and using macros to
simplify the backends patterns, and I trust you enough that your
implementation is sound. I can figure out how things work once its
in the tree.
Thanks again.
:REVIEWMAIL:
Roger
--