(significand_optab): Define corresponding macro.
* optabs.c (init_optabs): Initialize significand_optab.
* genopinit.c (optabs): Implement significand_optab using
significand?f2 patterns.
* builtins.c (expand_builtin_mathfn): Handle
BUILT_IN_SIGNIFICAND{,F,L}.
(expand_builtin): Expand BUILT_IN_SIGNIFICAND{,F,L} using
expand_builtin_mathfn if flag_unsafe_math_optimizations is set.
* config/i386/i386.md (significandxf2, significand<mode>2): New
expanders to implement significandf, significand and significandl
built-ins as inline x87 intrinsics.
testsuite/ChangeLog:
* gcc.dg/builtins-34.c: Add significand cases.
PR testsuite/40491
* testsuite/gcc.dg/
20080522-1.c: Remove testcase for real.
* testsuite/gcc.dg/
20080528-1.c: Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148705
138bc75d-0d04-0410-961f-
82ee72b054a4
+2009-06-19 Uros Bizjak <ubizjak@gmail.com>
+
+ * optabs.h (enum optab_index): Add new OTI_significand.
+ (significand_optab): Define corresponding macro.
+ * optabs.c (init_optabs): Initialize significand_optab.
+ * genopinit.c (optabs): Implement significand_optab using
+ significand?f2 patterns.
+ * builtins.c (expand_builtin_mathfn): Handle
+ BUILT_IN_SIGNIFICAND{,F,L}.
+ (expand_builtin): Expand BUILT_IN_SIGNIFICAND{,F,L} using
+ expand_builtin_mathfn if flag_unsafe_math_optimizations is set.
+
+ * config/i386/i386.md (significandxf2, significand<mode>2): New
+ expanders to implement significandf, significand and significandl
+ built-ins as inline x87 intrinsics.
+
2009-06-18 Anatoly Sokolov <aesok@post.ru>
* config/avr/avr.c (avr_override_options): Remove setting value of
* timevar.def (TV_SEE): Remove.
* tree-pass.h (pass_see): Remove declaration.
* doc/invoke.texi (-fsee): Remove documentation.
- * testsuite/gcc.dg/20080522-1.c: Remove testcase.
- * testsuite/gcc.dg/20080528-1.c: Remove testcase.
2009-06-18 Martin Jambor <mjambor@suse.cz>
* config/rs6000/crtsavgpr.asm: Likewise.
* config/rs6000/crtsavfpr.asm: Likewise.
- * dwarf2out.c (output_cfi_directive): Pass 1 instead of
- 0 to second argument of DWARF2_FRAME_REG_OUT macros.
+ * dwarf2out.c (output_cfi_directive): Pass 1 instead of 0 to second
+ argument of DWARF2_FRAME_REG_OUT macros.
2009-06-03 Julian Brown <julian@codesourcery.com>
/* Else fallthrough and expand as rint. */
CASE_FLT_FN (BUILT_IN_RINT):
builtin_optab = rint_optab; break;
+ CASE_FLT_FN (BUILT_IN_SIGNIFICAND):
+ builtin_optab = significand_optab; break;
default:
gcc_unreachable ();
}
CASE_FLT_FN (BUILT_IN_ASIN):
CASE_FLT_FN (BUILT_IN_ACOS):
CASE_FLT_FN (BUILT_IN_ATAN):
+ CASE_FLT_FN (BUILT_IN_SIGNIFICAND):
/* Treat these like sqrt only if unsafe math optimizations are allowed,
because of possible accuracy problems. */
if (! flag_unsafe_math_optimizations)
(define_expand "scalb<mode>3"
[(use (match_operand:MODEF 0 "register_operand" ""))
(use (match_operand:MODEF 1 "general_operand" ""))
- (use (match_operand:MODEF 2 "register_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)
emit_insn (gen_truncxf<mode>2_i387_noop (operands[0], op0));
DONE;
})
+
+(define_expand "significandxf2"
+ [(parallel [(set (match_operand:XF 0 "register_operand" "")
+ (unspec:XF [(match_operand:XF 1 "register_operand" "")]
+ UNSPEC_XTRACT_FRACT))
+ (set (match_dup 2)
+ (unspec:XF [(match_dup 1)] UNSPEC_XTRACT_EXP))])]
+ "TARGET_USE_FANCY_MATH_387
+ && flag_unsafe_math_optimizations"
+{
+ operands[2] = gen_reg_rtx (XFmode);
+})
+
+(define_expand "significand<mode>2"
+ [(use (match_operand:MODEF 0 "register_operand" ""))
+ (use (match_operand:MODEF 1 "register_operand" ""))]
+ "TARGET_USE_FANCY_MATH_387
+ && (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
+ || TARGET_MIX_SSE_I387)
+ && flag_unsafe_math_optimizations"
+{
+ rtx op0 = gen_reg_rtx (XFmode);
+ rtx op1 = gen_reg_rtx (XFmode);
+
+ emit_insn (gen_fxtract_extend<mode>xf3_i387 (op0, op1, operands[1]));
+ emit_insn (gen_truncxf<mode>2_i387_noop (operands[0], op0));
+ DONE;
+})
\f
(define_insn "sse4_1_round<mode>2"
"optab_handler (expm1_optab, $A)->insn_code = CODE_FOR_$(expm1$a2$)",
"optab_handler (ldexp_optab, $A)->insn_code = CODE_FOR_$(ldexp$a3$)",
"optab_handler (scalb_optab, $A)->insn_code = CODE_FOR_$(scalb$a3$)",
+ "optab_handler (significand_optab, $A)->insn_code = CODE_FOR_$(significand$a2$)",
"optab_handler (logb_optab, $A)->insn_code = CODE_FOR_$(logb$a2$)",
"optab_handler (ilogb_optab, $A)->insn_code = CODE_FOR_$(ilogb$a2$)",
"optab_handler (log_optab, $A)->insn_code = CODE_FOR_$(log$a2$)",
init_optab (expm1_optab, UNKNOWN);
init_optab (ldexp_optab, UNKNOWN);
init_optab (scalb_optab, UNKNOWN);
+ init_optab (significand_optab, UNKNOWN);
init_optab (logb_optab, UNKNOWN);
init_optab (ilogb_optab, UNKNOWN);
init_optab (log_optab, UNKNOWN);
OTI_ldexp,
/* Multiply floating-point number by integral power of radix */
OTI_scalb,
+ /* Mantissa of a floating-point number */
+ OTI_significand,
/* Radix-independent exponent */
OTI_logb,
OTI_ilogb,
#define expm1_optab (&optab_table[OTI_expm1])
#define ldexp_optab (&optab_table[OTI_ldexp])
#define scalb_optab (&optab_table[OTI_scalb])
+#define significand_optab (&optab_table[OTI_significand])
#define logb_optab (&optab_table[OTI_logb])
#define ilogb_optab (&optab_table[OTI_ilogb])
#define log_optab (&optab_table[OTI_log])
+2009-06-19 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.dg/builtins-34.c: Add significand cases.
+
+2009-06-19 Uros Bizjak <ubizjak@gmail.com>
+
+ PR testsuite/40491
+ * testsuite/gcc.dg/20080522-1.c: Remove testcase for real.
+ * testsuite/gcc.dg/20080528-1.c: Ditto.
+
2009-06-19 Janus Weil <janus@gcc.gnu.org>
PR fortran/40450
/* Copyright (C) 2004 Free Software Foundation.
- Check that exp10, exp10f, exp10l, exp2, exp2f, exp2l, pow10, pow10f,
- pow10l, expm1, expm1f and expm1l built-in functions compile.
+ Check that various built-in functions compile.
Written by Uros Bizjak, 13th February 2004. */
extern double scalb(double, double);
extern double scalbn(double, int);
extern double scalbln(double, long);
+extern double significand(double);
extern float exp10f(float);
extern float exp2f(float);
extern float pow10f(float);
extern float scalbf(float, float);
extern float scalbnf(float, int);
extern float scalblnf(float, long);
+extern float significandf(float);
extern long double exp10l(long double);
extern long double exp2l(long double);
extern long double pow10l(long double);
extern long double scalbl(long double, long double);
extern long double scalbnl(long double, int);
extern long double scalblnl(long double, long);
+extern long double significandl(long double);
double test1(double x)
return scalbln(x, exp);
}
+double test9(double x)
+{
+ return significand(x);
+}
+
float test1f(float x)
{
return exp10f(x);
return scalblnf(x, exp);
}
+float test9f(float x)
+{
+ return significandf(x);
+}
+
long double test1l(long double x)
{
return exp10l(x);
{
return scalblnl(x, exp);
}
+
+long double test9l(long double x)
+{
+ return significandl(x);
+}