vect: Recog mul_highpart pattern [PR100696]
authorKewen Lin <linkw@linux.ibm.com>
Tue, 20 Jul 2021 01:49:17 +0000 (20:49 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Tue, 20 Jul 2021 01:49:17 +0000 (20:49 -0500)
commita1d27560770818c514ad1ad6683f89e1e1bcd0ec
tree46cd1dff533809eb536b88b81536eefb0815624f
parent21ea2f9320d31d3d925031a8ba189d9b19e52bc1
vect: Recog mul_highpart pattern [PR100696]

This patch is to extend the existing pattern mulhs handlings
to cover normal multiply highpart pattern recognization, it
introduces one new internal function IFN_MULH for 1:1 map to
[su]mul_highpart optab.  Since it covers MULT_HIGHPART_EXPR
with optab support, i386 part change is to ensure it follows
the consistent costing path.

Bootstrapped & regtested on powerpc64le-linux-gnu P9,
x86_64-redhat-linux and aarch64-linux-gnu.

gcc/ChangeLog:

PR tree-optimization/100696
* internal-fn.c (first_commutative_argument): Add info for IFN_MULH.
* internal-fn.def (IFN_MULH): New internal function.
* tree-vect-patterns.c (vect_recog_mulhs_pattern): Add support to
recog normal multiply highpart as IFN_MULH.
* config/i386/i386.c (ix86_add_stmt_cost): Adjust for combined
function CFN_MULH.

gcc/testsuite/ChangeLog:

PR tree-optimization/100696
* gcc.target/i386/pr100637-3w.c: Adjust for mul_highpart recog.
gcc/config/i386/i386.c
gcc/internal-fn.c
gcc/internal-fn.def
gcc/testsuite/gcc.target/i386/pr100637-3w.c
gcc/tree-vect-patterns.c