[4.0 PATCH] Tweak *truncsfdf_fast_i387 pattern in i386.md (Take 2)

Roger Sayle roger@eyesopen.com
Mon Apr 4 21:34:00 GMT 2005


On Mon, 4 Apr 2005, Uros Bizjak wrote:
> It is the job of "*truncdfsf_fast_i387" to handle writes to memory.
> However, this pattern is at the moment enabled only for
> flag_unsafe_math_optimizations.

Many thanks to Uros for his feedback.  The following patch implements
his suggestion of tweaking the constraint of the *truncdfsf_fast_i387
pattern in i386.md, to allow it enable it when the destination is a
memory operand, even when flag_unsafe_math_optimizations is false.

The revised patch below has been tested on i686-pc-linux-gnu with a
full "make bootstrap", all default languages, and regression tested
with a top-level "make -k check" with no new failures.

Ok for mainline and the 4.0 branch (as this is regression from 3.4)?
Many thanks to Andrew Pinksi for confirming this is a regression.



2005-04-04  Roger Sayle  <roger@eyesopen.com>
	    Uros Bizjak  <uros@kss-loka.si>

	* config/i386/i386.md (*truncdfsf_fast_i387): Enable pattern when
	writing to memory, even when !flag_unsafe_math_optimizations.


Index: config/i386/i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.622
diff -c -3 -p -r1.622 i386.md
*** config/i386/i386.md	1 Apr 2005 03:42:48 -0000	1.622
--- config/i386/i386.md	4 Apr 2005 14:10:42 -0000
***************
*** 3734,3740 ****
    [(set (match_operand:SF 0 "nonimmediate_operand"   "=fm")
          (float_truncate:SF
            (match_operand:DF 1 "nonimmediate_operand" "f")))]
!   "TARGET_80387 && flag_unsafe_math_optimizations"
    "* return output_387_reg_move (insn, operands);"
    [(set_attr "type" "fmov")
     (set_attr "mode" "SF")])
--- 3734,3740 ----
    [(set (match_operand:SF 0 "nonimmediate_operand"   "=fm")
          (float_truncate:SF
            (match_operand:DF 1 "nonimmediate_operand" "f")))]
!   "TARGET_80387 && (MEM_P (operands[0]) || flag_unsafe_math_optimizations)"
    "* return output_387_reg_move (insn, operands);"
    [(set_attr "type" "fmov")
     (set_attr "mode" "SF")])

Roger
--



More information about the Gcc-patches mailing list