Commit 53f3815c by Richard Guenther Committed by Richard Biener

re PR tree-optimization/35972 (load-PRE missed opportunities without SFTs)

2008-08-19  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/35972
	PR tree-optimization/23094
	* tree-ssa-sccvn.h (vn_reference_lookup_pieces): Add maywalk
	parameter.
	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Properly
	handle MISALIGNED_INDIRECT_REF.
	(get_ref_from_reference_ops): New helper.
	(vn_reference_lookup_pieces): Walk the use-def chain using the
	alias-oracle if requested.
	* tree-ssa-pre.c (phi_translate_1): Do reference lookup with
	walking the use-def chain.
	(compute_avail): But not here.
	(create_component_ref_by_pieces_1): Properly handle
	MISALIGNED_INDIRECT_REF.
	(do_regular_insertion): Handle fully redundant
	expressions after PHI-translation also for SSA_NAME values, not
	only constants.  Correctly use edoubleprime for that.

	* gcc.dg/tree-ssa/ssa-pre-19.c: New testcase.
	* gcc.dg/autopar/reduc-1.c: Move constant initialized arrays to
	global memory.
	* gcc.dg/autopar/reduc-1char.c: Likewise.
	* gcc.dg/autopar/reduc-1short.c: Likewise.
	* gcc.dg/autopar/reduc-2.c: Likewise.
	* gcc.dg/autopar/reduc-2char.c: Likewise.
	* gcc.dg/autopar/reduc-2short.c: Likewise.
	* gcc.dg/autopar/reduc-3.c: Likewise.
	* gcc.dg/tree-ssa/ifc-20040816-1.c: Likewise.
	* gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: Likewise.
	* gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c: Likewise.
	* gcc.dg/vect/fast-math-vect-reduc-5.c: Likewise.
	* gcc.dg/vect/fast-math-vect-reduc-7.c: Likewise.
	* gcc.dg/vect/no-trapping-math-2.c: Likewise.
	* gcc.dg/vect/no-trapping-math-vect-111.c: Likewise.
	* gcc.dg/vect/no-trapping-math-vect-ifcvt-11.c: Likewise.
	* gcc.dg/vect/no-trapping-math-vect-ifcvt-12.c: Likewise.
	* gcc.dg/vect/no-trapping-math-vect-ifcvt-13.c: Likewise.
	* gcc.dg/vect/no-trapping-math-vect-ifcvt-14.c: Likewise.
	* gcc.dg/vect/no-trapping-math-vect-ifcvt-15.c: Likewise.
	* gcc.dg/vect/no-vfa-vect-37.c: Likewise.
	* gcc.dg/vect/no-vfa-vect-depend-1.c: Likewise.
	* gcc.dg/vect/pr18400.c: Likewise.
	* gcc.dg/vect/slp-12b.c: Likewise.
	* gcc.dg/vect/slp-14.c: Likewise.
	* gcc.dg/vect/slp-7.c: Likewise.
	* gcc.dg/vect/slp-15.c: Likewise.
	* gcc.dg/vect/slp-16.c: Likewise.
	* gcc.dg/vect/slp-17.c: Likewise.
	* gcc.dg/vect/slp-24.c: Likewise.
	* gcc.dg/vect/slp-28.c: Likewise.
	* gcc.dg/vect/slp-3.c: Likewise.
	* gcc.dg/vect/slp-34.c: Likewise.
	* gcc.dg/vect/slp-6.c: Likewise.
	* gcc.dg/vect/slp-8.c: Likewise.
	* gcc.dg/vect/vect-107.c: Likewise.
	* gcc.dg/vect/vect-108.c: Likewise.
	* gcc.dg/vect/vect-11.c: Likewise.
	* gcc.dg/vect/vect-112.c: Likewise.
	* gcc.dg/vect/vect-115.c: Likewise.
	* gcc.dg/vect/vect-11a.c: Likewise.
	* gcc.dg/vect/vect-34.c: Likewise.
	* gcc.dg/vect/vect-9.c: Likewise.
	* gcc.dg/vect/vect-97.c: Likewise.
	* gcc.dg/vect/vect-align-1.c: Likewise.
	* gcc.dg/vect/vect-float-extend-1.c: Likewise.
	* gcc.dg/vect/vect-floatint-conversion-1.c: Likewise.
	* gcc.dg/vect/vect-ifcvt-16.c: Likewise.
	* gcc.dg/vect/vect-ifcvt-17.c: Likewise.
	* gcc.dg/vect/vect-ifcvt-2.c: Likewise.
	* gcc.dg/vect/vect-ifcvt-3.c: Likewise.
	* gcc.dg/vect/vect-ifcvt-4.c: Likewise.
	* gcc.dg/vect/vect-ifcvt-5.c: Likewise.
	* gcc.dg/vect/vect-ifcvt-6.c: Likewise.
	* gcc.dg/vect/vect-ifcvt-7.c: Likewise.
	* gcc.dg/vect/vect-intfloat-conversion-1.c: Likewise.
	* gcc.dg/vect/vect-intfloat-conversion-2.c: Likewise.
	* gcc.dg/vect/vect-intfloat-conversion-3.c: Likewise.
	* gcc.dg/vect/vect-intfloat-conversion-4a.c: Likewise.
	* gcc.dg/vect/vect-intfloat-conversion-4b.c: Likewise.
	* gcc.dg/vect/vect-multitypes-2.c: Likewise.
	* gcc.dg/vect/vect-multitypes-5.c: Likewise.
	* gcc.dg/vect/vect-reduc-1.c: Likewise.
	* gcc.dg/vect/vect-reduc-1char.c: Likewise.
	* gcc.dg/vect/vect-reduc-1short.c: Likewise.
	* gcc.dg/vect/vect-reduc-2.c: Likewise.
	* gcc.dg/vect/vect-reduc-3.c: Likewise.
	* gcc.dg/vect/vect-shift-1.c: Likewise.
	* gcc.dg/vect/vect-strided-float.c: Likewise.
	* gcc.dg/vect/vect-strided-store-u32-i2.c: Likewise.
	* gcc.dg/vect/wrapv-vect-reduc-2char.c: Likewise.
	* gcc.dg/vect/wrapv-vect-reduc-2short.c: Likewise.
	* gcc.dg/tree-ssa/gen-vect-11.c: Likewise.
	* gcc.dg/tree-ssa/gen-vect-11a.c: Likewise.
	* gcc.dg/tree-ssa/gen-vect-2.c: Likewise.
	* gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c: Likewise.

From-SVN: r139226
parent 5d593372
2008-08-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/35972
PR tree-optimization/23094
* tree-ssa-sccvn.h (vn_reference_lookup_pieces): Add maywalk
parameter.
* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Properly
handle MISALIGNED_INDIRECT_REF.
(get_ref_from_reference_ops): New helper.
(vn_reference_lookup_pieces): Walk the use-def chain using the
alias-oracle if requested.
* tree-ssa-pre.c (phi_translate_1): Do reference lookup with
walking the use-def chain.
(compute_avail): But not here.
(create_component_ref_by_pieces_1): Properly handle
MISALIGNED_INDIRECT_REF.
(do_regular_insertion): Handle fully redundant
expressions after PHI-translation also for SSA_NAME values, not
only constants. Correctly use edoubleprime for that.
2008-08-19 Ira Rosen <irar@il.ibm.com> 2008-08-19 Ira Rosen <irar@il.ibm.com>
* tree-vectorizer.c (supportable_widening_operation): Support * tree-vectorizer.c (supportable_widening_operation): Support
......
2008-08-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/35972
PR tree-optimization/23094
* gcc.dg/tree-ssa/ssa-pre-19.c: New testcase.
* gcc.dg/autopar/reduc-1.c: Move constant initialized arrays to
global memory.
* gcc.dg/autopar/reduc-1char.c: Likewise.
* gcc.dg/autopar/reduc-1short.c: Likewise.
* gcc.dg/autopar/reduc-2.c: Likewise.
* gcc.dg/autopar/reduc-2char.c: Likewise.
* gcc.dg/autopar/reduc-2short.c: Likewise.
* gcc.dg/autopar/reduc-3.c: Likewise.
* gcc.dg/tree-ssa/ifc-20040816-1.c: Likewise.
* gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: Likewise.
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c: Likewise.
* gcc.dg/vect/fast-math-vect-reduc-5.c: Likewise.
* gcc.dg/vect/fast-math-vect-reduc-7.c: Likewise.
* gcc.dg/vect/no-trapping-math-2.c: Likewise.
* gcc.dg/vect/no-trapping-math-vect-111.c: Likewise.
* gcc.dg/vect/no-trapping-math-vect-ifcvt-11.c: Likewise.
* gcc.dg/vect/no-trapping-math-vect-ifcvt-12.c: Likewise.
* gcc.dg/vect/no-trapping-math-vect-ifcvt-13.c: Likewise.
* gcc.dg/vect/no-trapping-math-vect-ifcvt-14.c: Likewise.
* gcc.dg/vect/no-trapping-math-vect-ifcvt-15.c: Likewise.
* gcc.dg/vect/no-vfa-vect-37.c: Likewise.
* gcc.dg/vect/no-vfa-vect-depend-1.c: Likewise.
* gcc.dg/vect/pr18400.c: Likewise.
* gcc.dg/vect/slp-12b.c: Likewise.
* gcc.dg/vect/slp-14.c: Likewise.
* gcc.dg/vect/slp-7.c: Likewise.
* gcc.dg/vect/slp-15.c: Likewise.
* gcc.dg/vect/slp-16.c: Likewise.
* gcc.dg/vect/slp-17.c: Likewise.
* gcc.dg/vect/slp-24.c: Likewise.
* gcc.dg/vect/slp-28.c: Likewise.
* gcc.dg/vect/slp-3.c: Likewise.
* gcc.dg/vect/slp-34.c: Likewise.
* gcc.dg/vect/slp-6.c: Likewise.
* gcc.dg/vect/slp-8.c: Likewise.
* gcc.dg/vect/vect-107.c: Likewise.
* gcc.dg/vect/vect-108.c: Likewise.
* gcc.dg/vect/vect-11.c: Likewise.
* gcc.dg/vect/vect-112.c: Likewise.
* gcc.dg/vect/vect-115.c: Likewise.
* gcc.dg/vect/vect-11a.c: Likewise.
* gcc.dg/vect/vect-34.c: Likewise.
* gcc.dg/vect/vect-9.c: Likewise.
* gcc.dg/vect/vect-97.c: Likewise.
* gcc.dg/vect/vect-align-1.c: Likewise.
* gcc.dg/vect/vect-float-extend-1.c: Likewise.
* gcc.dg/vect/vect-floatint-conversion-1.c: Likewise.
* gcc.dg/vect/vect-ifcvt-16.c: Likewise.
* gcc.dg/vect/vect-ifcvt-17.c: Likewise.
* gcc.dg/vect/vect-ifcvt-2.c: Likewise.
* gcc.dg/vect/vect-ifcvt-3.c: Likewise.
* gcc.dg/vect/vect-ifcvt-4.c: Likewise.
* gcc.dg/vect/vect-ifcvt-5.c: Likewise.
* gcc.dg/vect/vect-ifcvt-6.c: Likewise.
* gcc.dg/vect/vect-ifcvt-7.c: Likewise.
* gcc.dg/vect/vect-intfloat-conversion-1.c: Likewise.
* gcc.dg/vect/vect-intfloat-conversion-2.c: Likewise.
* gcc.dg/vect/vect-intfloat-conversion-3.c: Likewise.
* gcc.dg/vect/vect-intfloat-conversion-4a.c: Likewise.
* gcc.dg/vect/vect-intfloat-conversion-4b.c: Likewise.
* gcc.dg/vect/vect-multitypes-2.c: Likewise.
* gcc.dg/vect/vect-multitypes-5.c: Likewise.
* gcc.dg/vect/vect-reduc-1.c: Likewise.
* gcc.dg/vect/vect-reduc-1char.c: Likewise.
* gcc.dg/vect/vect-reduc-1short.c: Likewise.
* gcc.dg/vect/vect-reduc-2.c: Likewise.
* gcc.dg/vect/vect-reduc-3.c: Likewise.
* gcc.dg/vect/vect-shift-1.c: Likewise.
* gcc.dg/vect/vect-strided-float.c: Likewise.
* gcc.dg/vect/vect-strided-store-u32-i2.c: Likewise.
* gcc.dg/vect/wrapv-vect-reduc-2char.c: Likewise.
* gcc.dg/vect/wrapv-vect-reduc-2short.c: Likewise.
* gcc.dg/tree-ssa/gen-vect-11.c: Likewise.
* gcc.dg/tree-ssa/gen-vect-11a.c: Likewise.
* gcc.dg/tree-ssa/gen-vect-2.c: Likewise.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c: Likewise.
2008-08-19 Ira Rosen <irar@il.ibm.com> 2008-08-19 Ira Rosen <irar@il.ibm.com>
* gcc.dg/vect/slp-multitypes-1.c: New testcase. * gcc.dg/vect/slp-multitypes-1.c: New testcase.
......
...@@ -7,13 +7,14 @@ ...@@ -7,13 +7,14 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
/* Reduction of unsigned-int. */ /* Reduction of unsigned-int. */
void main1 (unsigned int x, unsigned int max_result, unsigned int min_result) void main1 (unsigned int x, unsigned int max_result, unsigned int min_result)
{ {
int i; int i;
unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned int udiff = 2; unsigned int udiff = 2;
unsigned int umax = x; unsigned int umax = x;
unsigned int umin = x; unsigned int umin = x;
......
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) void __attribute__ ((noinline)) void
main1 (unsigned char x, unsigned char max_result, unsigned char min_result) main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
{ {
int i; int i;
unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned char udiff = 2; unsigned char udiff = 2;
unsigned char umax = x; unsigned char umax = x;
unsigned char umin = x; unsigned char umin = x;
......
...@@ -7,13 +7,14 @@ ...@@ -7,13 +7,14 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
unsigned short ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned short uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) void __attribute__ ((noinline)) void
main1 (unsigned short x, unsigned short max_result, unsigned short min_result) main1 (unsigned short x, unsigned short max_result, unsigned short min_result)
{ {
int i; int i;
unsigned short ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; unsigned short udiff = 2;
unsigned short uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned short udiff = 2;
unsigned short umax = x; unsigned short umax = x;
unsigned short umin = x; unsigned short umin = x;
......
...@@ -7,14 +7,15 @@ ...@@ -7,14 +7,15 @@
#define N 16 #define N 16
#define DIFF 240 #define DIFF 240
int b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
/* Reduction of signed-int. */ /* Reduction of signed-int. */
__attribute__ ((noinline)) __attribute__ ((noinline))
void main1 (int x, int max_result, int min_result) void main1 (int x, int max_result, int min_result)
{ {
int i; int i;
int b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int diff = 0; int diff = 0;
int max = x; int max = x;
int min = x; int min = x;
......
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
#define N 16 #define N 16
#define DIFF 121 #define DIFF 121
signed char b[N] = {1,2,3,6,8,10,12,14,16,18,20,22,24,26,28,30};
signed char c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) __attribute__ ((noinline))
void main1 (signed char x, signed char max_result, signed char min_result) void main1 (signed char x, signed char max_result, signed char min_result)
{ {
int i; int i;
signed char b[N] = {1,2,3,6,8,10,12,14,16,18,20,22,24,26,28,30};
signed char c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
signed char diff = 2; signed char diff = 2;
signed char max = x; signed char max = x;
signed char min = x; signed char min = x;
......
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
short b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) __attribute__ ((noinline))
void main1 (short x, short max_result, short min_result) void main1 (short x, short max_result, short min_result)
{ {
int i; int i;
short b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
short diff = 2; short diff = 2;
short max = x; short max = x;
short min = x; short min = x;
......
...@@ -6,14 +6,15 @@ ...@@ -6,14 +6,15 @@
#define N 16 #define N 16
unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
/* Reduction of unsigned-int. */ /* Reduction of unsigned-int. */
__attribute__ ((noinline)) __attribute__ ((noinline))
int main1 (int n, int res) int main1 (int n, int res)
{ {
int i; int i;
unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned int udiff; unsigned int udiff;
udiff = 0; udiff = 0;
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
#define N 16 #define N 16
char ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int main () int main ()
{ {
int i; int i;
char ia[N]; char ia[N];
char ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
{ {
......
...@@ -14,12 +14,13 @@ typedef short half_word; ...@@ -14,12 +14,13 @@ typedef short half_word;
typedef int half_word; typedef int half_word;
#endif #endif
half_word ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
half_word ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int main () int main ()
{ {
int i; int i;
half_word ia[N]; half_word ia[N];
half_word ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
half_word ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
{ {
......
...@@ -14,9 +14,10 @@ typedef short half_word; ...@@ -14,9 +14,10 @@ typedef short half_word;
typedef int half_word; typedef int half_word;
#endif #endif
half_word cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int main () int main ()
{ {
half_word cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
half_word ca[N]; half_word ca[N];
int i; int i;
......
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
extern void abort(void); extern void abort(void);
int main1 () int main1 ()
{ {
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
int i, j; int i, j;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-pre-stats" } */
struct Loc {
int x[3];
};
void bar (struct Loc *);
int foo (int i, int j, int k, int b)
{
struct Loc IND;
int res;
if (b)
{
IND.x[0] = i;
IND.x[1] = j;
IND.x[2] = k-1;
}
else
{
IND.x[0] = i;
IND.x[1] = j;
IND.x[2] = k;
}
/* This should be optimized to i + j + {k, k + 1}. */
res = IND.x[0] + IND.x[1] + IND.x[2];
/* This is just to prevent SRA. */
bar (&IND);
return res;
}
/* All three loads should be eliminated. */
/* { dg-final { scan-tree-dump "Eliminated: 3" "pre" } } */
/* { dg-final { cleanup-tree-dump "pre" } } */
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
void void
main1 (unsigned char x, unsigned char max_result, unsigned char min_result) main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
{ {
int i; int i;
unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned char udiff = 2; unsigned char udiff = 2;
unsigned char umax = x; unsigned char umax = x;
unsigned char umin = x; unsigned char umin = x;
......
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
more involved than just an ssa_name. */ more involved than just an ssa_name. */
int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
int main1 (int *pib) int main1 (int *pib)
{ {
int i; int i;
int ia[N+OFF]; int ia[N+OFF];
int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
for (i = OFF; i < N; i++) for (i = OFF; i < N; i++)
{ {
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
void void
main1 (unsigned char x, unsigned char max_result, unsigned char min_result) main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
{ {
int i; int i;
unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned char udiff = 2; unsigned char udiff = 2;
unsigned char umax = x; unsigned char umax = x;
unsigned char umin = x; unsigned char umin = x;
......
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int main1 (float x, float max_result) int main1 (float x, float max_result)
{ {
int i; int i;
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
float diff = 2; float diff = 2;
float max = x; float max = x;
float min = 10; float min = 10;
......
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
double b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
double c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int main1 (double x, double max_result) int main1 (double x, double max_result)
{ {
int i; int i;
double b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
double c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
double diff = 2; double diff = 2;
double max = x; double max = x;
double min = 10; double min = 10;
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
#define N 16 #define N 16
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (void) main1 (void)
{ {
int i; int i;
float a[N]; float a[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Condition in loop. */ /* Condition in loop. */
/* This loop is vectorized on platforms that support vect_condition. */ /* This loop is vectorized on platforms that support vect_condition. */
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
#define N 16 #define N 16
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (void) main1 (void)
{ {
int i; int i;
float a[N]; float a[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Condition in loop. */ /* Condition in loop. */
/* This loop is vectorized on platforms that support vect_condition. */ /* This loop is vectorized on platforms that support vect_condition. */
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
float B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
float B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
float B[N] = {0,0,0,42,42,0,0,0,0,0,42,42,42,42,42,0};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
float B[N] = {0,0,0,42,42,0,0,0,0,0,42,42,42,42,42,0};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
float B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
float B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
float B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
float B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
float B[N] = {42,42,0,0,0,42,42,42,42,42,0,0,0,0,0,42};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
float B[N] = {42,42,0,0,0,42,42,42,42,42,0,0,0,0,0,42};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#define N 16 #define N 16
char x[N] __attribute__ ((__aligned__(16))); char x[N] __attribute__ ((__aligned__(16)));
char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline)) __attribute__ ((noinline))
int main1 (char *y) int main1 (char *y)
...@@ -13,7 +14,6 @@ int main1 (char *y) ...@@ -13,7 +14,6 @@ int main1 (char *y)
char *p; char *p;
char *q; char *q;
} s; } s;
char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int i; int i;
/* Not vectorized - can't antialias the pointer s.p from the array cb. */ /* Not vectorized - can't antialias the pointer s.p from the array cb. */
......
...@@ -5,13 +5,14 @@ ...@@ -5,13 +5,14 @@
#define N 17 #define N 17
int ia[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48};
int res[N] = {12,24,36,48,60,72,84,96,108,120,132,144,156,168,180,192,48};
__attribute__ ((noinline)) __attribute__ ((noinline))
int main1 () int main1 ()
{ {
int i; int i;
int ia[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48};
int res[N] = {12,24,36,48,60,72,84,96,108,120,132,144,156,168,180,192,48};
/* Not vectorizable due to data dependence: dependence distance 1. */ /* Not vectorizable due to data dependence: dependence distance 1. */
for (i = 0; i < N - 1; i++) for (i = 0; i < N - 1; i++)
......
...@@ -4,11 +4,12 @@ ...@@ -4,11 +4,12 @@
#include "tree-vect.h" #include "tree-vect.h"
#define N 8 #define N 8
int b[N] = {0,3,6,9,12,15,18,21};
int a[N];
int main1 () int main1 ()
{ {
int b[N] = {0,3,6,9,12,15,18,21};
int a[N];
int i; int i;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
#define N 64 #define N 64
unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
int int
main1 () main1 ()
{ {
int i; int i;
unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
float out2[N*8], fa[N*4]; float out2[N*8], fa[N*4];
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
#define N 8 #define N 8
unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
int int
main1 (int n) main1 (int n)
{ {
int i; int i;
unsigned int out[N*8], a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7; unsigned int out[N*8], a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7;
unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short out2[N*16]; unsigned short out2[N*16];
/* Multiple types are now SLPable. */ /* Multiple types are now SLPable. */
......
...@@ -6,14 +6,16 @@ ...@@ -6,14 +6,16 @@
#define N 8 #define N 8
unsigned int out[N*8], a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7;
unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int out2[N*16];
int int
main1 (int n) main1 (int n)
{ {
int i; int i;
unsigned int out[N*8], a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7; unsigned int a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7;
unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int out2[N*16];
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
......
...@@ -6,14 +6,16 @@ ...@@ -6,14 +6,16 @@
#define N 8 #define N 8
unsigned int out[N*8];
unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int out2[N*16];
int int
main1 () main1 ()
{ {
int i; int i;
unsigned int out[N*8], a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7; unsigned int a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7;
unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int out2[N*16];
/* SLP group of size that is not a multiple of vector size. /* SLP group of size that is not a multiple of vector size.
Unrolling by 2. */ Unrolling by 2. */
......
...@@ -6,14 +6,15 @@ ...@@ -6,14 +6,15 @@
#define N 8 #define N 8
unsigned short out[N*8];
unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short out2[N*8];
int int
main1 () main1 ()
{ {
int i; int i;
unsigned short out[N*8];
unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short out2[N*8];
for (i = 0; i < N*2; i++) for (i = 0; i < N*2; i++)
{ {
......
...@@ -14,12 +14,13 @@ typedef struct { ...@@ -14,12 +14,13 @@ typedef struct {
unsigned char d; unsigned char d;
} s; } s;
unsigned char ub[N*2] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
void void
main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *arr) main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *arr)
{ {
int i; int i;
unsigned char ub[N*2] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned char udiff = 2; unsigned char udiff = 2;
unsigned char umax = x; unsigned char umax = x;
unsigned char umin = x; unsigned char umin = x;
......
...@@ -6,15 +6,16 @@ ...@@ -6,15 +6,16 @@
#define N 32 #define N 32
unsigned short in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
unsigned short in2[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
unsigned short in3[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
unsigned short check[N] = {0,1,2,3,5,6,7,8,10,11,12,13,15,16,17,18,20,21,22,23,25,26,27,28,30,31,32,33,35,36,37,38};
unsigned short check3[N] = {0,1,2,3,4,5,6,7,8,9,10,11,5,6,7,8,9,10,11,12,13,14,15,16,10,11,12,13,14,15,16,17};
int int
main1 () main1 ()
{ {
int i; int i;
unsigned short in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
unsigned short in2[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
unsigned short in3[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
unsigned short check[N] = {0,1,2,3,5,6,7,8,10,11,12,13,15,16,17,18,20,21,22,23,25,26,27,28,30,31,32,33,35,36,37,38};
unsigned short check3[N] = {0,1,2,3,4,5,6,7,8,9,10,11,5,6,7,8,9,10,11,12,13,14,15,16,10,11,12,13,14,15,16,17};
for (i = 0; i < N/4; i++) for (i = 0; i < N/4; i++)
{ {
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
#define N 8 #define N 8
unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
int int
main1 () main1 ()
{ {
int i; int i;
unsigned short out[N*8]; unsigned short out[N*8];
unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
{ {
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
#define N 8 #define N 8
unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
int int
main1 () main1 ()
{ {
int i; int i;
unsigned short out[N*8]; unsigned short out[N*8];
unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short out2[N*8]; unsigned short out2[N*8];
/* SLP with unrolling by 8. */ /* SLP with unrolling by 8. */
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
#define N 8 #define N 8
unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
int int
main1 () main1 ()
{ {
int i; int i;
unsigned short out[N*8]; unsigned short out[N*8];
unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int out2[N*8]; unsigned int out2[N*8];
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
#define N 8 #define N 8
unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
int int
main1 () main1 ()
{ {
int i; int i;
unsigned int out[N*8], ia[N*2]; unsigned int out[N*8], ia[N*2];
unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned short sa[N], out2[N*16]; unsigned short sa[N], out2[N*16];
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
#define N 32 #define N 32
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int main1 () int main1 ()
{ {
int i; int i;
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float fa[N]; float fa[N];
/* int -> float */ /* int -> float */
......
...@@ -5,14 +5,15 @@ ...@@ -5,14 +5,15 @@
#define N 16 #define N 16
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (void) main1 (void)
{ {
int i; int i;
float a[N]; float a[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
/* Strided access. Vectorizable on platforms that support load of strided /* Strided access. Vectorizable on platforms that support load of strided
accesses (extract of even/odd vector elements). */ accesses (extract of even/odd vector elements). */
......
...@@ -5,13 +5,14 @@ ...@@ -5,13 +5,14 @@
#define N 16 #define N 16
int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ia[N];
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (void) main1 (void)
{ {
int i; int i;
int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ia[N];
/* This loop is vectorized on platforms that support vect_int_mult. */ /* This loop is vectorized on platforms that support vect_int_mult. */
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
#define N 16 #define N 16
int ia[N];
int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline)) __attribute__ ((noinline))
int main1 () int main1 ()
{ {
int i; int i;
int ia[N];
int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Not vectorizable yet (integer mult). */ /* Not vectorizable yet (integer mult). */
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -5,13 +5,14 @@ ...@@ -5,13 +5,14 @@
#define N 16 #define N 16
char cb[N] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
char cc[N] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (void) main1 (void)
{ {
int i; int i;
int diff = 0; int diff = 0;
char cb[N] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
char cc[N] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
/* Cross-iteration cycle. */ /* Cross-iteration cycle. */
diff = 0; diff = 0;
......
...@@ -23,12 +23,13 @@ struct test1{ ...@@ -23,12 +23,13 @@ struct test1{
int l; int l;
}; };
int a[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) __attribute__ ((noinline))
int main1 () int main1 ()
{ {
int i; int i;
struct test1 tmp1; struct test1 tmp1;
int a[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
struct t tmp2; struct t tmp2;
tmp1.ptr_t = &tmp2; tmp1.ptr_t = &tmp2;
......
...@@ -6,16 +6,17 @@ ...@@ -6,16 +6,17 @@
extern void abort (void); extern void abort (void);
unsigned int A[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001,
0x08000000,0xffffffff,0xff0000ff,0xf0000001};
unsigned int B[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001,
0x08000000,0x08000001,0xff0000ff,0xf0000001};
unsigned int Answer[8] = {0,0xf7ffffff,0x0200fe01,0xe0000001,
0,0xf7ffffff,0x0200fe01,0xe0000001};
unsigned int C[8];
__attribute__ ((noinline)) __attribute__ ((noinline))
void u () void u ()
{ {
unsigned int A[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001,
0x08000000,0xffffffff,0xff0000ff,0xf0000001};
unsigned int B[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001,
0x08000000,0x08000001,0xff0000ff,0xf0000001};
unsigned int Answer[8] = {0,0xf7ffffff,0x0200fe01,0xe0000001,
0,0xf7ffffff,0x0200fe01,0xe0000001};
unsigned int C[8];
int i, j; int i, j;
for (i=0; i<8; i++) for (i=0; i<8; i++)
...@@ -25,22 +26,23 @@ void u () ...@@ -25,22 +26,23 @@ void u ()
abort (); abort ();
} }
signed int D[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001,
0x08000000,0xffffffff,0xff0000ff,0xf0000001};
signed int E[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001,
0x08000000,0x08000001,0xff0000ff,0xf0000001};
signed int Dnswer[8] = {0,0xf7ffffff,0x0200fe01, 0xe0000001,
0,0xf7ffffff,0x0200fe01, 0xe0000001};
signed int F[8];
__attribute__ ((noinline)) __attribute__ ((noinline))
void s() void s()
{ {
signed int A[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001,
0x08000000,0xffffffff,0xff0000ff,0xf0000001};
signed int B[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001,
0x08000000,0x08000001,0xff0000ff,0xf0000001};
signed int Answer[8] = {0,0xf7ffffff,0x0200fe01, 0xe0000001,
0,0xf7ffffff,0x0200fe01, 0xe0000001};
signed int C[8];
int i, j; int i, j;
for (i=0; i<8; i++) for (i=0; i<8; i++)
C[i] = A[i] * B[i]; F[i] = D[i] * E[i];
for (i=0; i<8; i++) for (i=0; i<8; i++)
if (C[i] != Answer[i]) if (F[i] != Dnswer[i])
abort (); abort ();
} }
......
...@@ -4,15 +4,16 @@ ...@@ -4,15 +4,16 @@
#include "tree-vect.h" #include "tree-vect.h"
#define N 16 #define N 16
struct {
char ca[N];
} s;
char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline)) __attribute__ ((noinline))
int main1 () int main1 ()
{ {
int i; int i;
struct {
char ca[N];
} s;
char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
{ {
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
#define N 16 #define N 16
short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ia[N];
__attribute__ ((noinline)) __attribute__ ((noinline))
int main1 () int main1 ()
{ {
int i; int i;
short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ia[N];
/* Requires type promotion (vector unpacking) support. */ /* Requires type promotion (vector unpacking) support. */
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#define N 16 #define N 16
char x[N] __attribute__ ((__aligned__(16)));
char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline)) __attribute__ ((noinline))
int main1 () int main1 ()
{ {
...@@ -13,8 +16,6 @@ int main1 () ...@@ -13,8 +16,6 @@ int main1 ()
char *q; char *q;
} s; } s;
int i; int i;
char x[N] __attribute__ ((__aligned__(16)));
char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Check that datarefs analysis can determine that the access via pointer /* Check that datarefs analysis can determine that the access via pointer
s.p is based off array x, which enables us to antialias this access from s.p is based off array x, which enables us to antialias this access from
......
...@@ -14,11 +14,12 @@ struct foo { ...@@ -14,11 +14,12 @@ struct foo {
int y[N]; int y[N];
} __attribute__((packed)); } __attribute__((packed));
int x[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (struct foo * __restrict__ p) main1 (struct foo * __restrict__ p)
{ {
int i; int i;
int x[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
{ {
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
#define N 32 #define N 32
float fb[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5};
double da[N];
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
int i; int i;
float fb[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5};
double da[N];
/* float -> double */ /* float -> double */
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
#define N 32 #define N 32
float fb[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5};
int ia[N];
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
int i; int i;
float fb[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5};
int ia[N];
/* float -> int */ /* float -> int */
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -10,10 +10,11 @@ ...@@ -10,10 +10,11 @@
extern void abort(void); extern void abort(void);
float A[N] = {36,39,42,45,43,32,21,42,23,34,45,56,67,42,89,11};
float B[N] = {42,42,0,42,42,42,42,0,42,42,42,42,42,0,42,42};
int main () int main ()
{ {
float A[N] = {36,39,42,45,43,32,21,42,23,34,45,56,67,42,89,11};
float B[N] = {42,42,0,42,42,42,42,0,42,42,42,42,42,0,42,42};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,42,78,89,11};
float B[N] = {42,42,0,42,42,42,42,42,42,42,42,42,0,42,42,42};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,42,78,89,11};
float B[N] = {42,42,0,42,42,42,42,42,42,42,42,42,0,42,42,42};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
int B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
int B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
int B[N] = {0,0,0,42,42,0,0,0,0,0,42,42,42,42,42,0};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
int B[N] = {0,0,0,42,42,0,0,0,0,0,42,42,42,42,42,0};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
int B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
int B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
int B[N] = {42,42,0,0,0,42,42,42,42,42,0,0,0,0,0,42};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
int B[N] = {42,42,0,0,0,42,42,42,42,42,0,0,0,0,0,42};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
int A[N] = {36,39,42,45,43,32,21,42,23,34,45,56,67,42,89,11};
int B[N] = {42,42,0,42,42,42,42,0,42,42,42,42,42,0,42,42};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
int A[N] = {36,39,42,45,43,32,21,42,23,34,45,56,67,42,89,11};
int B[N] = {42,42,0,42,42,42,42,0,42,42,42,42,42,0,42,42};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#define N 16 #define N 16
#define MAX 42 #define MAX 42
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,42,78,89,11};
int B[N] = {42,42,0,42,42,42,42,42,42,42,42,42,0,42,42,42};
extern void abort(void); extern void abort(void);
int main () int main ()
{ {
int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,42,78,89,11};
int B[N] = {42,42,0,42,42,42,42,42,42,42,42,42,0,42,42,42};
int i, j; int i, j;
check_vect (); check_vect ();
......
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
#define N 32 #define N 32
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float fa[N];
__attribute__ ((noinline)) int main1 () __attribute__ ((noinline)) int main1 ()
{ {
int i; int i;
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float fa[N];
/* int -> float */ /* int -> float */
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
#define N 32 #define N 32
int int_arr[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float float_arr[N];
char char_arr[N];
__attribute__ ((noinline)) int main1 () __attribute__ ((noinline)) int main1 ()
{ {
int i; int i;
int int_arr[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float float_arr[N];
char char_arr[N];
for (i = 0; i < N; i++){ for (i = 0; i < N; i++){
float_arr[i] = (float) int_arr[i]; float_arr[i] = (float) int_arr[i];
......
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
#define N 32 #define N 32
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
double da[N];
__attribute__ ((noinline)) int main1 () __attribute__ ((noinline)) int main1 ()
{ {
int i; int i;
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
double da[N];
/* int -> double */ /* int -> double */
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
#define N 32 #define N 32
short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,-3,-6,-9,-12,-15,-18,-21,-24,-27,-30,-33,-36,-39,-42,-45};
float fa[N];
__attribute__ ((noinline)) int main1 () __attribute__ ((noinline)) int main1 ()
{ {
int i; int i;
short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,-3,-6,-9,-12,-15,-18,-21,-24,-27,-30,-33,-36,-39,-42,-45};
float fa[N];
/* short -> float */ /* short -> float */
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
#define N 32 #define N 32
unsigned short usb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,65533,65530,65527,65524,65521,65518,65515,65512,65509,65506,65503,65500,65497,65494,65491};
float fa[N];
__attribute__ ((noinline)) int main1 () __attribute__ ((noinline)) int main1 ()
{ {
int i; int i;
unsigned short usb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,65533,65530,65527,65524,65521,65518,65515,65512,65509,65506,65503,65500,65497,65494,65491};
float fa[N];
/* unsigned short -> float */ /* unsigned short -> float */
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -5,15 +5,16 @@ ...@@ -5,15 +5,16 @@
#define N 32 #define N 32
int ia[N];
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short sa[N];
short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ca[N];
char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline)) int main1 () __attribute__ ((noinline)) int main1 ()
{ {
int i; int i;
int ia[N];
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short sa[N];
short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ca[N];
char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Multiple types with different sizes, used in independent /* Multiple types with different sizes, used in independent
cmputations. Vectorizable. All accesses aligned. */ cmputations. Vectorizable. All accesses aligned. */
......
...@@ -5,19 +5,20 @@ ...@@ -5,19 +5,20 @@
#define N 32 #define N 32
unsigned int ia[N];
unsigned int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned short sa[N];
unsigned short sc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char ca[N];
unsigned char cc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline)) __attribute__ ((noinline))
int main1 () int main1 ()
{ {
int i; int i;
unsigned int ia[N];
unsigned int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned short sa[N];
unsigned short sc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char ca[N];
unsigned char cc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Multiple types with different sizes, used in independent /* Multiple types with different sizes, used in independent
computations. Vectorizable. All accesses aligned. */ computations. Vectorizable. All accesses aligned. */
......
...@@ -6,14 +6,15 @@ ...@@ -6,14 +6,15 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
/* Test vectorization of reduction of unsigned-int. */ /* Test vectorization of reduction of unsigned-int. */
__attribute__ ((noinline)) __attribute__ ((noinline))
void main1 (unsigned int x, unsigned int max_result, unsigned int min_result) void main1 (unsigned int x, unsigned int max_result, unsigned int min_result)
{ {
int i; int i;
unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned int udiff = 2; unsigned int udiff = 2;
unsigned int umax = x; unsigned int umax = x;
unsigned int umin = x; unsigned int umin = x;
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) void __attribute__ ((noinline)) void
main1 (unsigned char x, unsigned char max_result, unsigned char min_result) main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
{ {
int i; int i;
unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned char udiff = 2; unsigned char udiff = 2;
unsigned char umax = x; unsigned char umax = x;
unsigned char umin = x; unsigned char umin = x;
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
unsigned short ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned short uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) void __attribute__ ((noinline)) void
main1 (unsigned short x, unsigned short max_result, unsigned short min_result) main1 (unsigned short x, unsigned short max_result, unsigned short min_result)
{ {
int i; int i;
unsigned short ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned short uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned short udiff = 2; unsigned short udiff = 2;
unsigned short umax = x; unsigned short umax = x;
unsigned short umin = x; unsigned short umin = x;
......
...@@ -6,14 +6,15 @@ ...@@ -6,14 +6,15 @@
#define N 16 #define N 16
#define DIFF 240 #define DIFF 240
int b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
/* Test vectorization of reduction of signed-int. */ /* Test vectorization of reduction of signed-int. */
__attribute__ ((noinline)) __attribute__ ((noinline))
void main1 (int x, int max_result, int min_result) void main1 (int x, int max_result, int min_result)
{ {
int i; int i;
int b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int diff = 0; int diff = 0;
int max = x; int max = x;
int min = x; int min = x;
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#define N 16 #define N 16
unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
/* Test vectorization of reduction of unsigned-int in the presence /* Test vectorization of reduction of unsigned-int in the presence
of unknown-loop-bound. */ of unknown-loop-bound. */
...@@ -12,8 +15,6 @@ __attribute__ ((noinline)) ...@@ -12,8 +15,6 @@ __attribute__ ((noinline))
int main1 (int n, int res) int main1 (int n, int res)
{ {
int i; int i;
unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned int udiff; unsigned int udiff;
udiff = 0; udiff = 0;
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
#define N 8 #define N 8
unsigned int A[N] = { 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001,
0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001 };
unsigned int B[N] = { 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000,
0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000 };
int main () int main ()
{ {
unsigned int A[N] = { 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001,
0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001 };
unsigned int B[N] = { 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000,
0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000 };
int i; int i;
check_vect (); check_vect ();
......
...@@ -5,13 +5,14 @@ ...@@ -5,13 +5,14 @@
#define N 16 #define N 16
float b[N*2] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93};
float c[N*2] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (void) main1 (void)
{ {
int i; int i;
float a[N*2]; float a[N*2];
float b[N*2] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93};
float c[N*2] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
/* Strided access pattern. */ /* Strided access pattern. */
for (i = 0; i < N/2; i++) for (i = 0; i < N/2; i++)
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
#define N 16 #define N 16
int a[N*2];
int b[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
int c[N] = {1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31};
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (void) main1 (void)
{ {
int i; int i;
int a[N*2];
int b[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
int c[N] = {1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31};
/* Strided access pattern. */ /* Strided access pattern. */
for (i = 0; i < N/2; i++) for (i = 0; i < N/2; i++)
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
#define N 16 #define N 16
#define DIFF 121 #define DIFF 121
signed char b[N] = {1,2,3,6,8,10,12,14,16,18,20,22,24,26,28,30};
signed char c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) __attribute__ ((noinline))
void main1 (signed char x, signed char max_result, signed char min_result) void main1 (signed char x, signed char max_result, signed char min_result)
{ {
int i; int i;
signed char b[N] = {1,2,3,6,8,10,12,14,16,18,20,22,24,26,28,30};
signed char c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
signed char diff = 2; signed char diff = 2;
signed char max = x; signed char max = x;
signed char min = x; signed char min = x;
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
#define N 16 #define N 16
#define DIFF 242 #define DIFF 242
short b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) __attribute__ ((noinline))
void main1 (short x, short max_result, short min_result) void main1 (short x, short max_result, short min_result)
{ {
int i; int i;
short b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
short diff = 2; short diff = 2;
short max = x; short max = x;
short min = x; short min = x;
......
...@@ -1566,7 +1566,7 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2, ...@@ -1566,7 +1566,7 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
{ {
tree result = vn_reference_lookup_pieces (newvuses, tree result = vn_reference_lookup_pieces (newvuses,
newoperands, newoperands,
&newref); &newref, true);
unsigned int new_val_id; unsigned int new_val_id;
if (newref) if (newref)
...@@ -2499,8 +2499,12 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref, ...@@ -2499,8 +2499,12 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
genop1 = fold_convert (build_pointer_type (currop->type), genop1 = fold_convert (build_pointer_type (currop->type),
genop1); genop1);
folded = fold_build1 (currop->opcode, currop->type, if (currop->opcode == MISALIGNED_INDIRECT_REF)
genop1); folded = fold_build2 (currop->opcode, currop->type,
genop1, currop->op1);
else
folded = fold_build1 (currop->opcode, currop->type,
genop1);
return folded; return folded;
} }
break; break;
...@@ -3139,6 +3143,7 @@ do_regular_insertion (basic_block block, basic_block dom) ...@@ -3139,6 +3143,7 @@ do_regular_insertion (basic_block block, basic_block dom)
basic_block bprime; basic_block bprime;
pre_expr eprime = NULL; pre_expr eprime = NULL;
edge_iterator ei; edge_iterator ei;
pre_expr edoubleprime;
val = get_expr_value_id (expr); val = get_expr_value_id (expr);
if (bitmap_set_contains_value (PHI_GEN (block), val)) if (bitmap_set_contains_value (PHI_GEN (block), val))
...@@ -3154,7 +3159,6 @@ do_regular_insertion (basic_block block, basic_block dom) ...@@ -3154,7 +3159,6 @@ do_regular_insertion (basic_block block, basic_block dom)
FOR_EACH_EDGE (pred, ei, block->preds) FOR_EACH_EDGE (pred, ei, block->preds)
{ {
unsigned int vprime; unsigned int vprime;
pre_expr edoubleprime;
/* This can happen in the very weird case /* This can happen in the very weird case
that our fake infinite loop edges have caused a that our fake infinite loop edges have caused a
...@@ -3216,7 +3220,8 @@ do_regular_insertion (basic_block block, basic_block dom) ...@@ -3216,7 +3220,8 @@ do_regular_insertion (basic_block block, basic_block dom)
an invariant, then the PHI has the same value on all an invariant, then the PHI has the same value on all
edges. Note this. */ edges. Note this. */
else if (!cant_insert && all_same && eprime else if (!cant_insert && all_same && eprime
&& eprime->kind == CONSTANT && (edoubleprime->kind == CONSTANT
|| edoubleprime->kind == NAME)
&& !value_id_constant_p (val)) && !value_id_constant_p (val))
{ {
unsigned int j; unsigned int j;
...@@ -3224,7 +3229,7 @@ do_regular_insertion (basic_block block, basic_block dom) ...@@ -3224,7 +3229,7 @@ do_regular_insertion (basic_block block, basic_block dom)
bitmap_set_t exprset = VEC_index (bitmap_set_t, bitmap_set_t exprset = VEC_index (bitmap_set_t,
value_expressions, val); value_expressions, val);
unsigned int new_val = get_expr_value_id (eprime); unsigned int new_val = get_expr_value_id (edoubleprime);
FOR_EACH_EXPR_ID_IN_SET (exprset, j, bi) FOR_EACH_EXPR_ID_IN_SET (exprset, j, bi)
{ {
pre_expr expr = expression_for_id (j); pre_expr expr = expression_for_id (j);
...@@ -3234,9 +3239,14 @@ do_regular_insertion (basic_block block, basic_block dom) ...@@ -3234,9 +3239,14 @@ do_regular_insertion (basic_block block, basic_block dom)
vn_ssa_aux_t info = VN_INFO (PRE_EXPR_NAME (expr)); vn_ssa_aux_t info = VN_INFO (PRE_EXPR_NAME (expr));
/* Just reset the value id and valnum so it is /* Just reset the value id and valnum so it is
the same as the constant we have discovered. */ the same as the constant we have discovered. */
info->valnum = PRE_EXPR_CONSTANT (eprime); if (edoubleprime->kind == CONSTANT)
{
info->valnum = PRE_EXPR_CONSTANT (edoubleprime);
pre_stats.constified++;
}
else
info->valnum = PRE_EXPR_NAME (edoubleprime);
info->value_id = new_val; info->value_id = new_val;
pre_stats.constified++;
} }
} }
} }
...@@ -3594,7 +3604,7 @@ compute_avail (void) ...@@ -3594,7 +3604,7 @@ compute_avail (void)
copy_reference_ops_from_call (stmt, &ops); copy_reference_ops_from_call (stmt, &ops);
vn_reference_lookup_pieces (shared_vuses_from_stmt (stmt), vn_reference_lookup_pieces (shared_vuses_from_stmt (stmt),
ops, &ref); ops, &ref, false);
VEC_free (vn_reference_op_s, heap, ops); VEC_free (vn_reference_op_s, heap, ops);
if (!ref) if (!ref)
continue; continue;
......
...@@ -595,11 +595,13 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result) ...@@ -595,11 +595,13 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
switch (temp.opcode) switch (temp.opcode)
{ {
case ALIGN_INDIRECT_REF: case ALIGN_INDIRECT_REF:
case MISALIGNED_INDIRECT_REF:
case INDIRECT_REF: case INDIRECT_REF:
/* The only operand is the address, which gets its own /* The only operand is the address, which gets its own
vn_reference_op_s structure. */ vn_reference_op_s structure. */
break; break;
case MISALIGNED_INDIRECT_REF:
temp.op0 = TREE_OPERAND (ref, 1);
break;
case BIT_FIELD_REF: case BIT_FIELD_REF:
/* Record bits and position. */ /* Record bits and position. */
temp.op0 = TREE_OPERAND (ref, 1); temp.op0 = TREE_OPERAND (ref, 1);
...@@ -676,6 +678,92 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result) ...@@ -676,6 +678,92 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
} }
} }
/* Re-create a reference tree from the reference ops OPS.
Returns NULL_TREE if the ops were not handled.
This routine needs to be kept in sync with copy_reference_ops_from_ref. */
static tree
get_ref_from_reference_ops (VEC(vn_reference_op_s, heap) *ops)
{
vn_reference_op_t op;
unsigned i;
tree ref, *op0_p = &ref;
for (i = 0; VEC_iterate (vn_reference_op_s, ops, i, op); ++i)
{
switch (op->opcode)
{
case CALL_EXPR:
return NULL_TREE;
case ALIGN_INDIRECT_REF:
case INDIRECT_REF:
*op0_p = build1 (op->opcode, op->type, NULL_TREE);
op0_p = &TREE_OPERAND (*op0_p, 0);
break;
case MISALIGNED_INDIRECT_REF:
*op0_p = build2 (MISALIGNED_INDIRECT_REF, op->type,
NULL_TREE, op->op0);
op0_p = &TREE_OPERAND (*op0_p, 0);
break;
case BIT_FIELD_REF:
*op0_p = build3 (BIT_FIELD_REF, op->type, NULL_TREE,
op->op0, op->op1);
op0_p = &TREE_OPERAND (*op0_p, 0);
break;
case COMPONENT_REF:
*op0_p = build3 (COMPONENT_REF, TREE_TYPE (op->op0), NULL_TREE,
op->op0, op->op1);
op0_p = &TREE_OPERAND (*op0_p, 0);
break;
case ARRAY_RANGE_REF:
case ARRAY_REF:
*op0_p = build4 (op->opcode, op->type, NULL_TREE,
op->op0, op->op1, op->op2);
op0_p = &TREE_OPERAND (*op0_p, 0);
break;
case STRING_CST:
case INTEGER_CST:
case COMPLEX_CST:
case VECTOR_CST:
case REAL_CST:
case CONSTRUCTOR:
case VAR_DECL:
case PARM_DECL:
case CONST_DECL:
case RESULT_DECL:
case SSA_NAME:
*op0_p = op->op0;
break;
case ADDR_EXPR:
if (op->op0 != NULL_TREE)
{
gcc_assert (is_gimple_min_invariant (op->op0));
*op0_p = op->op0;
break;
}
/* Fallthrough. */
case IMAGPART_EXPR:
case REALPART_EXPR:
case VIEW_CONVERT_EXPR:
*op0_p = build1 (op->opcode, op->type, NULL_TREE);
op0_p = &TREE_OPERAND (*op0_p, 0);
break;
default:
return NULL_TREE;
}
}
return ref;
}
/* Copy the operations present in load/store/call REF into RESULT, a vector of /* Copy the operations present in load/store/call REF into RESULT, a vector of
vn_reference_op_s's. */ vn_reference_op_s's. */
...@@ -895,7 +983,7 @@ vn_reference_lookup_1 (vn_reference_t vr, vn_reference_t *vnresult) ...@@ -895,7 +983,7 @@ vn_reference_lookup_1 (vn_reference_t vr, vn_reference_t *vnresult)
tree tree
vn_reference_lookup_pieces (VEC (tree, gc) *vuses, vn_reference_lookup_pieces (VEC (tree, gc) *vuses,
VEC (vn_reference_op_s, heap) *operands, VEC (vn_reference_op_s, heap) *operands,
vn_reference_t *vnresult) vn_reference_t *vnresult, bool maywalk)
{ {
struct vn_reference_s vr1; struct vn_reference_s vr1;
tree result; tree result;
...@@ -907,6 +995,28 @@ vn_reference_lookup_pieces (VEC (tree, gc) *vuses, ...@@ -907,6 +995,28 @@ vn_reference_lookup_pieces (VEC (tree, gc) *vuses,
vr1.hashcode = vn_reference_compute_hash (&vr1); vr1.hashcode = vn_reference_compute_hash (&vr1);
result = vn_reference_lookup_1 (&vr1, vnresult); result = vn_reference_lookup_1 (&vr1, vnresult);
/* If there is a single defining statement for all virtual uses, we can
use that, following virtual use-def chains. */
if (!result
&& maywalk
&& vr1.vuses
&& VEC_length (tree, vr1.vuses) >= 1)
{
tree ref = get_ref_from_reference_ops (operands);
gimple def_stmt;
if (ref
&& (def_stmt = get_def_ref_stmt_vuses (ref, vr1.vuses))
&& is_gimple_assign (def_stmt))
{
/* We are now at an aliasing definition for the vuses we want to
look up. Re-do the lookup with the vdefs for this stmt. */
vdefs_to_vec (def_stmt, &vuses);
vr1.vuses = valueize_vuses (vuses);
vr1.hashcode = vn_reference_compute_hash (&vr1);
result = vn_reference_lookup_1 (&vr1, vnresult);
}
}
return result; return result;
} }
......
...@@ -178,7 +178,7 @@ void copy_reference_ops_from_ref (tree, VEC(vn_reference_op_s, heap) **); ...@@ -178,7 +178,7 @@ void copy_reference_ops_from_ref (tree, VEC(vn_reference_op_s, heap) **);
void copy_reference_ops_from_call (gimple, VEC(vn_reference_op_s, heap) **); void copy_reference_ops_from_call (gimple, VEC(vn_reference_op_s, heap) **);
tree vn_reference_lookup_pieces (VEC (tree, gc) *, tree vn_reference_lookup_pieces (VEC (tree, gc) *,
VEC (vn_reference_op_s, heap) *, VEC (vn_reference_op_s, heap) *,
vn_reference_t *); vn_reference_t *, bool);
tree vn_reference_lookup (tree, VEC (tree, gc) *, bool, vn_reference_t *); tree vn_reference_lookup (tree, VEC (tree, gc) *, bool, vn_reference_t *);
vn_reference_t vn_reference_insert (tree, tree, VEC (tree, gc) *); vn_reference_t vn_reference_insert (tree, tree, VEC (tree, gc) *);
vn_reference_t vn_reference_insert_pieces (VEC (tree, gc) *, vn_reference_t vn_reference_insert_pieces (VEC (tree, gc) *,
......
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