Commit e9d5a1a0 by Yuri Rumyantsev Committed by Ilya Enkovich

tree-if-conv.c: Include hash-map.h.

gcc/

	* tree-if-conv.c: Include hash-map.h.
	(aggressive_if_conv): New variable.
	(fold_build_cond_expr): Add simplification of non-zero condition.
	(add_to_dst_predicate_list): Invoke add_to_predicate_list if edge
	destination block is not always executed.
	(if_convertible_phi_p): Fix commentary, allow phi nodes have more
	than two predecessors if AGGRESSIVE_IF_CONV is true.
	(if_convertible_stmt_p): Fix commentary.
	(all_preds_critical_p): New function.
	(has_pred_critical_p): New function.
	(if_convertible_bb_p): Fix commentary, if AGGRESSIVE_IF_CONV is true
	BB can have more than two predecessors and all incoming edges can be
	critical.
	(predicate_bbs): Skip predication for loop exit block, use build2_loc
	to compute predicate for true edge.
	(find_phi_replacement_condition): Delete this function.
	(is_cond_scalar_reduction): Add arguments ARG_0, ARG_1 and EXTENDED.
	Allow interchange PHI arguments if EXTENDED is false.
	Change check that block containing reduction statement candidate
	is predecessor of phi-block since phi may have more than two arguments.
	(phi_args_hash_traits): New helper structure.
	(struct phi_args_hash_traits): New type.
	(phi_args_hash_traits::hash): New function.
	(phi_args_hash_traits::equal_keys): New function.
	(gen_phi_arg_condition): New function.
	(predicate_scalar_phi): Add handling of phi nodes with more than two
	arguments, delete COND and TRUE_BB arguments, insert body of
	find_phi_replacement_condition to predicate ordinary phi nodes.
	(predicate_all_scalar_phis): Skip blocks with the only predecessor,
	delete call of find_phi_replacement_condition and invoke
	predicate_scalar_phi with two arguments.
	(insert_gimplified_predicates): Add assert that non-predicated block
	don't have statements to insert.
	(ifcvt_split_critical_edges): New function.
	(ifcvt_split_def_stmt): Likewise.
	(ifcvt_walk_pattern_tree): Likewise.
	(stmt_is_root_of_bool_pattern): Likewise.
	(ifcvt_repair_bool_pattern): Likewise.
	(ifcvt_local_dce): Likewise.
	(tree_if_conversion): Add initialization of AGGRESSIVE_IF_CONV which
	is copy of inner or outer loop force_vectorize field, invoke
	ifcvt_split_critical_edges, ifcvt_local_dce and
	ifcvt_repair_bool_pattern for aggressive if-conversion.

gcc/testsuite/

	* gcc.dg/vect/vect-aggressive-1.c: New.
	* gcc.target/i386/avx2-vect-aggressive.c: New.

From-SVN: r219658
parent a0f06fc9
2015-01-15 Yuri Rumyantsev <ysrumyan@gmail.com>
* tree-if-conv.c: Include hash-map.h.
(aggressive_if_conv): New variable.
(fold_build_cond_expr): Add simplification of non-zero condition.
(add_to_dst_predicate_list): Invoke add_to_predicate_list if edge
destination block is not always executed.
(if_convertible_phi_p): Fix commentary, allow phi nodes have more
than two predecessors if AGGRESSIVE_IF_CONV is true.
(if_convertible_stmt_p): Fix commentary.
(all_preds_critical_p): New function.
(has_pred_critical_p): New function.
(if_convertible_bb_p): Fix commentary, if AGGRESSIVE_IF_CONV is true
BB can have more than two predecessors and all incoming edges can be
critical.
(predicate_bbs): Skip predication for loop exit block, use build2_loc
to compute predicate for true edge.
(find_phi_replacement_condition): Delete this function.
(is_cond_scalar_reduction): Add arguments ARG_0, ARG_1 and EXTENDED.
Allow interchange PHI arguments if EXTENDED is false.
Change check that block containing reduction statement candidate
is predecessor of phi-block since phi may have more than two arguments.
(phi_args_hash_traits): New helper structure.
(struct phi_args_hash_traits): New type.
(phi_args_hash_traits::hash): New function.
(phi_args_hash_traits::equal_keys): New function.
(gen_phi_arg_condition): New function.
(predicate_scalar_phi): Add handling of phi nodes with more than two
arguments, delete COND and TRUE_BB arguments, insert body of
find_phi_replacement_condition to predicate ordinary phi nodes.
(predicate_all_scalar_phis): Skip blocks with the only predecessor,
delete call of find_phi_replacement_condition and invoke
predicate_scalar_phi with two arguments.
(insert_gimplified_predicates): Add assert that non-predicated block
don't have statements to insert.
(ifcvt_split_critical_edges): New function.
(ifcvt_split_def_stmt): Likewise.
(ifcvt_walk_pattern_tree): Likewise.
(stmt_is_root_of_bool_pattern): Likewise.
(ifcvt_repair_bool_pattern): Likewise.
(ifcvt_local_dce): Likewise.
(tree_if_conversion): Add initialization of AGGRESSIVE_IF_CONV which
is copy of inner or outer loop force_vectorize field, invoke
ifcvt_split_critical_edges, ifcvt_local_dce and
ifcvt_repair_bool_pattern for aggressive if-conversion.
2015-01-15 Philipp Tomsich <ptomsich@theobroma-systems.com>
* config/aarch64/aarch64.md: Include xgene1.md.
......
2015-01-15 Yuri Rumyantsev <ysrumyan@gmail.com>
* gcc.dg/vect/vect-aggressive-1.c: New.
* gcc.target/i386/avx2-vect-aggressive.c: New.
2015-01-15 H.J. Lu <hongjiu.lu@intel.com>
* gcc.target/i386/pr54445-2.c: Adjust scan string for PIE.
......
/* { dg-do run } */
/* { dg-require-effective-target vect_condition } */
/* { dg-require-effective-target vect_simd_clones } */
/* { dg-additional-options "-fopenmp-simd" } */
#include <stdlib.h>
#include "tree-vect.h"
#define N 64
int a[N];
int c[N];
__attribute__ ((noinline)) int
foo (void)
{
int i, res = 0;
#pragma omp simd safelen(8)
for (i = 0; i < N; i++)
{
int t = a[i];
if (c[i] != 0)
if (t != 100 & t > 5)
res += 1;
}
return res;
}
__attribute__ ((noinline)) int
hundred (void)
{
return 100;
}
int main (void)
{
int i;
check_vect ();
for (i = 0; i < N; i++)
{
c[i] = i & 1;
switch (i & 3)
{
case 0:
a[i] = hundred ();
break;
case 1:
a[i] = 1;
break;
default:
a[i] = i + 6;
break;
}
}
if (foo () != 16)
abort ();
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
/* { dg-do run } */
/* { dg-require-effective-target avx2 } */
/* { dg-options "-mavx2 -O3 -fopenmp-simd -fdump-tree-vect-details" } */
#include "avx2-check.h"
#define N 64
float a[N];
int c[N];
__attribute__ ((noinline)) int
foo ()
{
int i, res = 0;
#pragma omp simd safelen(8)
for (i=0; i<N; i++)
{
float t = a[i];
if (t > 0.0f & t < 1.0e+2f)
if (c[i] != 0)
res += 1;
}
return res;
}
__attribute__ ((noinline)) float
hundred ()
{
return 100.0f;
}
static void
avx2_test (void)
{
int i, res;
for (i=0; i<N; i++)
{
c[i] = i % 4;
if (i < N / 2)
a[i] = (float) (i + 1);
else
a[i] = (float) i + hundred ();
}
if (foo () != 24)
abort ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment