From: Uros Bizjak <ubizjak@gmail.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH] i386: Handle V4HI and V2SImode in ix86_widen_mult_cost [PR109807]
Date: Thu, 11 May 2023 20:56:30 +0200 [thread overview]
Message-ID: <CAFULd4bY-ChBDrQ0SG+KkCGpZZ_74+PFr8sTVGNWzzWKvmbMkg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 413 bytes --]
Do not crash when asking ix86_widen_mult_cost for the cost of
a widening mul operation to V4HI or V2SImode.
gcc/ChangeLog:
PR target/109807
* config/i386/i386.cc (ix86_widen_mult_cost):
Handle V4HImode and V2SImode.
gcc/testsuite/ChangeLog:
PR target/109807
* gcc.target/i386/pr109807.c: New test.
Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Pushed to master.
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 938 bytes --]
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index b1d08ecdb3d..62fe06fdbaa 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -20417,12 +20417,14 @@ ix86_widen_mult_cost (const struct processor_costs *cost,
int basic_cost = 0;
switch (mode)
{
+ case V4HImode:
case V8HImode:
case V16HImode:
if (!uns_p || mode == V16HImode)
extra_cost = cost->sse_op * 2;
basic_cost = cost->mulss * 2 + cost->sse_op * 4;
break;
+ case V2SImode:
case V4SImode:
case V8SImode:
/* pmulhw/pmullw can be used. */
diff --git a/gcc/testsuite/gcc.target/i386/pr109807.c b/gcc/testsuite/gcc.target/i386/pr109807.c
new file mode 100644
index 00000000000..6380eb35312
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr109807.c
@@ -0,0 +1,4 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -msse4" } */
+
+#include "sse2-mmx-pmaddwd.c"
reply other threads:[~2023-05-11 18:56 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=CAFULd4bY-ChBDrQ0SG+KkCGpZZ_74+PFr8sTVGNWzzWKvmbMkg@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).