From: Uros Bizjak Date: Thu, 11 May 2023 18:54:24 +0000 (+0200) Subject: i386: Handle V4HI and V2SImode in ix86_widen_mult_cost [PR109807] X-Git-Tag: basepoints/gcc-15~9426 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10a0d98356680a387b69f8659099450f7af86d9f;p=thirdparty%2Fgcc.git i386: Handle V4HI and V2SImode in ix86_widen_mult_cost [PR109807] 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. --- diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index b1d08ecdb3d4..62fe06fdbaa4 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 000000000000..6380eb35312c --- /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"