public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH, i386]: Fix PR55929, unable to generate reloads for xbegin insn
Date: Thu, 10 Jan 2013 19:48:00 -0000	[thread overview]
Message-ID: <CAFULd4bkqUhm29_Kaf-nskAepRcNRGZDhvwR=e9NkB-UNh+DbQ@mail.gmail.com> (raw)

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

Hello!

As mentioned by Andrew is PR, reload can't handle jump_insns. Expand
with %eax hard register temporary to avoid this limitation.

2012-01-10  Uros Bizjak  <ubizjak@gmail.com>

	PR target/55929
	* config/i386/i386.md (xbegin): Use %eax as a temporary register.

Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32} and
by compiling libitm/beginend.cc preprocessed source with -Os mrtm
-std=gnu++0x. Committed to mainline SVN.

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 980 bytes --]

Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 195091)
+++ config/i386/i386.md	(working copy)
@@ -18013,19 +18013,22 @@
 
 (define_expand "xbegin"
   [(set (match_operand:SI 0 "register_operand")
-	(unspec_volatile:SI [(match_dup 1)] UNSPECV_XBEGIN))]
+	(unspec_volatile:SI [(const_int 0)] UNSPECV_XBEGIN))]
   "TARGET_RTM"
 {
   rtx label = gen_label_rtx ();
 
-  operands[1] = force_reg (SImode, constm1_rtx);
+  /* xbegin is emitted as jump_insn, so reload won't be able
+     to reload its operand.  Force the value into AX hard register.  */
+  rtx ax_reg = gen_rtx_REG (SImode, AX_REG);
+  emit_move_insn (ax_reg, constm1_rtx);
 
-  emit_jump_insn (gen_xbegin_1 (operands[1], label));
+  emit_jump_insn (gen_xbegin_1 (ax_reg, label));
 
   emit_label (label);
   LABEL_NUSES (label) = 1;
 
-  emit_move_insn (operands[0], operands[1]);
+  emit_move_insn (operands[0], ax_reg);
 
   DONE;
 })

                 reply	other threads:[~2013-01-10 19:48 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='CAFULd4bkqUhm29_Kaf-nskAepRcNRGZDhvwR=e9NkB-UNh+DbQ@mail.gmail.com' \
    --to=ubizjak@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).