public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH SH]  Don't switch mode around fmov (pr61195)
@ 2014-05-16  9:14 Christian Bruel
  2014-05-16 23:21 ` Kaz Kojima
  2014-05-16 23:22 ` Oleg Endo
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Bruel @ 2014-05-16  9:14 UTC (permalink / raw)
  To: gcc-patches; +Cc: Kaz Kojima, Oleg Endo

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

Hi,

This patch reduces the number of unnecessary PR mode switches for single
precision moves. When FPSCR.SZ is not forced. Test illustration in the patch

Regtested for sh-none-elf with -m4, (-m2a still running), bootstrapped
on sh4-linux-elf board. ok for trunk ?

Many thanks,

Christian





 



[-- Attachment #2: fmov.patch --]
[-- Type: text/x-patch, Size: 2051 bytes --]

2014-05-16  Christian Bruel  <christian.bruel@st.com>

	PR target/61195
	* config/sh/sh.c (movsf_ie): Unset fp_mode for fmov.

2014-05-16  Christian Bruel  <christian.bruel@st.com>

	PR target/61195
	* gcc.target/sh/pr61195.c: New test.

Index: config/sh/sh.md
===================================================================
--- config/sh/sh.md	(revision 210475)
+++ config/sh/sh.md	(working copy)
@@ -8357,9 +8357,26 @@ label:
       (const_int 2)
       (const_int 2)
       (const_int 0)])
-   (set (attr "fp_mode") (if_then_else (eq_attr "fmovd" "yes")
-					   (const_string "single")
-					   (const_string "single")))])
+  (set_attr_alternative "fp_mode"
+     [(if_then_else (eq_attr "fmovd" "yes") (const_string "single") (const_string "none"))
+      (const_string "none")
+      (const_string "single")
+      (const_string "single")
+      (const_string "none")
+      (if_then_else (eq_attr "fmovd" "yes") (const_string "single") (const_string "none"))
+      (if_then_else (eq_attr "fmovd" "yes") (const_string "single") (const_string "none"))
+      (const_string "none")
+      (const_string "none")
+      (const_string "none")
+      (const_string "none")
+      (const_string "none")
+      (const_string "none")
+      (const_string "none")
+      (const_string "none")
+      (const_string "none")
+      (const_string "none")
+      (const_string "none")
+      (const_string "none")])])
 
 (define_split
   [(set (match_operand:SF 0 "register_operand" "")
Index: testsuite/gcc.target/sh/pr61195.c
===================================================================
--- testsuite/gcc.target/sh/pr61195.c	(revision 0)
+++ testsuite/gcc.target/sh/pr61195.c	(working copy)
@@ -0,0 +1,19 @@
+/* Verify that we don't switch mode for single moves.  */
+/* { dg-do compile }  */
+/* { dg-require-effective-target hard_float } */
+/* { dg-skip-if "" { *-*-* }  { "mfmovd" } { "" } } */
+/* { dg-final { scan-assembler-not "fpscr" } } */
+
+float *g;
+
+float
+foo(float f)
+{
+  return f;
+}
+
+float
+foo1(void)
+{
+  return *g;
+}

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

end of thread, other threads:[~2014-05-16 23:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-16  9:14 [PATCH SH] Don't switch mode around fmov (pr61195) Christian Bruel
2014-05-16 23:21 ` Kaz Kojima
2014-05-16 23:22 ` Oleg Endo

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