This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
i386 min?f/max?f -ffast-math fix
- To: gcc-patches at gcc dot gnu dot org, patches at x86-64 dot org, rth at cygnus dot com
- Subject: i386 min?f/max?f -ffast-math fix
- From: Jan Hubicka <jh at suse dot cz>
- Date: Mon, 4 Jun 2001 17:23:36 +0200
Hi,
The template of max?f_noniee and friends contains '%', as the
operation is commutative. After reload it may result in cross matching
with the (match_dup) operands.
The splitters can't use '%' and require operands to match in order
resulting in unsplittable insn in some cases.
Honza
Mon Jun 4 17:20:32 CEST 2001 Jan Hubicka <jh@suse.cz>
* (min?f, max?f splitters): Handle case where
operands are cross-matched.
Index: gcc/config/i386/i386.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.270
diff -c -3 -p -r1.270 i386.md
*** i386.md 2001/05/17 00:53:25 1.270
--- i386.md 2001/06/04 14:45:53
***************
*** 15801,15822 ****
(define_insn "*minsf_nonieee"
[(set (match_operand:SF 0 "register_operand" "=x#f,f#x")
(if_then_else:SF (lt (match_operand:SF 1 "register_operand" "%0,0")
(match_operand:SF 2 "nonimmediate_operand" "xm#f,fm#x"))
(match_dup 1)
(match_dup 2)))
(clobber (reg:CC 17))]
"TARGET_SSE && !TARGET_IEEE_FP"
"#")
(define_split
[(set (match_operand:SF 0 "register_operand" "")
(if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
(match_operand:SF 2 "nonimmediate_operand" ""))
! (match_dup 1)
! (match_dup 2)))
(clobber (reg:CC 17))]
! "SSE_REG_P (operands[0]) && reload_completed"
[(set (match_dup 0)
(if_then_else:SF (lt (match_dup 1)
(match_dup 2))
--- 15823,15859 ----
(define_insn "*minsf_nonieee"
[(set (match_operand:SF 0 "register_operand" "=x#f,f#x")
(if_then_else:SF (lt (match_operand:SF 1 "register_operand" "%0,0")
(match_operand:SF 2 "nonimmediate_operand" "xm#f,fm#x"))
(match_dup 1)
(match_dup 2)))
(clobber (reg:CC 17))]
"TARGET_SSE && !TARGET_IEEE_FP"
"#")
(define_split
[(set (match_operand:SF 0 "register_operand" "")
+ (smin:SF (match_operand:SF 1 "register_operand" "")
+ (match_operand:SF 2 "nonimmediate_operand" "")))
+ (clobber (reg:CC 17))]
+ "SSE_REG_P (operands[0]) && reload_completed"
+ [(set (match_dup 0)
+ (if_then_else:SF (lt (match_dup 1)
+ (match_dup 2))
+ (match_dup 1)
+ (match_dup 2)))])
+ (define_split
+ [(set (match_operand:SF 0 "register_operand" "")
(if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
(match_operand:SF 2 "nonimmediate_operand" ""))
! (match_operand:DF 3 "register_operand" "")
! (match_operand:DF 4 "nonimmediate_operand" "")))
(clobber (reg:CC 17))]
! "SSE_REG_P (operands[0]) && reload_completed
! && ((operands_match_p (operands[1], operands[3])
! && operands_match_p (operands[2], operands[4]))
! || (operands_match_p (operands[1], operands[4])
! && operands_match_p (operands[2], operands[3])))"
[(set (match_dup 0)
(if_then_else:SF (lt (match_dup 1)
(match_dup 2))
***************
*** 15826,15837 ****
;; We can't represent the LT test directly. Do this by swapping the operands.
(define_split
[(set (match_operand:SF 0 "register_operand" "")
(if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
(match_operand:SF 2 "register_operand" ""))
! (match_dup 1)
! (match_dup 2)))
(clobber (reg:CC 17))]
! "FP_REG_P (operands[0]) && reload_completed"
[(set (reg:CCFP 17)
(compare:CCFP (match_dup 2)
(match_dup 1)))
--- 15861,15894 ----
;; We can't represent the LT test directly. Do this by swapping the operands.
(define_split
[(set (match_operand:SF 0 "register_operand" "")
+ (smin:SF (match_operand:SF 1 "register_operand" "")
+ (match_operand:SF 2 "register_operand" "")))
+ (clobber (reg:CC 17))]
+ "FP_REG_P (operands[0]) && reload_completed
+ && ((operands_match_p (operands[1], operands[3])
+ && operands_match_p (operands[2], operands[4]))
+ || (operands_match_p (operands[1], operands[4])
+ && operands_match_p (operands[2], operands[3])))"
+ [(set (reg:CCFP 17)
+ (compare:CCFP (match_dup 2)
+ (match_dup 1)))
+ (set (match_dup 0)
+ (if_then_else:SF (ge (reg:CCFP 17) (const_int 0))
+ (match_dup 1)
+ (match_dup 2)))])
+
+ (define_split
+ [(set (match_operand:SF 0 "register_operand" "")
(if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
(match_operand:SF 2 "register_operand" ""))
! (match_operand:DF 3 "register_operand" "")
! (match_operand:DF 4 "register_operand" "")))
(clobber (reg:CC 17))]
! "FP_REG_P (operands[0]) && reload_completed
! && ((operands_match_p (operands[1], operands[3])
! && operands_match_p (operands[2], operands[4]))
! || (operands_match_p (operands[1], operands[4])
! && operands_match_p (operands[2], operands[3])))"
[(set (reg:CCFP 17)
(compare:CCFP (match_dup 2)
(match_dup 1)))
***************
*** 15886,15895 ****
[(set (match_operand:DF 0 "register_operand" "")
(if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
(match_operand:DF 2 "nonimmediate_operand" ""))
! (match_dup 1)
! (match_dup 2)))
(clobber (reg:CC 17))]
! "SSE_REG_P (operands[0]) && reload_completed"
[(set (match_dup 0)
(if_then_else:DF (lt (match_dup 1)
(match_dup 2))
--- 15943,15956 ----
[(set (match_operand:DF 0 "register_operand" "")
(if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
(match_operand:DF 2 "nonimmediate_operand" ""))
! (match_operand:DF 3 "register_operand" "")
! (match_operand:DF 4 "nonimmediate_operand" "")))
(clobber (reg:CC 17))]
! "SSE_REG_P (operands[0]) && reload_completed
! && ((operands_match_p (operands[1], operands[3])
! && operands_match_p (operands[2], operands[4]))
! || (operands_match_p (operands[1], operands[4])
! && operands_match_p (operands[2], operands[3])))"
[(set (match_dup 0)
(if_then_else:DF (lt (match_dup 1)
(match_dup 2))
***************
*** 15901,15910 ****
[(set (match_operand:DF 0 "register_operand" "")
(if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
(match_operand:DF 2 "register_operand" ""))
! (match_dup 1)
! (match_dup 2)))
(clobber (reg:CC 17))]
! "FP_REG_P (operands[0]) && reload_completed"
[(set (reg:CCFP 17)
(compare:CCFP (match_dup 2)
(match_dup 2)))
--- 15962,15975 ----
[(set (match_operand:DF 0 "register_operand" "")
(if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
(match_operand:DF 2 "register_operand" ""))
! (match_operand:DF 3 "register_operand" "")
! (match_operand:DF 4 "register_operand" "")))
(clobber (reg:CC 17))]
! "FP_REG_P (operands[0]) && reload_completed
! && ((operands_match_p (operands[1], operands[3])
! && operands_match_p (operands[2], operands[4]))
! || (operands_match_p (operands[1], operands[4])
! && operands_match_p (operands[2], operands[3])))"
[(set (reg:CCFP 17)
(compare:CCFP (match_dup 2)
(match_dup 2)))
***************
*** 15959,15968 ****
[(set (match_operand:SF 0 "register_operand" "")
(if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
(match_operand:SF 2 "nonimmediate_operand" ""))
! (match_dup 1)
! (match_dup 2)))
(clobber (reg:CC 17))]
! "SSE_REG_P (operands[0]) && reload_completed"
[(set (match_dup 0)
(if_then_else:SF (gt (match_dup 1)
(match_dup 2))
--- 16024,16037 ----
[(set (match_operand:SF 0 "register_operand" "")
(if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
(match_operand:SF 2 "nonimmediate_operand" ""))
! (match_operand:SF 3 "register_operand" "")
! (match_operand:SF 4 "nonimmediate_operand" "")))
(clobber (reg:CC 17))]
! "SSE_REG_P (operands[0]) && reload_completed
! && ((operands_match_p (operands[1], operands[3])
! && operands_match_p (operands[2], operands[4]))
! || (operands_match_p (operands[1], operands[4])
! && operands_match_p (operands[2], operands[3])))"
[(set (match_dup 0)
(if_then_else:SF (gt (match_dup 1)
(match_dup 2))
***************
*** 15973,15982 ****
[(set (match_operand:SF 0 "register_operand" "")
(if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
(match_operand:SF 2 "register_operand" ""))
! (match_dup 1)
! (match_dup 2)))
(clobber (reg:CC 17))]
! "FP_REG_P (operands[0]) && reload_completed"
[(set (reg:CCFP 17)
(compare:CCFP (match_dup 1)
(match_dup 2)))
--- 16042,16055 ----
[(set (match_operand:SF 0 "register_operand" "")
(if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
(match_operand:SF 2 "register_operand" ""))
! (match_operand:SF 3 "register_operand" "")
! (match_operand:SF 4 "register_operand" "")))
(clobber (reg:CC 17))]
! "FP_REG_P (operands[0]) && reload_completed
! && ((operands_match_p (operands[1], operands[3])
! && operands_match_p (operands[2], operands[4]))
! || (operands_match_p (operands[1], operands[4])
! && operands_match_p (operands[2], operands[3])))"
[(set (reg:CCFP 17)
(compare:CCFP (match_dup 1)
(match_dup 2)))
***************
*** 16031,16040 ****
[(set (match_operand:DF 0 "register_operand" "")
(if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
(match_operand:DF 2 "nonimmediate_operand" ""))
! (match_dup 1)
! (match_dup 2)))
(clobber (reg:CC 17))]
! "SSE_REG_P (operands[0]) && reload_completed"
[(set (match_dup 0)
(if_then_else:DF (gt (match_dup 1)
(match_dup 2))
--- 16104,16117 ----
[(set (match_operand:DF 0 "register_operand" "")
(if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
(match_operand:DF 2 "nonimmediate_operand" ""))
! (match_operand:DF 3 "register_operand" "")
! (match_operand:DF 4 "nonimmediate_operand" "")))
(clobber (reg:CC 17))]
! "SSE_REG_P (operands[0]) && reload_completed
! && ((operands_match_p (operands[1], operands[3])
! && operands_match_p (operands[2], operands[4]))
! || (operands_match_p (operands[1], operands[4])
! && operands_match_p (operands[2], operands[3])))"
[(set (match_dup 0)
(if_then_else:DF (gt (match_dup 1)
(match_dup 2))
***************
*** 16045,16054 ****
[(set (match_operand:DF 0 "register_operand" "")
(if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
(match_operand:DF 2 "register_operand" ""))
! (match_dup 1)
! (match_dup 2)))
(clobber (reg:CC 17))]
! "FP_REG_P (operands[0]) && reload_completed"
[(set (reg:CCFP 17)
(compare:CCFP (match_dup 1)
(match_dup 2)))
--- 16122,16135 ----
[(set (match_operand:DF 0 "register_operand" "")
(if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
(match_operand:DF 2 "register_operand" ""))
! (match_operand:DF 3 "register_operand" "")
! (match_operand:DF 4 "register_operand" "")))
(clobber (reg:CC 17))]
! "FP_REG_P (operands[0]) && reload_completed
! && ((operands_match_p (operands[1], operands[3])
! && operands_match_p (operands[2], operands[4]))
! || (operands_match_p (operands[1], operands[4])
! && operands_match_p (operands[2], operands[3])))"
[(set (reg:CCFP 17)
(compare:CCFP (match_dup 1)
(match_dup 2)))