public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] lround for PowerPC
@ 2015-11-22  3:21 David Edelsohn
  2015-11-22  8:51 ` Richard Biener
  0 siblings, 1 reply; 11+ messages in thread
From: David Edelsohn @ 2015-11-22  3:21 UTC (permalink / raw)
  To: Segher Boessenkool, William J. Schmidt; +Cc: GCC Patches

PowerPC was missing a definition of the lroundMN pattern, which can be
implemented with  VSX instructions available in Power7.  Below is a
first draft.

- David

* config/rs6000/rs6000.md (*xsrdpidf2): New define_insn.
(lrounddfdi2): New define_expand.

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 8c53c40..eadbe1d 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -77,6 +77,7 @@
    UNSPEC_FRIN
    UNSPEC_FRIP
    UNSPEC_FRIZ
+   UNSPEC_XSRDPI
    UNSPEC_LD_MPIC              ; load_macho_picbase
    UNSPEC_RELD_MPIC            ; re-load_macho_picbase
    UNSPEC_MPIC_CORRECT         ; macho_correct_pic
@@ -5245,6 +5246,27 @@
   [(set_attr "type" "fp")
    (set_attr "fp_type" "fp_addsub_<Fs>")])

+(define_insn "*xsrdpidf2"
+  [(set (match_operand:DF 0 "gpc_reg_operand" "=<Fv>")
+       (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "<Fv>")]
+                  UNSPEC_XSRDPI))]
+  "TARGET_DF_FPR && TARGET_POPCNTD"
+  "xsrdpi %0,%1"
+  [(set_attr "type" "fp")])
+
+(define_expand "lrounddfdi2"
+  [(set (match_dup 2)
+       (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "<Fv>")]
+                  UNSPEC_XSRDPI))
+   (set (match_operand:DI 0 "gpc_reg_operand" "=d")
+       (unspec:DI [(match_dup 2)]
+                  UNSPEC_FCTID))]
+  "TARGET_DF_FPR && TARGET_POPCNTD
+   && flag_unsafe_math_optimizations && !flag_trapping_math"
+{
+  operands[2] = gen_reg_rtx (DFmode);
+})
+
 ; An UNSPEC is used so we don't have to support SImode in FP registers.
 (define_insn "stfiwx"
   [(set (match_operand:SI 0 "memory_operand" "=Z")

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-11-24 22:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-22  3:21 [PATCH] lround for PowerPC David Edelsohn
2015-11-22  8:51 ` Richard Biener
2015-11-22 14:39   ` David Edelsohn
2015-11-22 20:58   ` David Edelsohn
2015-11-23 22:15     ` Michael Meissner
2015-11-24  0:06       ` David Edelsohn
2015-11-24 18:51         ` Michael Meissner
2015-11-24 19:00           ` Michael Meissner
2015-11-24 19:29             ` David Edelsohn
2015-11-24 23:01         ` Michael Meissner
2015-11-24  0:16       ` Michael Meissner

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).