public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: gcc-patches@gcc.gnu.org
Cc: dje.gcc@gmail.com,	Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH] rs6000: Fix *movsi_from_df (PR88892)
Date: Fri, 18 Jan 2019 17:14:00 -0000	[thread overview]
Message-ID: <bc7ccd386c8b33bc53381336787d72264dd96dce.1547831579.git.segher@kernel.crashing.org> (raw)

The memory store instructions (stfs[u][x], stxssp[x]) can result in
garbage if the value to be stored isn't already a valid single
precision floating point number.  So we cannot use this here.

This needs backporting to 8, according to the PR.

Tested etc.; committing to trunk.


Segher


2019-01-18  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/88892
	* config/rs6000/rs6000.md (*movsi_from_df): Allow only register
	operands.

---
 gcc/config/rs6000/rs6000.md | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 13970f3..d59b46f 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -7015,24 +7015,19 @@ (define_insn_and_split "*movdi_from_sf_zero_ext"
 		 8,          4")])
 
 ;; Like movsi_from_sf, but combine a convert from DFmode to SFmode before
-;; moving it to SImode.  We can do a SFmode store without having to do the
-;; conversion explicitly.  If we are doing a register->register conversion, use
-;; XSCVDPSP instead of XSCVDPSPN, since the former handles cases where the
-;; input will not fit in a SFmode, and the later assumes the value has already
-;; been rounded.
+;; moving it to SImode.  We cannot do a SFmode store without having to do the
+;; conversion explicitly since that doesn't work in most cases if the input
+;; isn't representable as SF.  Use XSCVDPSP instead of XSCVDPSPN, since the
+;; former handles cases where the input will not fit in a SFmode, and the
+;; latter assumes the value has already been rounded.
 (define_insn "*movsi_from_df"
-  [(set (match_operand:SI 0 "nonimmediate_operand"         "=wa,m,wY,Z")
+  [(set (match_operand:SI 0 "gpc_reg_operand" "=wa")
 	(unspec:SI [(float_truncate:SF
-		     (match_operand:DF 1 "gpc_reg_operand" "wa, f,wb,wa"))]
+		     (match_operand:DF 1 "gpc_reg_operand" "wa"))]
 		    UNSPEC_SI_FROM_SF))]
-
   "TARGET_NO_SF_SUBREG"
-  "@
-   xscvdpsp %x0,%x1
-   stfs%U0%X0 %1,%0
-   stxssp %1,%0
-   stxsspx %x1,%y0"
-  [(set_attr "type"   "fp,fpstore,fpstore,fpstore")])
+  "xscvdpsp %x0,%x1"
+  [(set_attr "type" "fp")])
 
 ;; Split a load of a large constant into the appropriate two-insn
 ;; sequence.
-- 
1.8.3.1

                 reply	other threads:[~2019-01-18 17:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc7ccd386c8b33bc53381336787d72264dd96dce.1547831579.git.segher@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).