PR target/68609
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Jan 2016 19:39:08 +0000 (19:39 +0000)
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Jan 2016 19:39:08 +0000 (19:39 +0000)
        * config/rs6000/rs6000.c (rs6000_emit_swsqrt): Add vector sqrt
        domain check.
        * config/rs6000/vector.md (sqrt<mode>2): Call rs6000_emit_swsqrt
        for V4SFmode.

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

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/vector.md

index d976bd9..ee05d49 100644 (file)
@@ -1,3 +1,11 @@
+2016-01-20  David Edelsohn  <dje.gcc@gmail.com>
+
+       PR target/68609
+       * config/rs6000/rs6000.c (rs6000_emit_swsqrt): Add vector sqrt
+       domain check.
+       * config/rs6000/vector.md (sqrt<mode>2): Call rs6000_emit_swsqrt
+       for V4SFmode.
+
 2016-01-20  Richard Henderson  <rth@redhat.com>
 
        PR bootstrap/69343
@@ -43,7 +51,7 @@
        (pc_or_label_operand): New predicate.
        * config/m68k/m68k.md: Add new peephole2 patterns for GTU/LEU
        tests for small integers that are 2^n - 1.
-       
+
 2016-01-20  Jonathan Wakely  <jwakely@redhat.com>
 
        * doc/invoke.texi (Options Summary): Add '.' after @xref.
index c589118..539446c 100644 (file)
@@ -32904,10 +32904,19 @@ rs6000_emit_swsqrt (rtx dst, rtx src, bool recip)
   if (!recip)
     {
       rtx zero = force_reg (mode, CONST0_RTX (mode));
-      rtx target = emit_conditional_move (e, GT, src, zero, mode,
-                                         e, zero, mode, 0);
-      if (target != e)
-       emit_move_insn (e, target);
+
+      if (mode == SFmode)
+       {
+         rtx target = emit_conditional_move (e, GT, src, zero, mode,
+                                             e, zero, mode, 0);
+         if (target != e)
+           emit_move_insn (e, target);
+       }
+      else
+       {
+         rtx cond = gen_rtx_GT (VOIDmode, e, zero);
+         rs6000_emit_vector_cond_expr (e, e, zero, cond, src, zero);
+       }
     }
 
   /* g = sqrt estimate.  */
index 7eca7ce..02fb3e3 100644 (file)
   [(set (match_operand:VEC_F 0 "vfloat_operand" "")
        (sqrt:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")))]
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
-  "")
+{
+  if (<MODE>mode == V4SFmode
+      && !optimize_function_for_size_p (cfun)
+      && flag_finite_math_only && !flag_trapping_math
+      && flag_unsafe_math_optimizations)
+    {
+      rs6000_emit_swsqrt (operands[0], operands[1], 0);
+      DONE;
+    }
+})
 
 (define_expand "rsqrte<mode>2"
   [(set (match_operand:VEC_F 0 "vfloat_operand" "")