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]

Re: [PATCH, i386] Unify TARGET_SSE_MATH for trunc* patterns


Richard Henderson wrote:

On Fri, Dec 17, 2004 at 11:39:40AM +0100, Uros Bizjak wrote:


-(define_insn "*truncdfsf2_1_sse"
+(define_insn "*truncdfsf2_2"


...


-(define_insn "*truncdfsf2_1_sse_nooverlap"
+(define_insn "*truncdfsf2_2_nooverlap"


...


-(define_insn "*truncdfsf2_2"
+(define_insn "*truncdfsf2_mixed"



Missed truncdfsf2_1? You're not ordering these as we discussed,
and you had been doing for the other patches. Which makes me doubt we'll select the proper pattern.


No, it is present, but patch generator didn't list the pattern name as this name is already present in original sources. A couple of patterns are moved around and it looks that new truncdfsf2_1 matched previous name. If the patch is applied, truncdfsf2_1 is defined as:

(define_insn "*truncdfsf2_1"
 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
   (float_truncate:SF
    (match_operand:DF 1 "register_operand" "f,f,f,f")))
  (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))]
 "TARGET_80387 && !TARGET_SSE2"
...

Now we have:

(define_expand "truncdfsf2"
 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
...

The pattern above generates truncdfsf2_sse pattern with (TARGET_SSE2 && TARGET_SSE_MATH).
With (flag_unsafe_math_optimizations) it generates truncdfsf2_i387_noop, a no-trunc reg-reg pattern without temporary mem slot. For non-fast-math 387 operations, a mem slot is assigned and correct truncation is performed.


(define_insn "truncdfsf2_i387_noop"
 "TARGET_80387 && flag_unsafe_math_optimizations"
...

The pattern above is needed in a couple of other expanders, when -ffast-math is specified.

Here comes the mess of 'mixed' patterns that should be cleaned up.

(define_insn "*truncdfsf2_1"
"TARGET_80387 && !TARGET_SSE2"
...
truncdfsf2_1 pattern above is a 'mixed' pattern for TARGET_SSE only and handles DF FP-> SF XMM conversions.


(define_insn "*truncdfsf2_2"
"TARGET_80387 && TARGET_SSE2 && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
...
(define_insn "*truncdfsf2_2_nooverlap"
"TARGET_80387 && TARGET_SSE2 && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
...
truncdfsf2_2 is a 'mixed' pattern for TARGET_SSE2 only that handles all possible DF -> SF combinations for FP, SSE and SSE2 registers.


(define_insn "*truncdfsf2_mixed"
 "TARGET_SSE2 && TARGET_MIX_SSE_I387
  && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS
...

(define_insn "*truncdfsf2_mixed_nooverlap"
 "TARGET_SSE2 && TARGET_MIX_SSE_I387
  && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS
...

The patterns above are actually the same stuff as *_1 and *_2 patterns above.

I guess following patterns are OK.

(define_insn "truncdfsf2_sse"
 "TARGET_SSE2 && TARGET_SSE_MATH
  && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
...

(define_insn "*truncdfsf2_sse_nooverlap"
 "TARGET_SSE2 && TARGET_SSE_MATH
  && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"


(define_insn "*truncdfsf2_i387" "TARGET_80387" ...

(splitters go here)

I'll make an updated and cleaned version of patch.

Uros.


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