* [PATCH] PR target/68609 vector swsqrt
@ 2016-01-20 19:35 David Edelsohn
0 siblings, 0 replies; only message in thread
From: David Edelsohn @ 2016-01-20 19:35 UTC (permalink / raw)
To: GCC Patches
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" "")
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-01-20 19:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 19:35 [PATCH] PR target/68609 vector swsqrt David Edelsohn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).