This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
i386 fp conditional moves tweek
- To: rth at cygnus dot com, gcc-patches at gcc dot gnu dot org, patches at x86-64 dot org
- Subject: i386 fp conditional moves tweek
- From: Jan Hubicka <jh at suse dot cz>
- Date: Tue, 13 Feb 2001 23:01:39 +0100
Hi
One unrelated goodie from my SSE branch. It uses integer cmov for FP
conditional moves. This actually helps a lot, since fcmov requires
getting flags from integer unit to fp unit, that takes time.
Interestingly enought most of fp conditional moves can be converted.
Tue Feb 13 22:59:16 CET 2001 Jan Hubicka <jh@suse.cz>
* i386.md (movsfcc_1): Support integer cmove instruction.
(movdfcc_1): Likewise; new splitter.
Index: egcs/gcc/config/i386/i386.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.210
diff -c -3 -p -r1.210 i386.md
*** i386.md 2001/02/13 21:04:57 1.210
--- i386.md 2001/02/13 21:57:05
***************
*** 11896,11912 ****
"if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
(define_insn "*movsfcc_1"
! [(set (match_operand:SF 0 "register_operand" "=f,f")
(if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
[(reg 17) (const_int 0)])
! (match_operand:SF 2 "register_operand" "f,0")
! (match_operand:SF 3 "register_operand" "0,f")))]
! "TARGET_CMOVE"
"@
fcmov%F1\\t{%2, %0|%0, %2}
! fcmov%f1\\t{%3, %0|%0, %3}"
! [(set_attr "type" "fcmov")
! (set_attr "mode" "SF")])
(define_expand "movdfcc"
[(set (match_operand:DF 0 "register_operand" "")
--- 11896,11915 ----
"if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
(define_insn "*movsfcc_1"
! [(set (match_operand:SF 0 "register_operand" "=f,f,r,r")
(if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
[(reg 17) (const_int 0)])
! (match_operand:SF 2 "nonimmediate_operand" "f,0,rm,0")
! (match_operand:SF 3 "nonimmediate_operand" "0,f,0,rm")))]
! "TARGET_CMOVE
! && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
"@
fcmov%F1\\t{%2, %0|%0, %2}
! fcmov%f1\\t{%3, %0|%0, %3}
! cmov%C1\\t{%2, %0|%0, %2}
! cmov%c1\\t{%3, %0|%0, %3}"
! [(set_attr "type" "fcmov,fcmov,icmov,icmov")
! (set_attr "mode" "SF,SF,SI,SI")])
(define_expand "movdfcc"
[(set (match_operand:DF 0 "register_operand" "")
***************
*** 11917,11933 ****
"if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
(define_insn "*movdfcc_1"
! [(set (match_operand:DF 0 "register_operand" "=f,f")
(if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
[(reg 17) (const_int 0)])
! (match_operand:DF 2 "register_operand" "f,0")
! (match_operand:DF 3 "register_operand" "0,f")))]
! "TARGET_CMOVE"
"@
fcmov%F1\\t{%2, %0|%0, %2}
! fcmov%f1\\t{%3, %0|%0, %3}"
! [(set_attr "type" "fcmov")
(set_attr "mode" "DF")])
(define_expand "movxfcc"
[(set (match_operand:XF 0 "register_operand" "")
--- 11920,11958 ----
"if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
(define_insn "*movdfcc_1"
! [(set (match_operand:DF 0 "register_operand" "=f,f,&r,&r")
(if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
[(reg 17) (const_int 0)])
! (match_operand:DF 2 "nonimmediate_operand" "f,0,rm,0")
! (match_operand:DF 3 "nonimmediate_operand" "0,f,0,rm")))]
! "TARGET_CMOVE
! && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
"@
fcmov%F1\\t{%2, %0|%0, %2}
! fcmov%f1\\t{%3, %0|%0, %3}
! #
! #"
! [(set_attr "type" "fcmov,fcmov,multi,multi")
(set_attr "mode" "DF")])
+
+ (define_split
+ [(set (match_operand:DF 0 "register_operand" "")
+ (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
+ [(match_operand 4 "" "") (const_int 0)])
+ (match_operand:DF 2 "nonimmediate_operand" "")
+ (match_operand:DF 3 "nonimmediate_operand" "")))]
+ "!ANY_FP_REG_P (operands[0]) && reload_completed"
+ [(set (match_dup 2)
+ (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
+ (match_dup 5)
+ (match_dup 7)))
+ (set (match_dup 3)
+ (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
+ (match_dup 6)
+ (match_dup 8)))]
+ "split_di (operands+2, 1, operands+5, operands+6);
+ split_di (operands+3, 1, operands+7, operands+8);
+ split_di (operands, 1, operands+2, operands+3);")
(define_expand "movxfcc"
[(set (match_operand:XF 0 "register_operand" "")