+2018-12-14 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/88474
+ * internal-fn.def (HYPOT): New.
+ * optabs.def (hypot_optab): New.
+ * config/i386/i386.md (hypot<mode>3): New expander.
+
2018-12-14 Jeff Law <law@redhat.com>
* target.def (post_cfi_startproc): Fix text.
}
})
+(define_expand "hypot<mode>3"
+ [(use (match_operand:MODEF 0 "register_operand"))
+ (use (match_operand:MODEF 1 "general_operand"))
+ (use (match_operand:MODEF 2 "general_operand"))]
+ "TARGET_USE_FANCY_MATH_387
+ && (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
+ || TARGET_MIX_SSE_I387)
+ && flag_finite_math_only
+ && flag_unsafe_math_optimizations"
+{
+ rtx op0 = gen_reg_rtx (XFmode);
+ rtx op1 = gen_reg_rtx (XFmode);
+ rtx op2 = gen_reg_rtx (XFmode);
+
+ emit_insn (gen_extend<mode>xf2 (op2, operands[2]));
+ emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
+
+ emit_insn (gen_mulxf3 (op1, op1, op1));
+ emit_insn (gen_mulxf3 (op2, op2, op2));
+ emit_insn (gen_addxf3 (op0, op2, op1));
+ emit_insn (gen_sqrtxf2 (op0, op0));
+
+ emit_insn (gen_truncxf<mode>2 (operands[0], op0));
+ DONE;
+})
+
(define_insn "x86_fnstsw_1"
[(set (match_operand:HI 0 "register_operand" "=a")
(unspec:HI [(reg:CCFP FPSR_REG)] UNSPEC_FNSTSW))]
DEF_INTERNAL_FLT_FN (ATAN2, ECF_CONST, atan2, binary)
DEF_INTERNAL_FLT_FLOATN_FN (COPYSIGN, ECF_CONST, copysign, binary)
DEF_INTERNAL_FLT_FN (FMOD, ECF_CONST, fmod, binary)
+DEF_INTERNAL_FLT_FN (HYPOT, ECF_CONST, hypot, binary)
DEF_INTERNAL_FLT_FN (POW, ECF_CONST, pow, binary)
DEF_INTERNAL_FLT_FN (REMAINDER, ECF_CONST, remainder, binary)
DEF_INTERNAL_FLT_FN (SCALB, ECF_CONST, scalb, binary)
OPTAB_D (exp_optab, "exp$a2")
OPTAB_D (expm1_optab, "expm1$a2")
OPTAB_D (fmod_optab, "fmod$a3")
+OPTAB_D (hypot_optab, "hypot$a3")
OPTAB_D (ilogb_optab, "ilogb$a2")
OPTAB_D (isinf_optab, "isinf$a2")
OPTAB_D (ldexp_optab, "ldexp$a3")