PR68577: Handle narrowing for vector popcount, etc.
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 1 Dec 2015 21:01:35 +0000 (21:01 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 1 Dec 2015 21:01:35 +0000 (21:01 +0000)
commitb1b6836e90ee5e3f103e6150a7713bef51d5790c
treefab5425f914edd1fec50aa1a372f277f20dc7ab8
parente5f310313531456890c23279d248afb7e5cecf71
PR68577: Handle narrowing for vector popcount, etc.

This patch adds support for simple cases where a vector
internal function returns wider results than the scalar
equivalent.  It punts on other cases.

Tested on powerpc64-linux-gnu and x86_64-linux-gnu.

gcc/
PR tree-optimization/68577
* tree-vect-stmts.c (simple_integer_narrowing): New function.
(vectorizable_call): Restrict internal function handling
to NONE and NARROW cases, using simple_integer_narrowing
to test for the latter.  Add cost of narrowing operation
and insert it where necessary.

gcc/testsuite/
PR tree-optimization/68577
* gcc.dg/vect/pr68577.c: New test.

From-SVN: r231131
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr68577.c [new file with mode: 0644]
gcc/tree-vect-stmts.c