public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Richard Henderson <rth@redhat.com>
Subject: Re: [PATCH] PR target/66813: gcc.target/i386/asm-flag-5.c failed with -march=pentium
Date: Fri, 10 Jul 2015 10:08:00 -0000	[thread overview]
Message-ID: <CAFULd4brsiMRtTukn=qRmF1Y9e1uLMyhBHQwnE-apK=ZL-k17Q@mail.gmail.com> (raw)
In-Reply-To: <CAFULd4b=E9qFZxLp=4UNrYL+_VYea--Kgbyw7Gj6WkuV9E=86Q@mail.gmail.com>

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

On Thu, Jul 9, 2015 at 3:15 PM, Uros Bizjak <ubizjak@gmail.com> wrote:

>> gen_rtx_ZERO_EXTEND isn't suitable in ix86_md_asm_adjust since ZERO_EXTEND
>> may be expaned.  We should call gen_zero_extendqiXi2 instead.
>>
>> OK for trunk?
>
> No, your patch will clobber flags when multiple flag outputs are used.
>
> (I plan to rewrite x86 zero_extend patterns to use preferred_for_size
> attribute with peepholes, this will magically solve this bug and
> readeflags-1.c failure).

No, the above mentioned patch won't fly, it limits AND insn operands
too much with "q" constraint.

So, the patch below is what I plan to commit after
bootstrap/regression test on x86_64-linux-gnu {,-m32}.

2015-07-10  Uros Bizjak  <ubizjak@gmail.com>

    PR target/66813
    * config/i386/i386.c (ix86_md_asm_adjust): Emit movstrictqi
    sequence for TARGET_ZERO_EXTEND_WITH_AND targets.

testsuite/ChangeLog:

2015-07-10  Uros Bizjak  <ubizjak@gmail.com>

    PR target/66813
    * gcc.target/i386/pr66813.c: New test.

Uros.

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

Index: testsuite/gcc.target/i386/pr66813.c
===================================================================
--- testsuite/gcc.target/i386/pr66813.c	(revision 0)
+++ testsuite/gcc.target/i386/pr66813.c	(revision 0)
@@ -0,0 +1,4 @@
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-march=pentium" } */
+
+#include "asm-flag-5.c"
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 225648)
+++ config/i386/i386.c	(working copy)
@@ -45842,7 +45842,17 @@ ix86_md_asm_adjust (vec<rtx> &outputs, vec<rtx> &/
 	{
 	  rtx destqi = gen_reg_rtx (QImode);
 	  emit_insn (gen_rtx_SET (destqi, x));
-	  x = gen_rtx_ZERO_EXTEND (dest_mode, destqi);
+
+	  if (TARGET_ZERO_EXTEND_WITH_AND
+	      && optimize_function_for_speed_p (cfun))
+	    {
+	      x = force_reg (dest_mode, const0_rtx);
+
+	      emit_insn (gen_movstrictqi
+			 (gen_lowpart (QImode, x), destqi));
+	    }
+	  else
+	    x = gen_rtx_ZERO_EXTEND (dest_mode, destqi);
 	}
       emit_insn (gen_rtx_SET (dest, x));
     }

      reply	other threads:[~2015-07-10 10:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 13:10 H.J. Lu
2015-07-09 13:15 ` Uros Bizjak
2015-07-10 10:08   ` Uros Bizjak [this message]

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='CAFULd4brsiMRtTukn=qRmF1Y9e1uLMyhBHQwnE-apK=ZL-k17Q@mail.gmail.com' \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=rth@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).