r267646 - in /trunk/gcc: ChangeLog match.pd tes...

rsandifo@gcc.gnu.org rsandifo@gcc.gnu.org
Mon Jan 7 12:17:00 GMT 2019


Author: rsandifo
Date: Mon Jan  7 12:17:10 2019
New Revision: 267646

URL: https://gcc.gnu.org/viewcvs?rev=267646&root=gcc&view=rev
Log:
[2/2] PR88598: Optimise reduc (bit_and)

This patch folds certain reductions of X & CST to X[I] & CST[I] if I is
the only nonzero element of CST.  This includes the motivating case in
which CST[I] is -1.

We could do the same for REDUC_MAX on unsigned types, but I wasn't sure
that that special case was worth it.

2019-01-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR tree-optimization/88598
	* tree.h (single_nonzero_element): Declare.
	* tree.c (single_nonzero_element): New function.
	* match.pd: Fold certain reductions of X & CST to X[I] & CST[I]
	if I is the only nonzero element of CST.

gcc/testsuite/
	PR tree-optimization/88598
	* gcc.dg/vect/pr88598-1.c: New test.
	* gcc.dg/vect/pr88598-2.c: Likewise.
	* gcc.dg/vect/pr88598-3.c: Likewise.
	* gcc.dg/vect/pr88598-4.c: Likewise.
	* gcc.dg/vect/pr88598-5.c: Likewise.
	* gcc.dg/vect/pr88598-6.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr88598-1.c
    trunk/gcc/testsuite/gcc.dg/vect/pr88598-2.c
    trunk/gcc/testsuite/gcc.dg/vect/pr88598-3.c
    trunk/gcc/testsuite/gcc.dg/vect/pr88598-4.c
    trunk/gcc/testsuite/gcc.dg/vect/pr88598-5.c
    trunk/gcc/testsuite/gcc.dg/vect/pr88598-6.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/match.pd
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree.c
    trunk/gcc/tree.h



More information about the Gcc-cvs mailing list