Commit 198cb166 by Uros Bizjak

i386.c (ix86_expand_round_sse4): Expand as trunc (a + copysign (nextafter (0.5, 0.0), a)).

	* config/i386/i386.c (ix86_expand_round_sse4): Expand as
	trunc (a + copysign (nextafter (0.5, 0.0), a)).

From-SVN: r177927
parent f47a61f3
2011-08-20 Uros Bizjak <ubizjak@gmail.com>
Michael Matz <matz@suse.de>
* config/i386/i386.c (ix86_expand_round_sse4): Expand as
trunc (a + copysign (nextafter (0.5, 0.0), a)).
2011-08-20 Anatoly Sokolov <aesok@post.ru> 2011-08-20 Anatoly Sokolov <aesok@post.ru>
* doc/tm.texi.in (PREFERRED_OUTPUT_RELOAD_CLASS): Remove. * doc/tm.texi.in (PREFERRED_OUTPUT_RELOAD_CLASS): Remove.
...@@ -10,9 +16,8 @@ ...@@ -10,9 +16,8 @@
PR tree-optimization/48739 PR tree-optimization/48739
* tree-ssa.c: Include cfgloop.h. * tree-ssa.c: Include cfgloop.h.
(execute_update_addresses_taken): When updating ssa, if in (execute_update_addresses_taken): When updating ssa, if in loop closed
loop closed SSA form, call rewrite_into_loop_closed_ssa instead of SSA form, call rewrite_into_loop_closed_ssa instead of update_ssa.
update_ssa.
* Makefile.in (tree-ssa.o): Depend on $(CFGLOOP_H). * Makefile.in (tree-ssa.o): Depend on $(CFGLOOP_H).
2011-08-19 Vladimir Makarov <vmakarov@redhat.com> 2011-08-19 Vladimir Makarov <vmakarov@redhat.com>
...@@ -34,8 +39,7 @@ ...@@ -34,8 +39,7 @@
2011-08-19 Joseph Myers <joseph@codesourcery.com> 2011-08-19 Joseph Myers <joseph@codesourcery.com>
* c-parser.c (c_parser_postfix_expression): Handle * c-parser.c (c_parser_postfix_expression): Handle RID_BUILTIN_COMPLEX.
RID_BUILTIN_COMPLEX.
* doc/extend.texi (__builtin_complex): Document. * doc/extend.texi (__builtin_complex): Document.
2011-08-19 Andrew Stubbs <ams@codesourcery.com> 2011-08-19 Andrew Stubbs <ams@codesourcery.com>
...@@ -133,8 +137,7 @@ ...@@ -133,8 +137,7 @@
* c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if * c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if
pedantic. pedantic.
* c-parser.c (c_parser_declspecs): Include _Noreturn in syntax * c-parser.c (c_parser_declspecs): Include _Noreturn in syntax comment.
comment.
* ginclude/stdnoreturn.h (noreturn): Don't define for C++. * ginclude/stdnoreturn.h (noreturn): Don't define for C++.
2011-08-19 Joseph Myers <joseph@codesourcery.com> 2011-08-19 Joseph Myers <joseph@codesourcery.com>
...@@ -172,9 +175,8 @@ ...@@ -172,9 +175,8 @@
AVX2 feature. AVX2 feature.
* config/i386/i386-c.c (ix86_target_macros_internal): * config/i386/i386-c.c (ix86_target_macros_internal):
Conditionally define __AVX2__. Conditionally define __AVX2__.
* config/i386/i386.c (ix86_option_override_internal): Define * config/i386/i386.c (ix86_option_override_internal): Define PTA_AVX2.
PTA_AVX2. Define "core-avx2" processor alias. Handle avx2 Define "core-avx2" processor alias. Handle avx2 option.
option.
(ix86_valid_target_attribute_inner_p): Handle avx2 option. (ix86_valid_target_attribute_inner_p): Handle avx2 option.
* config/i386/i386.h (TARGET_AVX2): New. * config/i386/i386.h (TARGET_AVX2): New.
* config/i386/i386.opt (mavx2): New. * config/i386/i386.opt (mavx2): New.
...@@ -447,8 +449,7 @@ ...@@ -447,8 +449,7 @@
* cgraphunit.c (thunk_adjust): Use fold_build_pointer_plus_loc. * cgraphunit.c (thunk_adjust): Use fold_build_pointer_plus_loc.
(cgraph_redirect_edge_call_stmt_to_callee): Use size_int. (cgraph_redirect_edge_call_stmt_to_callee): Use size_int.
* expr.c (expand_expr_addr_expr_1): Use fold_build_pointer_plus. * expr.c (expand_expr_addr_expr_1): Use fold_build_pointer_plus.
* fold-const.c (build_range_check): Negate using the original * fold-const.c (build_range_check): Negate using the original type.
type.
(fold_unary_loc): Use fold_build_pointer_plus_loc. (fold_unary_loc): Use fold_build_pointer_plus_loc.
* gimple-fold.c (gimple_adjust_this_by_delta): Use * gimple-fold.c (gimple_adjust_this_by_delta): Use
convert_to_ptrofftype. convert_to_ptrofftype.
...@@ -646,11 +647,11 @@ ...@@ -646,11 +647,11 @@
2011-08-12 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org> 2011-08-12 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
PR target/48328 PR target/48328
* config/arm/arm.h (CASE_VECTOR_SHORTEN_MODE): Fix distance * config/arm/arm.h (CASE_VECTOR_SHORTEN_MODE): Fix distance
for tbh instructions. for tbh instructions.
2011-08-12 Diego Novillo <dnovillo@google.com> 2011-08-12 Diego Novillo <dnovillo@google.com>
* data-streamer.h (streamer_write_zero): Rename from output_zero. * data-streamer.h (streamer_write_zero): Rename from output_zero.
(streamer_write_uhwi): Rename from lto_output_uleb128. (streamer_write_uhwi): Rename from lto_output_uleb128.
...@@ -786,8 +787,7 @@ ...@@ -786,8 +787,7 @@
2011-08-12 Richard Guenther <rguenther@suse.de> 2011-08-12 Richard Guenther <rguenther@suse.de>
* tree-vrp.c (extract_range_from_unary_expr_1): Implement * tree-vrp.c (extract_range_from_unary_expr_1): Implement -X as 0 - X.
-X as 0 - X.
2011-08-12 Romain Geissler <romain.geissler@gmail.com> 2011-08-12 Romain Geissler <romain.geissler@gmail.com>
......
...@@ -32700,42 +32700,44 @@ void ...@@ -32700,42 +32700,44 @@ void
ix86_expand_round_sse4 (rtx op0, rtx op1) ix86_expand_round_sse4 (rtx op0, rtx op1)
{ {
enum machine_mode mode = GET_MODE (op0); enum machine_mode mode = GET_MODE (op0);
rtx e1, e2, e3, res, half, mask; rtx e1, e2, res, half;
const struct real_format *fmt; const struct real_format *fmt;
REAL_VALUE_TYPE pred_half, half_minus_pred_half; REAL_VALUE_TYPE pred_half, half_minus_pred_half;
rtx (*gen_copysign) (rtx, rtx, rtx);
rtx (*gen_round) (rtx, rtx, rtx); rtx (*gen_round) (rtx, rtx, rtx);
switch (mode) switch (mode)
{ {
case SFmode: case SFmode:
gen_copysign = gen_copysignsf3;
gen_round = gen_sse4_1_roundsf2; gen_round = gen_sse4_1_roundsf2;
break; break;
case DFmode: case DFmode:
gen_copysign = gen_copysigndf3;
gen_round = gen_sse4_1_rounddf2; gen_round = gen_sse4_1_rounddf2;
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
/* e1 = fabs(op1) */ /* round (a) = trunc (a + copysign (0.5, a)) */
e1 = ix86_expand_sse_fabs (op1, &mask);
/* load nextafter (0.5, 0.0) */ /* load nextafter (0.5, 0.0) */
fmt = REAL_MODE_FORMAT (mode); fmt = REAL_MODE_FORMAT (mode);
real_2expN (&half_minus_pred_half, -(fmt->p) - 1, mode); real_2expN (&half_minus_pred_half, -(fmt->p) - 1, mode);
REAL_ARITHMETIC (pred_half, MINUS_EXPR, dconsthalf, half_minus_pred_half); REAL_ARITHMETIC (pred_half, MINUS_EXPR, dconsthalf, half_minus_pred_half);
half = const_double_from_real_value (pred_half, mode);
/* e2 = e1 + 0.5 */ /* e1 = copysign (0.5, op1) */
half = force_reg (mode, const_double_from_real_value (pred_half, mode)); e1 = gen_reg_rtx (mode);
e2 = expand_simple_binop (mode, PLUS, e1, half, NULL_RTX, 0, OPTAB_DIRECT); emit_insn (gen_copysign (e1, half, op1));
/* e3 = trunc(e2) */ /* e2 = op1 + e1 */
e3 = gen_reg_rtx (mode); e2 = expand_simple_binop (mode, PLUS, op1, e1, NULL_RTX, 0, OPTAB_DIRECT);
emit_insn (gen_round (e3, e2, GEN_INT (ROUND_TRUNC)));
/* res = copysign (e3, op1) */ /* res = trunc (e2) */
res = gen_reg_rtx (mode); res = gen_reg_rtx (mode);
ix86_sse_copysign_to_positive (res, e3, op1, mask); emit_insn (gen_round (res, e2, GEN_INT (ROUND_TRUNC)));
emit_move_insn (op0, res); emit_move_insn (op0, res);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment