public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: vmakarov@redhat.com,  ubizjak@gmail.com,  markus@trippelsdorf.de,
	 Ganesh.Gopalasubramanian@amd.com
Subject: [PATCH 5/5] Use preferred_for_speed in i386.md
Date: Fri, 17 Oct 2014 14:58:00 -0000	[thread overview]
Message-ID: <87mw8uagqk.fsf@e105548-lin.cambridge.arm.com> (raw)
In-Reply-To: <87bnpabvvx.fsf@e105548-lin.cambridge.arm.com> (Richard	Sandiford's message of "Fri, 17 Oct 2014 15:42:26 +0100")

Undo the original fix for 61630 and use preferred_for_speed in the
problematic pattern.

I've not written many gcc.target/i386 tests so the markup might need
some work.

Richard


gcc/
	* lra.c (lra): Remove call to recog_init.
	* config/i386/i386.md (preferred_for_speed): New attribute
	(*float<SWI48:mode><MODEF:mode>2_sse): Override it instead of
	"enabled".

gcc/testsuite/
	* gcc.target/i386/conversion-2.c: New test.

Index: gcc/lra.c
===================================================================
--- gcc/lra.c	2014-10-17 15:47:34.357453465 +0100
+++ gcc/lra.c	2014-10-17 15:53:10.889463339 +0100
@@ -2116,11 +2116,6 @@ lra (FILE *f)
 
   lra_in_progress = 1;
 
-  /* The enable attributes can change their values as LRA starts
-     although it is a bad practice.  To prevent reuse of the outdated
-     values, clear them.  */
-  recog_init ();
-
   lra_live_range_iter = lra_coalesce_iter = 0;
   lra_constraint_iter = lra_constraint_iter_after_spill = 0;
   lra_inheritance_iter = lra_undo_inheritance_iter = 0;
Index: gcc/config/i386/i386.md
===================================================================
--- gcc/config/i386/i386.md	2014-10-01 10:48:51.079918153 +0100
+++ gcc/config/i386/i386.md	2014-10-17 15:53:10.889463339 +0100
@@ -779,6 +779,8 @@ (define_attr "enabled" ""
 	]
 	(const_int 1)))
 
+(define_attr "preferred_for_speed" "" (const_int 1))
+
 ;; Describe a user's asm statement.
 (define_asm_attributes
   [(set_attr "length" "128")
@@ -4794,16 +4796,12 @@ (define_insn "*float<SWI48:mode><MODEF:m
               (symbol_ref "TARGET_MIX_SSE_I387
                            && X87_ENABLE_FLOAT (<MODEF:MODE>mode,
                                                 <SWI48:MODE>mode)")
-            (eq_attr "alternative" "1")
-              /* ??? For sched1 we need constrain_operands to be able to
-                 select an alternative.  Leave this enabled before RA.  */
-              (symbol_ref "TARGET_INTER_UNIT_CONVERSIONS
-                           || optimize_function_for_size_p (cfun)
-                           || !(reload_completed
-                                || reload_in_progress
-                                || lra_in_progress)")
            ]
            (symbol_ref "true")))
+   (set (attr "preferred_for_speed")
+     (cond [(eq_attr "alternative" "1")
+              (symbol_ref "TARGET_INTER_UNIT_CONVERSIONS")]
+           (symbol_ref "true")))
    ])
 
 (define_insn "*float<SWI48x:mode><MODEF:mode>2_i387"
Index: gcc/testsuite/gcc.target/i386/conversion-2.c
===================================================================
--- /dev/null	2014-10-06 08:13:11.214126005 +0100
+++ gcc/testsuite/gcc.target/i386/conversion-2.c	2014-10-17 15:53:10.893463291 +0100
@@ -0,0 +1,35 @@
+/* { dg-options "-O2 -fno-toplevel-reorder -mfpmath=sse" } */
+/* { dg-require-effective-target lp64 } */
+
+void __attribute__ ((hot, target ("tune=bdver2")))
+f1 (int x)
+{
+  register float f asm ("%xmm0") = x;
+  asm volatile ("#f" :: "x" (f));
+}
+
+void __attribute__ ((cold, target ("tune=bdver2")))
+f2 (int x)
+{
+  register float f asm ("%xmm1") = x;
+  asm volatile ("#f" :: "x" (f));
+}
+
+void __attribute__ ((hot, target ("tune=bdver2")))
+f3 (int x)
+{
+  register float f asm ("%xmm2") = x;
+  asm volatile ("#f" :: "x" (f));
+}
+
+void __attribute__ ((cold, target ("tune=bdver2")))
+f4 (int x)
+{
+  register float f asm ("%xmm3") = x;
+  asm volatile ("#f" :: "x" (f));
+}
+
+/* { dg-final { scan-assembler "sp\\\), %xmm0" } } */
+/* { dg-final { scan-assembler "di, %xmm1" } } */
+/* { dg-final { scan-assembler "sp\\\), %xmm2" } } */
+/* { dg-final { scan-assembler "di, %xmm3" } } */

  parent reply	other threads:[~2014-10-17 14:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17 14:47 [PATCH 0/5] Add preferred_for_{size,speed} attributes Richard Sandiford
2014-10-17 14:48 ` [PATCH 1/5] Add recog_constrain_insn Richard Sandiford
2014-10-21 14:56   ` Vladimir Makarov
2014-10-21 15:45   ` Jeff Law
2014-10-17 14:51 ` [PATCH 2/5] Add preferred_for_{size,speed} attributes Richard Sandiford
2014-10-21 14:57   ` Vladimir Makarov
2014-10-21 17:34   ` Jeff Law
2015-08-03 14:54   ` H.J. Lu
2014-10-17 14:52 ` [PATCH 3/5] Pass an alternative_mask to constrain_operands Richard Sandiford
2014-10-21 15:36   ` Vladimir Makarov
2014-10-21 17:46   ` Jeff Law
2014-10-17 14:55 ` [PATCH 4/5] Remove recog_data.enabled_alternatives Richard Sandiford
2014-10-21 14:57   ` Vladimir Makarov
2014-10-21 15:35   ` Jeff Law
2014-10-17 14:58 ` Richard Sandiford [this message]
2014-10-17 16:59   ` [PATCH 5/5] Use preferred_for_speed in i386.md Uros Bizjak
2014-10-21 15:08   ` Vladimir Makarov

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=87mw8uagqk.fsf@e105548-lin.cambridge.arm.com \
    --to=richard.sandiford@arm.com \
    --cc=Ganesh.Gopalasubramanian@amd.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=markus@trippelsdorf.de \
    --cc=ubizjak@gmail.com \
    --cc=vmakarov@redhat.com \
    /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).