re PR target/88474 (Inline built-in hypot for -ffast-math)

PR target/88474
	* internal-fn.def (HYPOT): New.
	* optabs.def (hypot_optab): New.
	* config/i386/i386.md (hypot<mode>3): New expander.

From-SVN: r267137
This commit is contained in:
Uros Bizjak 2018-12-14 18:04:48 +01:00 committed by Uros Bizjak
parent 7e1f39b6aa
commit 4dd9b6c6bc
4 changed files with 35 additions and 0 deletions

View File

@ -1,3 +1,10 @@
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.

View File

@ -15048,6 +15048,32 @@
}
})
(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))]

View File

@ -230,6 +230,7 @@ DEF_INTERNAL_FLT_FLOATN_FN (TRUNC, ECF_CONST, btrunc, unary)
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)

View File

@ -284,6 +284,7 @@ OPTAB_D (exp2_optab, "exp2$a2")
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")