Commit 0b56e9ad by Bill Schmidt Committed by William Schmidt

re PR tree-optimization/71915 (A missed opportunity for SLSR)

[gcc]

2016-10-30  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/71915
	PR tree-optimization/71490
	* gimple-ssa-strength-reduction.c (struct slsr_cand_d): Add
	stride_type field.
	(find_basis_for_base_expr): Require stride types to match when
	seeking a basis.
	(alloc_cand_and_find_basis): Record the stride type.
	(slsr_process_phi): Pass stride type to alloc_cand_and_find_basis.
	(backtrace_base_for_ref): Pass types to legal_cast_p_1 rather than
	the expressions having those types.
	(slsr_process_ref): Pass stride type to alloc_cand_and_find_basis.
	(create_mul_ssa_cand): Likewise.
	(create_mul_imm_cand): Likewise.
	(create_add_ssa_cand): Likewise.
	(create_add_imm_cand): Likewise.
	(legal_cast_p_1): Change interface to accept types rather than the
	expressions having those types.
	(legal_cast_p): Pass types to legal_cast_p_1.
	(slsr_process_cast): Pass stride type to
	alloc_cand_and_find_basis.
	(slsr_process_copy): Likewise.
	(dump_candidate): Display stride type when a cast exists.
	(create_add_on_incoming_edge): Introduce a cast when necessary for
	the stride type.
	(analyze_increments): Change the code checking for invalid casts
	to rely on the stride type, and update the documentation and
	example.  Change the code checking for pointer multiplies to rely
	on the stride type.
	(insert_initializers): Introduce a cast when necessary for the
	stride type.  Use the stride type for the type of the initializer.

[gcc/testsuite]

2016-10-30  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/71915
	PR tree-optimization/71490
	* gcc.dg/tree-ssa/pr54245.c: Delete.
	* gcc.dg/tree-ssa/slsr-8.c: Adjust for new optimization and
	document why.

From-SVN: r241695
parent 8972aa33
2016-10-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/71915
PR tree-optimization/71490
* gimple-ssa-strength-reduction.c (struct slsr_cand_d): Add
stride_type field.
(find_basis_for_base_expr): Require stride types to match when
seeking a basis.
(alloc_cand_and_find_basis): Record the stride type.
(slsr_process_phi): Pass stride type to alloc_cand_and_find_basis.
(backtrace_base_for_ref): Pass types to legal_cast_p_1 rather than
the expressions having those types.
(slsr_process_ref): Pass stride type to alloc_cand_and_find_basis.
(create_mul_ssa_cand): Likewise.
(create_mul_imm_cand): Likewise.
(create_add_ssa_cand): Likewise.
(create_add_imm_cand): Likewise.
(legal_cast_p_1): Change interface to accept types rather than the
expressions having those types.
(legal_cast_p): Pass types to legal_cast_p_1.
(slsr_process_cast): Pass stride type to
alloc_cand_and_find_basis.
(slsr_process_copy): Likewise.
(dump_candidate): Display stride type when a cast exists.
(create_add_on_incoming_edge): Introduce a cast when necessary for
the stride type.
(analyze_increments): Change the code checking for invalid casts
to rely on the stride type, and update the documentation and
example. Change the code checking for pointer multiplies to rely
on the stride type.
(insert_initializers): Introduce a cast when necessary for the
stride type. Use the stride type for the type of the initializer.
2016-10-30 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> 2016-10-30 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* config/arm/arm.c (arm_const_not_ok_for_debug_p): Use VAR_P. * config/arm/arm.c (arm_const_not_ok_for_debug_p): Use VAR_P.
2016-10-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/71915
PR tree-optimization/71490
* gcc.dg/tree-ssa/pr54245.c: Delete.
* gcc.dg/tree-ssa/slsr-8.c: Adjust for new optimization and
document why.
2016-10-30 Jerry DeLisle <jvdelisle@gcc.gnu.org> 2016-10-30 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/78123 PR fortran/78123
......
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-slsr-details" } */
#include <stdio.h>
#define W1 22725
#define W2 21407
#define W3 19266
#define W6 8867
void idct_row(short *row, int *dst)
{
int a0, a1, b0, b1;
a0 = W1 * row[0];
a1 = a0;
a0 += W2 * row[2];
a1 += W6 * row[2];
b0 = W1 * row[1];
b1 = W3 * row[1];
dst[0] = a0 + b0;
dst[1] = a0 - b0;
dst[2] = a1 + b1;
dst[3] = a1 - b1;
}
static short block[8] = { 1, 2, 3, 4 };
int main(void)
{
int out[4];
int i;
idct_row(block, out);
for (i = 0; i < 4; i++)
printf("%d\n", out[i]);
return !(out[2] == 87858 && out[3] == 10794);
}
/* For now, disable inserting an initializer when the multiplication will
take place in a smaller type than originally. This test may be deleted
in future when this case is handled more precisely. */
/* { dg-final { scan-tree-dump-times "Inserting initializer" 0 "slsr" { target { ! int16 } } } } */
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
/* { dg-options "-O3 -fdump-tree-optimized" } */ /* { dg-options "-O3 -fdump-tree-optimized" } */
int* int*
f (int s, int *c) f (int s, int *c, int *d)
{ {
int a1, a2, a3, *x1, *x2, *x3; int a1, a2, a3, *x1, *x2, *x3;
...@@ -14,10 +14,15 @@ f (int s, int *c) ...@@ -14,10 +14,15 @@ f (int s, int *c)
x2 = c - a2; x2 = c - a2;
a3 = 6 * s; a3 = 6 * s;
x3 = c - a3; x3 = c - a3;
return x1 ? x2 : x3; return x1 == d ? x2 : x3;
} }
/* Note that since some branch prediction heuristics changed, the
calculations of x2 and x3 are pushed downward into the legs
of the conditional, changing the code presented to SLSR.
However, this proves to be a useful test for introducing an
initializer with a cast, so we'll keep it as is. */
/* There are 4 ' * ' instances in the decls (since "int * iftmp.0;" is /* There are 4 ' * ' instances in the decls (since "int * iftmp.0;" is
added), 1 parm, 2 in the code. The second one in the code can be added), 2 parms, 3 in the code. */
a widening mult. */ /* { dg-final { scan-tree-dump-times " \\* " 9 "optimized" } } */
/* { dg-final { scan-tree-dump-times " w?\\* " 7 "optimized" } } */
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