OSDN Git Service

* config/i386/i386.c (ix86_expand_round_sse4): Expand as
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 20 Aug 2011 10:15:59 +0000 (10:15 +0000)
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 20 Aug 2011 10:15:59 +0000 (10:15 +0000)
trunc (a + copysign (nextafter (0.5, 0.0), a)).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177927 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386.c

index 987baa9..e72be38 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        * doc/tm.texi.in (PREFERRED_OUTPUT_RELOAD_CLASS): Remove.
@@ -10,9 +16,8 @@
 
        PR tree-optimization/48739
        * tree-ssa.c: Include cfgloop.h.
-       (execute_update_addresses_taken): When updating ssa, if in
-       loop closed SSA form, call rewrite_into_loop_closed_ssa instead of
-       update_ssa.
+       (execute_update_addresses_taken): When updating ssa, if in loop closed
+       SSA form, call rewrite_into_loop_closed_ssa instead of update_ssa.
        * Makefile.in (tree-ssa.o): Depend on $(CFGLOOP_H).
 
 2011-08-19  Vladimir Makarov  <vmakarov@redhat.com>
@@ -34,8 +39,7 @@
 
 2011-08-19  Joseph Myers  <joseph@codesourcery.com>
 
-       * c-parser.c (c_parser_postfix_expression): Handle
-       RID_BUILTIN_COMPLEX.
+       * c-parser.c (c_parser_postfix_expression): Handle RID_BUILTIN_COMPLEX.
        * doc/extend.texi (__builtin_complex): Document.
 
 2011-08-19  Andrew Stubbs  <ams@codesourcery.com>
 
        * c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if
        pedantic.
-       * c-parser.c (c_parser_declspecs): Include _Noreturn in syntax
-       comment.
+       * c-parser.c (c_parser_declspecs): Include _Noreturn in syntax comment.
        * ginclude/stdnoreturn.h (noreturn): Don't define for C++.
 
 2011-08-19  Joseph Myers  <joseph@codesourcery.com>
        AVX2 feature.
        * config/i386/i386-c.c (ix86_target_macros_internal):
        Conditionally define __AVX2__.
-       * config/i386/i386.c (ix86_option_override_internal): Define
-       PTA_AVX2.  Define "core-avx2" processor alias.  Handle avx2
-       option.
+       * config/i386/i386.c (ix86_option_override_internal): Define PTA_AVX2.
+       Define "core-avx2" processor alias.  Handle avx2 option.
        (ix86_valid_target_attribute_inner_p): Handle avx2 option.
        * config/i386/i386.h (TARGET_AVX2): New.
        * config/i386/i386.opt (mavx2): New.
        * cgraphunit.c (thunk_adjust): Use fold_build_pointer_plus_loc.
        (cgraph_redirect_edge_call_stmt_to_callee): Use size_int.
        * expr.c (expand_expr_addr_expr_1): Use fold_build_pointer_plus.
-       * fold-const.c (build_range_check): Negate using the original
-       type.
+       * fold-const.c (build_range_check): Negate using the original type.
        (fold_unary_loc): Use fold_build_pointer_plus_loc.
        * gimple-fold.c (gimple_adjust_this_by_delta): Use
        convert_to_ptrofftype.
 
 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
        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.
        (streamer_write_uhwi): Rename from lto_output_uleb128.
 
 2011-08-12  Richard Guenther  <rguenther@suse.de>
 
-       * tree-vrp.c (extract_range_from_unary_expr_1): Implement
-       -X as 0 - X.
+       * tree-vrp.c (extract_range_from_unary_expr_1): Implement -X as 0 - X.
 
 2011-08-12  Romain Geissler  <romain.geissler@gmail.com>
 
index 53c5944..bdcbd26 100644 (file)
@@ -32700,42 +32700,44 @@ void
 ix86_expand_round_sse4 (rtx op0, rtx op1)
 {
   enum machine_mode mode = GET_MODE (op0);
-  rtx e1, e2, e3, res, half, mask;
+  rtx e1, e2, res, half;
   const struct real_format *fmt;
   REAL_VALUE_TYPE pred_half, half_minus_pred_half;
+  rtx (*gen_copysign) (rtx, rtx, rtx);
   rtx (*gen_round) (rtx, rtx, rtx);
 
   switch (mode)
     {
     case SFmode:
+      gen_copysign = gen_copysignsf3;
       gen_round = gen_sse4_1_roundsf2;
       break;
     case DFmode:
+      gen_copysign = gen_copysigndf3;
       gen_round = gen_sse4_1_rounddf2;
       break;
     default:
       gcc_unreachable ();
     }
 
-  /* e1 = fabs(op1) */
-  e1 = ix86_expand_sse_fabs (op1, &mask);
+  /* round (a) = trunc (a + copysign (0.5, a)) */
 
   /* load nextafter (0.5, 0.0) */
   fmt = REAL_MODE_FORMAT (mode);
   real_2expN (&half_minus_pred_half, -(fmt->p) - 1, mode);
   REAL_ARITHMETIC (pred_half, MINUS_EXPR, dconsthalf, half_minus_pred_half);
+  half = const_double_from_real_value (pred_half, mode);
 
-  /* e2 = e1 + 0.5 */
-  half = force_reg (mode, const_double_from_real_value (pred_half, mode));
-  e2 = expand_simple_binop (mode, PLUS, e1, half, NULL_RTX, 0, OPTAB_DIRECT);
+  /* e1 = copysign (0.5, op1) */
+  e1 = gen_reg_rtx (mode);
+  emit_insn (gen_copysign (e1, half, op1));
 
-  /* e3 = trunc(e2) */
-  e3 = gen_reg_rtx (mode);
-  emit_insn (gen_round (e3, e2, GEN_INT (ROUND_TRUNC)));
+  /* e2 = op1 + e1 */
+  e2 = expand_simple_binop (mode, PLUS, op1, e1, NULL_RTX, 0, OPTAB_DIRECT);
 
-  /* res = copysign (e3, op1) */
+  /* res = trunc (e2) */
   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);
 }