public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: liuhongt <hongtao.liu@intel.com>
To: gcc-patches@gcc.gnu.org
Cc: crazylht@gmail.com, hjl.tools@gmail.com, ubizjak@gmail.com
Subject: [PATCH] [x86] Fix ICE due to condition mismatch between expander and define_insn.
Date: Tue,  6 Dec 2022 16:06:23 +0800	[thread overview]
Message-ID: <20221206080623.1879920-1-hongtao.liu@intel.com> (raw)

ice.i:7:1: error: unrecognizable insn:
    7 | }
      | ^
(insn 7 6 8 2 (set (reg:V2SF 84 [ vect__3.8 ])
        (unspec:V2SF [
                (reg:V2SF 86 [ vect__1.7 ])
                (const_int 11 [0xb])
            ] UNSPEC_ROUND)) "ice.i":5:14 -1
     (nil))
during RTL pass: vregs

Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
I checked other round patterns are ok, just typo in this one.
Ready push to trunk as obvious patch.

gcc/ChangeLog:

	PR target/107970
	* config/i386/mmx.md (btruncv2sf2): Add TARGET_MMX_WITH_SSE to
	the condition.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr107970.c: New test.
---
 gcc/config/i386/mmx.md                   |  3 ++-
 gcc/testsuite/gcc.target/i386/pr107970.c | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr107970.c

diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index 63aff287795..c3afc6b5846 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -1709,7 +1709,8 @@ (define_expand "btruncv2sf2"
 	  [(match_operand:V2SF 1 "register_operand")
 	   (match_dup 2)]
 	  UNSPEC_ROUND))]
-  "TARGET_SSE4_1 && !flag_trapping_math"
+  "TARGET_SSE4_1 && !flag_trapping_math
+  && TARGET_MMX_WITH_SSE"
   "operands[2] = GEN_INT (ROUND_TRUNC | ROUND_NO_EXC);")
 
 (define_insn "*mmx_roundv2sf2"
diff --git a/gcc/testsuite/gcc.target/i386/pr107970.c b/gcc/testsuite/gcc.target/i386/pr107970.c
new file mode 100644
index 00000000000..1fbbb14ee72
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr107970.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-Ofast -m3dnow -msse4.1" } */
+
+float *foo_p;
+
+void
+foo(float *__restrict q) {
+  foo_p[0] = __builtin_truncf(q[0]);
+  foo_p[1] = __builtin_truncf(q[1]);
+}
-- 
2.27.0


                 reply	other threads:[~2022-12-06  8:06 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=20221206080623.1879920-1-hongtao.liu@intel.com \
    --to=hongtao.liu@intel.com \
    --cc=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --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).