;; Gcc is slightly more smart about handling normal two address instructions
;; so use special patterns for add and mull.
-(define_insn "*fop_<mode>_comm_mixed"
+(define_insn "*fop_<mode>_comm"
[(set (match_operand:MODEF 0 "register_operand" "=f,x,v")
(match_operator:MODEF 3 "binary_fp_operator"
[(match_operand:MODEF 1 "nonimmediate_operand" "%0,0,v")
(match_operand:MODEF 2 "nonimmediate_operand" "fm,xm,vm")]))]
- "SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
+ "((SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
+ || (TARGET_80387 && X87_ENABLE_ARITH (<MODE>mode)))
&& COMMUTATIVE_ARITH_P (operands[3])
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))"
"* return output_387_binary_op (insn, operands);"
(set_attr "prefix" "orig,orig,vex")
(set_attr "mode" "<MODE>")
(set (attr "enabled")
- (cond [(eq_attr "alternative" "0")
- (symbol_ref "TARGET_MIX_SSE_I387")
- ]
- (const_string "*")))])
-
-(define_insn "*fop_<mode>_comm_i387"
- [(set (match_operand:MODEF 0 "register_operand" "=f")
- (match_operator:MODEF 3 "binary_fp_operator"
- [(match_operand:MODEF 1 "nonimmediate_operand" "%0")
- (match_operand:MODEF 2 "nonimmediate_operand" "fm")]))]
- "TARGET_80387 && X87_ENABLE_ARITH (<MODE>mode)
- && COMMUTATIVE_ARITH_P (operands[3])
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (if_then_else (match_operand:MODEF 3 "mult_operator")
- (const_string "fmul")
- (const_string "fop")))
- (set_attr "mode" "<MODE>")])
+ (if_then_else
+ (match_test ("SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH"))
+ (if_then_else
+ (eq_attr "alternative" "0")
+ (symbol_ref "TARGET_MIX_SSE_I387
+ && X87_ENABLE_ARITH (<MODE>mode)")
+ (const_string "*"))
+ (if_then_else
+ (eq_attr "alternative" "0")
+ (symbol_ref "true")
+ (symbol_ref "false"))))])
(define_insn "*rcpsf2_sse"
[(set (match_operand:SF 0 "register_operand" "=x")
(set_attr "prefix" "maybe_vex")
(set_attr "mode" "SF")])
-(define_insn "*fop_<mode>_1_mixed"
+(define_insn "*fop_<mode>_1"
[(set (match_operand:MODEF 0 "register_operand" "=f,f,x,v")
(match_operator:MODEF 3 "binary_fp_operator"
[(match_operand:MODEF 1
- "register_mixssei387nonimm_operand" "0,fm,0,v")
+ "nonimm_ssenomem_operand" "0,fm,0,v")
(match_operand:MODEF 2
- "nonimmediate_operand" "fm,0,xm,vm")]))]
- "SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
+ "nonimmediate_operand" "fm,0,xm,vm")]))]
+ "((SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
+ || (TARGET_80387 && X87_ENABLE_ARITH (<MODE>mode)))
&& !COMMUTATIVE_ARITH_P (operands[3])
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))"
"* return output_387_binary_op (insn, operands);"
(set_attr "prefix" "orig,orig,orig,vex")
(set_attr "mode" "<MODE>")
(set (attr "enabled")
- (cond [(eq_attr "alternative" "0,1")
- (symbol_ref "TARGET_MIX_SSE_I387")
- ]
- (const_string "*")))])
-
-;; This pattern is not fully shadowed by the pattern above.
-(define_insn "*fop_<mode>_1_i387"
- [(set (match_operand:MODEF 0 "register_operand" "=f,f")
- (match_operator:MODEF 3 "binary_fp_operator"
- [(match_operand:MODEF 1 "nonimmediate_operand" "0,fm")
- (match_operand:MODEF 2 "nonimmediate_operand" "fm,0")]))]
- "TARGET_80387 && X87_ENABLE_ARITH (<MODE>mode)
- && !(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
- && !COMMUTATIVE_ARITH_P (operands[3])
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (if_then_else (match_operand:MODEF 3 "div_operator")
- (const_string "fdiv")
- (const_string "fop")))
- (set_attr "mode" "<MODE>")])
+ (if_then_else
+ (match_test ("SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH"))
+ (if_then_else
+ (eq_attr "alternative" "0,1")
+ (symbol_ref "TARGET_MIX_SSE_I387
+ && X87_ENABLE_ARITH (<MODE>mode)")
+ (const_string "*"))
+ (if_then_else
+ (eq_attr "alternative" "0,1")
+ (symbol_ref "true")
+ (symbol_ref "false"))))])
;; ??? Add SSE splitters for these!
(define_insn "*fop_<MODEF:mode>_2_i387"
(match_operand:SF 1 "nonimmediate_operand" "fm,0"))
(match_operand:DF 2 "register_operand" "0,f")]))]
"TARGET_80387 && X87_ENABLE_ARITH (DFmode)
- && !(TARGET_SSE2 && TARGET_SSE_MATH)
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
+ && !(SSE_FLOAT_MODE_P (DFmode) && TARGET_SSE_MATH)"
"* return output_387_binary_op (insn, operands);"
[(set (attr "type")
(cond [(match_operand:DF 3 "mult_operator")
(float_extend:DF
(match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
"TARGET_80387 && X87_ENABLE_ARITH (DFmode)
- && !(TARGET_SSE2 && TARGET_SSE_MATH)"
+ && !(SSE_FLOAT_MODE_P (DFmode) && TARGET_SSE_MATH)"
"* return output_387_binary_op (insn, operands);"
[(set (attr "type")
(cond [(match_operand:DF 3 "mult_operator")
(float_extend:DF
(match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
"TARGET_80387 && X87_ENABLE_ARITH (DFmode)
- && !(TARGET_SSE2 && TARGET_SSE_MATH)"
+ && !(SSE_FLOAT_MODE_P (DFmode) && TARGET_SSE_MATH)"
"* return output_387_binary_op (insn, operands);"
[(set (attr "type")
(cond [(match_operand:DF 3 "mult_operator")