This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR target/68609 vector swsqrt
- From: David Edelsohn <dje dot gcc at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 20 Jan 2016 14:35:18 -0500
- Subject: [PATCH] PR target/68609 vector swsqrt
- Authentication-results: sourceware.org; auth=none
This patch finishes PR target/68609 to use reciprocal estimate for vector sqrt.
PR target/68609
* config/rs6000/rs6000.c (rs6000_emit_swsqrt): Add vector domain check.
* config/rs6000/vector.md (sqrt<mode>2): Call rs6000_emit_swsqrt for V4SFmode.
Thanks, David
Index: rs6000.c
===================================================================
--- rs6000.c (revision 232439)
+++ rs6000.c (working copy)
@@ -32904,10 +32904,19 @@
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: vector.md
===================================================================
--- vector.md (revision 232438)
+++ vector.md (working copy)
@@ -270,7 +270,16 @@
[(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" "")