Commit 53109ba8 by Kyrylo Tkachov Committed by Kyrylo Tkachov

[vectorizer][2/2] Hook up mult synthesis logic into vectorisation of mult-by-constant

	PR target/65951
	PR tree-optimization/70923
	* tree-vect-patterns.c: Include mult-synthesis.h.
	(target_supports_mult_synth_alg): New function.
	(synth_lshift_by_additions): Likewise.
	(apply_binop_and_append_stmt): Likewise.
	(vect_synth_mult_by_constant): Likewise.
	(target_has_vecop_for_code): Likewise.
	(vect_recog_mult_pattern): Use above functions to synthesize vector
	multiplication by integer constants.

	* gcc.dg/vect/vect-mult-const-pattern-1.c: New test.
	* gcc.dg/vect/vect-mult-const-pattern-2.c: Likewise.
	* gcc.dg/vect/pr65951.c: Likewise.
	* gcc.dg/vect/vect-iv-9.c: Remove ! vect_int_mult-specific scan.

From-SVN: r238340
parent 0c15a902
2016-07-14 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/65951
PR tree-optimization/70923
* tree-vect-patterns.c: Include mult-synthesis.h.
(target_supports_mult_synth_alg): New function.
(synth_lshift_by_additions): Likewise.
(apply_binop_and_append_stmt): Likewise.
(vect_synth_mult_by_constant): Likewise.
(target_has_vecop_for_code): Likewise.
(vect_recog_mult_pattern): Use above functions to synthesize vector
multiplication by integer constants.
2016-07-14 Alan Modra <amodra@gmail.com>
* gcc/config/rs6000/altivec.md (altivec_mov<mode>): Disparage
......
2016-07-14 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/65951
PR tree-optimization/70923
* gcc.dg/vect/vect-mult-const-pattern-1.c: New test.
* gcc.dg/vect/vect-mult-const-pattern-2.c: Likewise.
* gcc.dg/vect/pr65951.c: Likewise.
* gcc.dg/vect/vect-iv-9.c: Remove ! vect_int_mult-specific scan.
2016-07-14 David Edelsohn <dje.gcc@gmail.com>
* c-c++-common/pr60226.c: Expect maximum object file alignment
......
/* { dg-require-effective-target vect_int } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 512
/* These multiplications should be vectorizable with additions when
no vector shift is available. */
__attribute__ ((noinline)) void
foo (int *arr)
{
for (int i = 0; i < N; i++)
arr[i] *= 2;
}
__attribute__ ((noinline)) void
foo2 (int *arr)
{
for (int i = 0; i < N; i++)
arr[i] *= 4;
}
int
main (void)
{
check_vect ();
int data[N];
int i;
for (i = 0; i < N; i++)
{
data[i] = i;
__asm__ volatile ("");
}
foo (data);
for (i = 0; i < N; i++)
{
if (data[i] / 2 != i)
__builtin_abort ();
__asm__ volatile ("");
}
for (i = 0; i < N; i++)
{
data[i] = i;
__asm__ volatile ("");
}
foo2 (data);
for (i = 0; i < N; i++)
{
if (data[i] / 4 != i)
__builtin_abort ();
__asm__ volatile ("");
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
......@@ -33,5 +33,4 @@ int main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_int_mult } } } */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target {! vect_int_mult } } } } */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target vect_shift } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
__attribute__ ((noinline)) void
foo (long long *arr)
{
for (int i = 0; i < N; i++)
arr[i] *= 123;
}
int
main (void)
{
check_vect ();
long long data[N];
int i;
for (i = 0; i < N; i++)
{
data[i] = i;
__asm__ volatile ("");
}
foo (data);
for (i = 0; i < N; i++)
{
if (data[i] / 123 != i)
__builtin_abort ();
__asm__ volatile ("");
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vect_recog_mult_pattern: detected" 2 "vect" { target aarch64*-*-* } } } */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target aarch64*-*-* } } } */
/* { dg-require-effective-target vect_int } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
__attribute__ ((noinline)) void
foo (long long *arr)
{
for (int i = 0; i < N; i++)
arr[i] *= -19594LL;
}
int
main (void)
{
check_vect ();
long long data[N];
int i;
for (i = 0; i < N; i++)
{
data[i] = i;
__asm__ volatile ("");
}
foo (data);
for (i = 0; i < N; i++)
{
if (data[i] / -19594LL != i)
__builtin_abort ();
__asm__ volatile ("");
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vect_recog_mult_pattern: detected" 2 "vect" { target aarch64*-*-* } } } */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target aarch64*-*-* } } } */
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