From 99c9c69acb9150b1b93bb86ec4ab0a65c8416c36 Mon Sep 17 00:00:00 2001 From: Dorit Nuzman Date: Tue, 24 Jul 2007 09:20:50 +0000 Subject: [PATCH] 2007-07-24 Dorit Nuzman * lib/target-support.exp (check_effective_target_natural_alignment): (check_effective_target_vector_alignment_reachable): New. * config/spu/spu.c (spu_vector_alignment_reachable): New. (TARGET_VECTOR_ALIGNMENT_REACHABLE): Define. * * gcc.dg/vect/pr25413a.c: Use vector_alignment_reachable target check. * gcc.dg/vect/pr25413.c: Likewise. * gcc.dg/vect/pr31699.c: Likewise. From-SVN: r126872 --- gcc/config/spu/spu.c | 18 ++++++++++++ gcc/testsuite/ChangeLog | 11 +++++++ gcc/testsuite/gcc.dg/vect/pr25413.c | 8 +++--- gcc/testsuite/gcc.dg/vect/pr25413a.c | 4 +-- gcc/testsuite/gcc.dg/vect/pr31699.c | 4 +-- gcc/testsuite/lib/target-supports.exp | 41 +++++++++++++++++++++++++++ 6 files changed, 78 insertions(+), 8 deletions(-) diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index e283d87c0d4..53d0c46c399 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -136,6 +136,7 @@ static tree spu_builtin_mul_widen_even (tree); static tree spu_builtin_mul_widen_odd (tree); static tree spu_builtin_mask_for_load (void); static int spu_builtin_vectorization_cost (bool); +static bool spu_vector_alignment_reachable (tree, bool); extern const char *reg_names[]; rtx spu_compare_op0, spu_compare_op1; @@ -272,6 +273,9 @@ const struct attribute_spec spu_attribute_table[]; #undef TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST #define TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST spu_builtin_vectorization_cost +#undef TARGET_VECTOR_ALIGNMENT_REACHABLE +#define TARGET_VECTOR_ALIGNMENT_REACHABLE spu_vector_alignment_reachable + struct gcc_target targetm = TARGET_INITIALIZER; void @@ -5477,6 +5481,20 @@ spu_builtin_vectorization_cost (bool runtime_test) return 0; } +/* Return true iff, data reference of TYPE can reach vector alignment (16) + after applying N number of iterations. This routine does not determine + how may iterations are required to reach desired alignment. */ + +static bool +spu_vector_alignment_reachable (tree type ATTRIBUTE_UNUSED, bool is_packed) +{ + if (is_packed) + return false; + + /* All other types are naturally aligned. */ + return true; +} + void spu_init_expanders (void) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 39a14049946..486bc884987 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2007-07-24 Dorit Nuzman + + * lib/target-support.exp (check_effective_target_natural_alignment): + (check_effective_target_vector_alignment_reachable): New. + * config/spu/spu.c (spu_vector_alignment_reachable): New. + (TARGET_VECTOR_ALIGNMENT_REACHABLE): Define. + * * gcc.dg/vect/pr25413a.c: Use vector_alignment_reachable target + check. + * gcc.dg/vect/pr25413.c: Likewise. + * gcc.dg/vect/pr31699.c: Likewise. + 2007-07-24 Thomas Koenig PR fortran/30814 diff --git a/gcc/testsuite/gcc.dg/vect/pr25413.c b/gcc/testsuite/gcc.dg/vect/pr25413.c index 744472518eb..e74093df15a 100644 --- a/gcc/testsuite/gcc.dg/vect/pr25413.c +++ b/gcc/testsuite/gcc.dg/vect/pr25413.c @@ -31,8 +31,8 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_aligned_arrays } } } */ -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_aligned_arrays } } } } */ -/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vect_aligned_arrays } } } } */ -/* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 1 "vect" { target { ! vect_aligned_arrays } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vector_alignment_reachable } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vector_alignment_reachable } } } } */ +/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vector_alignment_reachable } } } } */ +/* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 1 "vect" { target { ! vector_alignment_reachable } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr25413a.c b/gcc/testsuite/gcc.dg/vect/pr25413a.c index 89291c6dc30..b9bef5f5b77 100644 --- a/gcc/testsuite/gcc.dg/vect/pr25413a.c +++ b/gcc/testsuite/gcc.dg/vect/pr25413a.c @@ -124,6 +124,6 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vect_aligned_arrays } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { ! vect_aligned_arrays } } } } */ +/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vector_alignment_reachable } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { ! vector_alignment_reachable } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr31699.c b/gcc/testsuite/gcc.dg/vect/pr31699.c index d1e396ed7dc..cbc596d467f 100644 --- a/gcc/testsuite/gcc.dg/vect/pr31699.c +++ b/gcc/testsuite/gcc.dg/vect/pr31699.c @@ -31,6 +31,6 @@ int main() } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_intfloat_cvt } } } */ -/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vect_aligned_arrays } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { ! vect_aligned_arrays } } } } */ +/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vector_alignment_reachable } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { ! vector_alignment_reachable } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index c52a050829f..ea3ecc439c5 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2031,6 +2031,47 @@ proc check_effective_target_vect_aligned_arrays { } { return $et_vect_aligned_arrays_saved } +# Return 1 if types are naturally aligned (aligned to their type-size), +# 0 otherwise. +# +# This won't change for different subtargets so cache the result. + +proc check_effective_target_natural_alignment { } { + global et_natural_alignment + + if [info exists et_natural_alignment_saved] { + verbose "check_effective_target_natural_alignment: using cached result" 2 + } else { + set et_natural_alignment_saved 0 + if { [istarget spu-*-*] } { + set et_natural_alignment_saved 1 + } + } + verbose "check_effective_target_natural_alignment: returning $et_natural_alignment_saved" 2 + return $et_natural_alignment_saved +} + +# Return 1 if vector alignment is reachable, 0 otherwise. +# +# This won't change for different subtargets so cache the result. + +proc check_effective_target_vector_alignment_reachable { } { + global et_vector_alignment_reachable + + if [info exists et_vector_alignment_reachable_saved] { + verbose "check_effective_target_vector_alignment_reachable: using cached result" 2 + } else { + if { [check_effective_target_vect_aligned_arrays] + || [check_effective_target_natural_alignment] } { + set et_vector_alignment_reachable_saved 1 + } else { + set et_vector_alignment_reachable_saved 0 + } + } + verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2 + return $et_vector_alignment_reachable_saved +} + # Return 1 if the target supports vector conditional operations, 0 otherwise. proc check_effective_target_vect_condition { } { -- 2.30.2