;; We may not use "#" to split and emit these, since the REG_DEAD notes
;; used to manage the reg stack popping would not be preserved.
-(define_insn "*cmpfp_0"
+(define_insn "*cmp<mode>_0_i387"
[(set (match_operand:HI 0 "register_operand" "=a")
(unspec:HI
[(compare:CCFP
- (match_operand 1 "register_operand" "f")
- (match_operand 2 "const0_operand"))]
+ (match_operand:X87MODEF 1 "register_operand" "f")
+ (match_operand:X87MODEF 2 "const0_operand"))]
UNSPEC_FNSTSW))]
- "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
- && GET_MODE (operands[1]) == GET_MODE (operands[2])"
+ "TARGET_80387"
"* return output_fp_compare (insn, operands, false, false);"
[(set_attr "type" "multi")
(set_attr "unit" "i387")
- (set (attr "mode")
- (cond [(match_operand:SF 1)
- (const_string "SF")
- (match_operand:DF 1)
- (const_string "DF")
- ]
- (const_string "XF")))])
+ (set_attr "mode" "<MODE>")])
-(define_insn_and_split "*cmpfp_0_cc"
+(define_insn_and_split "*cmp<mode>_0_cc_i387"
[(set (reg:CCFP FLAGS_REG)
(compare:CCFP
- (match_operand 1 "register_operand" "f")
- (match_operand 2 "const0_operand")))
+ (match_operand:X87MODEF 1 "register_operand" "f")
+ (match_operand:X87MODEF 2 "const0_operand")))
(clobber (match_operand:HI 0 "register_operand" "=a"))]
- "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
- && TARGET_SAHF && !TARGET_CMOVE
- && GET_MODE (operands[1]) == GET_MODE (operands[2])"
+ "TARGET_80387 && TARGET_SAHF && !TARGET_CMOVE"
"#"
"&& reload_completed"
[(set (match_dup 0)
""
[(set_attr "type" "multi")
(set_attr "unit" "i387")
- (set (attr "mode")
- (cond [(match_operand:SF 1)
- (const_string "SF")
- (match_operand:DF 1)
- (const_string "DF")
- ]
- (const_string "XF")))])
+ (set_attr "mode" "<MODE>")])
-(define_insn "*cmpfp_xf"
+(define_insn "*cmpxf_i387"
[(set (match_operand:HI 0 "register_operand" "=a")
(unspec:HI
[(compare:CCFP
(set_attr "unit" "i387")
(set_attr "mode" "XF")])
-(define_insn_and_split "*cmpfp_xf_cc"
+(define_insn_and_split "*cmpxf_cc_i387"
[(set (reg:CCFP FLAGS_REG)
(compare:CCFP
(match_operand:XF 1 "register_operand" "f")
(match_operand:XF 2 "register_operand" "f")))
(clobber (match_operand:HI 0 "register_operand" "=a"))]
- "TARGET_80387
- && TARGET_SAHF && !TARGET_CMOVE"
+ "TARGET_80387 && TARGET_SAHF && !TARGET_CMOVE"
"#"
"&& reload_completed"
[(set (match_dup 0)
(set_attr "unit" "i387")
(set_attr "mode" "XF")])
-(define_insn "*cmpfp_<mode>"
+(define_insn "*cmp<mode>_i387"
[(set (match_operand:HI 0 "register_operand" "=a")
(unspec:HI
[(compare:CCFP
(set_attr "unit" "i387")
(set_attr "mode" "<MODE>")])
-(define_insn_and_split "*cmpfp_<mode>_cc"
+(define_insn_and_split "*cmp<mode>_cc_i387"
[(set (reg:CCFP FLAGS_REG)
(compare:CCFP
(match_operand:MODEF 1 "register_operand" "f")
(match_operand:MODEF 2 "nonimmediate_operand" "fm")))
(clobber (match_operand:HI 0 "register_operand" "=a"))]
- "TARGET_80387
- && TARGET_SAHF && !TARGET_CMOVE"
+ "TARGET_80387 && TARGET_SAHF && !TARGET_CMOVE"
"#"
"&& reload_completed"
[(set (match_dup 0)
(set_attr "unit" "i387")
(set_attr "mode" "<MODE>")])
-(define_insn "*cmpfp_u"
+(define_insn "*cmpu<mode>_i387"
[(set (match_operand:HI 0 "register_operand" "=a")
(unspec:HI
[(compare:CCFPU
- (match_operand 1 "register_operand" "f")
- (match_operand 2 "register_operand" "f"))]
+ (match_operand:X87MODEF 1 "register_operand" "f")
+ (match_operand:X87MODEF 2 "register_operand" "f"))]
UNSPEC_FNSTSW))]
- "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
- && GET_MODE (operands[1]) == GET_MODE (operands[2])"
+ "TARGET_80387"
"* return output_fp_compare (insn, operands, false, true);"
[(set_attr "type" "multi")
(set_attr "unit" "i387")
- (set (attr "mode")
- (cond [(match_operand:SF 1)
- (const_string "SF")
- (match_operand:DF 1)
- (const_string "DF")
- ]
- (const_string "XF")))])
+ (set_attr "mode" "<MODE>")])
-(define_insn_and_split "*cmpfp_u_cc"
+(define_insn_and_split "*cmpu<mode>_cc_i387"
[(set (reg:CCFPU FLAGS_REG)
(compare:CCFPU
- (match_operand 1 "register_operand" "f")
- (match_operand 2 "register_operand" "f")))
+ (match_operand:X87MODEF 1 "register_operand" "f")
+ (match_operand:X87MODEF 2 "register_operand" "f")))
(clobber (match_operand:HI 0 "register_operand" "=a"))]
- "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
- && TARGET_SAHF && !TARGET_CMOVE
- && GET_MODE (operands[1]) == GET_MODE (operands[2])"
+ "TARGET_80387 && TARGET_SAHF && !TARGET_CMOVE"
"#"
"&& reload_completed"
[(set (match_dup 0)
""
[(set_attr "type" "multi")
(set_attr "unit" "i387")
- (set (attr "mode")
- (cond [(match_operand:SF 1)
- (const_string "SF")
- (match_operand:DF 1)
- (const_string "DF")
- ]
- (const_string "XF")))])
+ (set_attr "mode" "<MODE>")])
-(define_insn "*cmpfp_<mode>"
+(define_insn "*cmp<X87MODEF:mode>_<SWI24:mode>_i387"
[(set (match_operand:HI 0 "register_operand" "=a")
(unspec:HI
[(compare:CCFP
- (match_operand 1 "register_operand" "f")
- (match_operator 3 "float_operator"
+ (match_operand:X87MODEF 1 "register_operand" "f")
+ (match_operator:X87MODEF 3 "float_operator"
[(match_operand:SWI24 2 "memory_operand" "m")]))]
UNSPEC_FNSTSW))]
- "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
- && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
- && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
+ "TARGET_80387
+ && (TARGET_USE_<SWI24:MODE>MODE_FIOP
+ || optimize_function_for_size_p (cfun))"
"* return output_fp_compare (insn, operands, false, false);"
[(set_attr "type" "multi")
(set_attr "unit" "i387")
(set_attr "fp_int_src" "true")
- (set_attr "mode" "<MODE>")])
+ (set_attr "mode" "<SWI24:MODE>")])
-(define_insn_and_split "*cmpfp_<mode>_cc"
+(define_insn_and_split "*cmp<X87MODEF:mode>_<SWI24:mode>_cc_i387"
[(set (reg:CCFP FLAGS_REG)
(compare:CCFP
- (match_operand 1 "register_operand" "f")
- (match_operator 3 "float_operator"
+ (match_operand:X87MODEF 1 "register_operand" "f")
+ (match_operator:X87MODEF 3 "float_operator"
[(match_operand:SWI24 2 "memory_operand" "m")])))
(clobber (match_operand:HI 0 "register_operand" "=a"))]
- "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
- && TARGET_SAHF && !TARGET_CMOVE
- && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
- && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
+ "TARGET_80387 && TARGET_SAHF && !TARGET_CMOVE
+ && (TARGET_USE_<SWI24:MODE>MODE_FIOP
+ || optimize_function_for_size_p (cfun))"
"#"
"&& reload_completed"
[(set (match_dup 0)
[(set_attr "type" "multi")
(set_attr "unit" "i387")
(set_attr "fp_int_src" "true")
- (set_attr "mode" "<MODE>")])
+ (set_attr "mode" "<SWI24:MODE>")])
;; FP compares, step 2
;; Move the fpsw to ax.
;; Pentium Pro can do steps 1 through 3 in one go.
;; comi*, ucomi*, fcomi*, ficomi*, fucomi*
;; (these i387 instructions set flags directly)
-(define_insn "*cmpfp_i_mixed"
- [(set (reg:CCFP FLAGS_REG)
- (compare:CCFP (match_operand 0 "register_operand" "f,x")
- (match_operand 1 "nonimmediate_operand" "f,xm")))]
- "TARGET_MIX_SSE_I387
- && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
- && GET_MODE (operands[0]) == GET_MODE (operands[1])"
- "* return output_fp_compare (insn, operands, true, false);"
- [(set_attr "type" "fcmp,ssecomi")
- (set_attr "prefix" "orig,maybe_vex")
- (set (attr "mode")
- (if_then_else (match_operand:SF 1)
- (const_string "SF")
- (const_string "DF")))
- (set (attr "prefix_rep")
- (if_then_else (eq_attr "type" "ssecomi")
- (const_string "0")
- (const_string "*")))
- (set (attr "prefix_data16")
- (cond [(eq_attr "type" "fcmp")
- (const_string "*")
- (eq_attr "mode" "DF")
- (const_string "1")
- ]
- (const_string "0")))
- (set_attr "athlon_decode" "vector")
- (set_attr "amdfam10_decode" "direct")
- (set_attr "bdver1_decode" "double")])
-
-(define_insn "*cmpfp_i_sse"
- [(set (reg:CCFP FLAGS_REG)
- (compare:CCFP (match_operand 0 "register_operand" "x")
- (match_operand 1 "nonimmediate_operand" "xm")))]
- "TARGET_SSE_MATH
- && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
- && GET_MODE (operands[0]) == GET_MODE (operands[1])"
- "* return output_fp_compare (insn, operands, true, false);"
- [(set_attr "type" "ssecomi")
- (set_attr "prefix" "maybe_vex")
- (set (attr "mode")
- (if_then_else (match_operand:SF 1)
- (const_string "SF")
- (const_string "DF")))
- (set_attr "prefix_rep" "0")
- (set (attr "prefix_data16")
- (if_then_else (eq_attr "mode" "DF")
- (const_string "1")
- (const_string "0")))
- (set_attr "athlon_decode" "vector")
- (set_attr "amdfam10_decode" "direct")
- (set_attr "bdver1_decode" "double")])
-(define_insn "*cmpfp_i_i387"
- [(set (reg:CCFP FLAGS_REG)
- (compare:CCFP (match_operand 0 "register_operand" "f")
- (match_operand 1 "register_operand" "f")))]
- "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
- && TARGET_CMOVE
- && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
- && GET_MODE (operands[0]) == GET_MODE (operands[1])"
- "* return output_fp_compare (insn, operands, true, false);"
- [(set_attr "type" "fcmp")
- (set (attr "mode")
- (cond [(match_operand:SF 1)
- (const_string "SF")
- (match_operand:DF 1)
- (const_string "DF")
- ]
- (const_string "XF")))
- (set_attr "athlon_decode" "vector")
- (set_attr "amdfam10_decode" "direct")
- (set_attr "bdver1_decode" "double")])
+(define_mode_iterator FPCMP [CCFP CCFPU])
+(define_mode_attr unord [(CCFP "") (CCFPU "u")])
-(define_insn "*cmpfp_iu_mixed"
- [(set (reg:CCFPU FLAGS_REG)
- (compare:CCFPU (match_operand 0 "register_operand" "f,x")
- (match_operand 1 "nonimmediate_operand" "f,xm")))]
+(define_insn "*cmpi<FPCMP:unord><MODEF:mode>_mixed"
+ [(set (reg:FPCMP FLAGS_REG)
+ (compare:FPCMP
+ (match_operand:MODEF 0 "register_operand" "f,x")
+ (match_operand:MODEF 1 "nonimmediate_operand" "f,xm")))]
"TARGET_MIX_SSE_I387
- && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
- && GET_MODE (operands[0]) == GET_MODE (operands[1])"
- "* return output_fp_compare (insn, operands, true, true);"
+ && SSE_FLOAT_MODE_P (<MODEF:MODE>mode)"
+ "* return output_fp_compare (insn, operands, true,
+ <FPCMP:MODE>mode == CCFPUmode);"
[(set_attr "type" "fcmp,ssecomi")
(set_attr "prefix" "orig,maybe_vex")
- (set (attr "mode")
- (if_then_else (match_operand:SF 1)
- (const_string "SF")
- (const_string "DF")))
+ (set_attr "mode" "<MODEF:MODE>")
(set (attr "prefix_rep")
(if_then_else (eq_attr "type" "ssecomi")
(const_string "0")
(set_attr "amdfam10_decode" "direct")
(set_attr "bdver1_decode" "double")])
-(define_insn "*cmpfp_iu_sse"
- [(set (reg:CCFPU FLAGS_REG)
- (compare:CCFPU (match_operand 0 "register_operand" "x")
- (match_operand 1 "nonimmediate_operand" "xm")))]
+(define_insn "*cmpi<FPCMP:unord><MODEF:mode>_sse"
+ [(set (reg:FPCMP FLAGS_REG)
+ (compare:FPCMP
+ (match_operand:MODEF 0 "register_operand" "x")
+ (match_operand:MODEF 1 "nonimmediate_operand" "xm")))]
"TARGET_SSE_MATH
- && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
- && GET_MODE (operands[0]) == GET_MODE (operands[1])"
- "* return output_fp_compare (insn, operands, true, true);"
+ && SSE_FLOAT_MODE_P (<MODEF:MODE>mode)"
+ "* return output_fp_compare (insn, operands, true,
+ <FPCMP:MODE>mode == CCFPUmode);"
[(set_attr "type" "ssecomi")
(set_attr "prefix" "maybe_vex")
- (set (attr "mode")
- (if_then_else (match_operand:SF 1)
- (const_string "SF")
- (const_string "DF")))
+ (set_attr "mode" "<MODEF:MODE>")
(set_attr "prefix_rep" "0")
(set (attr "prefix_data16")
(if_then_else (eq_attr "mode" "DF")
(set_attr "amdfam10_decode" "direct")
(set_attr "bdver1_decode" "double")])
-(define_insn "*cmpfp_iu_387"
- [(set (reg:CCFPU FLAGS_REG)
- (compare:CCFPU (match_operand 0 "register_operand" "f")
- (match_operand 1 "register_operand" "f")))]
- "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
- && TARGET_CMOVE
- && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
- && GET_MODE (operands[0]) == GET_MODE (operands[1])"
- "* return output_fp_compare (insn, operands, true, true);"
+(define_insn "*cmpi<FPCMP:unord><X87MODEF:mode>_i387"
+ [(set (reg:FPCMP FLAGS_REG)
+ (compare:FPCMP
+ (match_operand:X87MODEF 0 "register_operand" "f")
+ (match_operand:X87MODEF 1 "register_operand" "f")))]
+ "TARGET_80387 && TARGET_CMOVE
+ && !(SSE_FLOAT_MODE_P (<X87MODEF:MODE>mode) && TARGET_SSE_MATH)"
+ "* return output_fp_compare (insn, operands, true,
+ <FPCMP:MODE>mode == CCFPUmode);"
[(set_attr "type" "fcmp")
- (set (attr "mode")
- (cond [(match_operand:SF 1)
- (const_string "SF")
- (match_operand:DF 1)
- (const_string "DF")
- ]
- (const_string "XF")))
+ (set_attr "mode" "<X87MODEF:MODE>")
(set_attr "athlon_decode" "vector")
(set_attr "amdfam10_decode" "direct")
- (set_attr "bdver1_decode" "direct")])
+ (set_attr "bdver1_decode" "double")])
\f
;; Push/pop instructions.