public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ilya Tocar <tocarip.intel@gmail.com>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] PR64393
Date: Wed, 14 Jan 2015 12:08:00 -0000	[thread overview]
Message-ID: <20150114115649.GB66571@msticlxl7.ims.intel.com> (raw)

Hi,

This patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64393
It makes -mavx512vbmi enable avx512bw, as it requires 64-bit masks.
OK for trunk?

ChangeLog:

gcc/
	PR target/64393
	* common/config/i386/i386-common.c (OPTION_MASK_ISA_AVX512VBMI_SET):
	Enable AVX512BW.
	(OPTION_MASK_ISA_AVX512BW_UNSET): Disable AVX512BW.
	* config/i386/i386.c (ix86_hard_regno_mode_ok): Don't check
	AVX512VBMI, as it implies AVX512BW.

testsuite/
	PR target/64393
	* gcc.target/i386/pr64393.c: New test.

---
 gcc/common/config/i386/i386-common.c    |  5 +++--
 gcc/config/i386/i386.c                  |  2 +-
 gcc/testsuite/gcc.target/i386/pr64393.c | 12 ++++++++++++
 3 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr64393.c

diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c
index 77edb47..4e5687a 100644
--- a/gcc/common/config/i386/i386-common.c
+++ b/gcc/common/config/i386/i386-common.c
@@ -74,7 +74,7 @@ along with GCC; see the file COPYING3.  If not see
 #define OPTION_MASK_ISA_AVX512IFMA_SET \
   (OPTION_MASK_ISA_AVX512IFMA | OPTION_MASK_ISA_AVX512F_SET)
 #define OPTION_MASK_ISA_AVX512VBMI_SET \
-  (OPTION_MASK_ISA_AVX512VBMI | OPTION_MASK_ISA_AVX512F_SET)
+  (OPTION_MASK_ISA_AVX512VBMI | OPTION_MASK_ISA_AVX512BW_SET)
 #define OPTION_MASK_ISA_RTM_SET OPTION_MASK_ISA_RTM
 #define OPTION_MASK_ISA_PRFCHW_SET OPTION_MASK_ISA_PRFCHW
 #define OPTION_MASK_ISA_RDSEED_SET OPTION_MASK_ISA_RDSEED
@@ -171,7 +171,8 @@ along with GCC; see the file COPYING3.  If not see
 #define OPTION_MASK_ISA_AVX512PF_UNSET OPTION_MASK_ISA_AVX512PF
 #define OPTION_MASK_ISA_AVX512ER_UNSET OPTION_MASK_ISA_AVX512ER
 #define OPTION_MASK_ISA_AVX512DQ_UNSET OPTION_MASK_ISA_AVX512DQ
-#define OPTION_MASK_ISA_AVX512BW_UNSET OPTION_MASK_ISA_AVX512BW
+#define OPTION_MASK_ISA_AVX512BW_UNSET \
+  (OPTION_MASK_ISA_AVX512BW | OPTION_MASK_ISA_AVX512VBMI_UNSET)
 #define OPTION_MASK_ISA_AVX512VL_UNSET OPTION_MASK_ISA_AVX512VL
 #define OPTION_MASK_ISA_AVX512IFMA_UNSET OPTION_MASK_ISA_AVX512IFMA
 #define OPTION_MASK_ISA_AVX512VBMI_UNSET OPTION_MASK_ISA_AVX512VBMI
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 7a39f80..91eae5a 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -41669,7 +41669,7 @@ ix86_hard_regno_mode_ok (int regno, machine_mode mode)
     return VALID_FP_MODE_P (mode);
   if (MASK_REGNO_P (regno))
     return (VALID_MASK_REG_MODE (mode)
-	    || ((TARGET_AVX512BW || TARGET_AVX512VBMI)
+	    || (TARGET_AVX512BW
 		&& VALID_MASK_AVX512BW_MODE (mode)));
   if (BND_REGNO_P (regno))
     return VALID_BND_REG_MODE (mode);
diff --git a/gcc/testsuite/gcc.target/i386/pr64393.c b/gcc/testsuite/gcc.target/i386/pr64393.c
new file mode 100644
index 0000000..37a0e48
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr64393.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mavx512vbmi" } */
+
+int a[1024];
+
+void
+foo (int i)
+{
+  for (;; i++)
+    if (a[i] != (i ^ (i * 3) ^ (i * 7)))
+      return;
+}
-- 
1.8.3.1

             reply	other threads:[~2015-01-14 11:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 12:08 Ilya Tocar [this message]
2015-01-14 12:15 ` Uros Bizjak
2015-01-14 12:18   ` H.J. Lu

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=20150114115649.GB66571@msticlxl7.ims.intel.com \
    --to=tocarip.intel@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ubizjak@gmail.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).