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" <gcc-patches@gcc.gnu.org>
Subject: [PATCH, i386]: Allow memory operand for BT with immediate bitcount operand
Date: Sun, 03 Sep 2017 18:53:00 -0000	[thread overview]
Message-ID: <CAFULd4bQ50b0W7z8SLEp0oOKQhrwdRtP09gN1DXf04wAXuJJsA@mail.gmail.com> (raw)

Hello!

The BT instruction is slow only when memory operand is used with
nonimmediate bitcount operand.

2017-09-03  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.md (*bt<mode>): Use nonimmediate_operand
    predicate for operand 1.  Add (m,<S>) constraint.
    (*jcc_bt<mode>): Use nonimmediate_operand predicate for operand 1.
    Prevent memory operand 1 with register operand 2.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN.

Uros.

Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md (revision 251566)
+++ config/i386/i386.md (working copy)
@@ -11217,9 +11217,9 @@
   [(set (reg:CCC FLAGS_REG)
        (compare:CCC
          (zero_extract:SWI48
-           (match_operand:SWI48 0 "register_operand" "r")
+           (match_operand:SWI48 0 "nonimmediate_operand" "r,m")
            (const_int 1)
-           (match_operand:SI 1 "nonmemory_operand" "r<S>"))
+           (match_operand:SI 1 "nonmemory_operand" "r<S>,<S>"))
          (const_int 0)))]
   ""
 {
@@ -11248,7 +11248,7 @@
   [(set (pc)
        (if_then_else (match_operator 0 "bt_comparison_operator"
                        [(zero_extract:SWI48
-                          (match_operand:SWI48 1 "register_operand")
+                          (match_operand:SWI48 1 "nonimmediate_operand")
                           (const_int 1)
                           (match_operand:SI 2 "nonmemory_operand"))
                         (const_int 0)])
@@ -11260,7 +11260,7 @@
        ? (INTVAL (operands[2]) < GET_MODE_BITSIZE (<MODE>mode)
          && INTVAL (operands[2])
               >= (optimize_function_for_size_p (cfun) ? 8 : 32))
-       : register_operand (operands[2], SImode))
+       : !memory_operand (operands[1], <MODE>mode))
    && can_create_pseudo_p ()"
   "#"
   "&& 1"

                 reply	other threads:[~2017-09-03 18:53 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=CAFULd4bQ50b0W7z8SLEp0oOKQhrwdRtP09gN1DXf04wAXuJJsA@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).