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]: Merge mulx patterns
Date: Mon, 13 Apr 2015 14:05:00 -0000	[thread overview]
Message-ID: <CAFULd4bCa=VGAOtgXxFxtAw+mSmhB9TMyLP2HgStynJqK7c5Bw@mail.gmail.com> (raw)

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

Hello!

2015-04-13  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.md (*bmi2_umul<mode><dwi>3_1): Merge from
    *bmi2_umulsidi3_1 and *bmi2_umulditi3_1 using DWIH mode iterator.

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

Uros.

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

Index: i386.md
===================================================================
--- i386.md	(revision 221840)
+++ i386.md	(working copy)
@@ -6818,42 +6818,24 @@
 	      (clobber (reg:CC FLAGS_REG))])]
   "TARGET_QIMODE_MATH")
 
-(define_insn "*bmi2_umulditi3_1"
-  [(set (match_operand:DI 0 "register_operand" "=r")
-	(mult:DI
-	  (match_operand:DI 2 "nonimmediate_operand" "%d")
-	  (match_operand:DI 3 "nonimmediate_operand" "rm")))
-   (set (match_operand:DI 1 "register_operand" "=r")
-	(truncate:DI
-	  (lshiftrt:TI
-	    (mult:TI (zero_extend:TI (match_dup 2))
-		     (zero_extend:TI (match_dup 3)))
-	    (const_int 64))))]
-  "TARGET_64BIT && TARGET_BMI2
+(define_insn "*bmi2_umul<mode><dwi>3_1"
+  [(set (match_operand:DWIH 0 "register_operand" "=r")
+	(mult:DWIH
+	  (match_operand:DWIH 2 "nonimmediate_operand" "%d")
+	  (match_operand:DWIH 3 "nonimmediate_operand" "rm")))
+   (set (match_operand:DWIH 1 "register_operand" "=r")
+	(truncate:DWIH
+	  (lshiftrt:<DWI>
+	    (mult:<DWI> (zero_extend:<DWI> (match_dup 2))
+			(zero_extend:<DWI> (match_dup 3)))
+	    (match_operand:QI 4 "const_int_operand" "n"))))]
+  "TARGET_BMI2 && INTVAL (operands[4]) == <MODE_SIZE> * BITS_PER_UNIT
    && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
   "mulx\t{%3, %0, %1|%1, %0, %3}"
   [(set_attr "type" "imulx")
    (set_attr "prefix" "vex")
-   (set_attr "mode" "DI")])
+   (set_attr "mode" "<MODE>")])
 
-(define_insn "*bmi2_umulsidi3_1"
-  [(set (match_operand:SI 0 "register_operand" "=r")
-	(mult:SI
-	  (match_operand:SI 2 "nonimmediate_operand" "%d")
-	  (match_operand:SI 3 "nonimmediate_operand" "rm")))
-   (set (match_operand:SI 1 "register_operand" "=r")
-	(truncate:SI
-	  (lshiftrt:DI
-	    (mult:DI (zero_extend:DI (match_dup 2))
-		     (zero_extend:DI (match_dup 3)))
-	    (const_int 32))))]
-  "!TARGET_64BIT && TARGET_BMI2
-   && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
-  "mulx\t{%3, %0, %1|%1, %0, %3}"
-  [(set_attr "type" "imulx")
-   (set_attr "prefix" "vex")
-   (set_attr "mode" "SI")])
-
 (define_insn "*umul<mode><dwi>3_1"
   [(set (match_operand:<DWI> 0 "register_operand" "=r,A")
 	(mult:<DWI>
@@ -6902,7 +6884,7 @@
 {
   split_double_mode (<DWI>mode, &operands[0], 1, &operands[3], &operands[4]);
 
-  operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
+  operands[5] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT);
 })
 
 (define_insn "*mul<mode><dwi>3_1"

                 reply	other threads:[~2015-04-13 14:05 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='CAFULd4bCa=VGAOtgXxFxtAw+mSmhB9TMyLP2HgStynJqK7c5Bw@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).