diff options
author | Uros Bizjak <uros@gcc.gnu.org> | 2009-06-28 20:33:54 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2009-06-28 20:33:54 +0200 |
commit | 1e9ae5ab30a1482760bf7bb35fcdf18e2dbe942f (patch) | |
tree | 4c7d57ca3c9ac8e23c6f7cc8ce6df494f71bc272 | |
parent | c703e618f89b29ed9ef55d53e08212bb46548810 (diff) | |
download | gcc-1e9ae5ab30a1482760bf7bb35fcdf18e2dbe942f.zip gcc-1e9ae5ab30a1482760bf7bb35fcdf18e2dbe942f.tar.gz gcc-1e9ae5ab30a1482760bf7bb35fcdf18e2dbe942f.tar.bz2 |
re PR tree-optimization/40550 (Segmentation fault caused by alignment error in sse code)
PR tree-optimization/40550
* tree-vect-generic.c (expand_vector_operations_1): Compute in
vector_compute_type only when the size of vector_compute_type is
less than the size of type.
testsuite/ChangeLog:
PR tree-optimization/40550
* gcc.dg/pr40550.c: New test.
From-SVN: r149038
-rw-r--r-- | gcc/ChangeLog | 18 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr40550.c | 34 | ||||
-rw-r--r-- | gcc/tree-vect-generic.c | 6 |
4 files changed, 54 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1c9a1c2..e6a5cea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2009-06-28 Uros Bizjak <ubizjak@gmail.com> + + PR tree-optimization/40550 + * tree-vect-generic.c (expand_vector_operations_1): Compute in + vector_compute_type only when the size of vector_compute_type is + less than the size of type. + 2009-06-28 Eric Botcazou <ebotcazou@adacore.com> * fold-const.c (contains_label_1): Fix comments. @@ -121,7 +128,7 @@ problem_MD, df_md_add_problem): New. * df.h (DF_MD, DF_MD_BB_INFO, struct df_md_bb_info, df_md, df_md_get_bb_info): New. - DF_LAST_PROBLEM_PLUS1): Adjust. + (DF_LAST_PROBLEM_PLUS1): Adjust. * Makefile.in (fwprop.o): Include domwalk.h. * fwprop.c: Include domwalk.h. @@ -271,8 +278,7 @@ 2009-06-26 Richard Guenther <rguenther@suse.de> - * tree-ssa-structalias.c (do_ds_constraint): Simplify escape - handling. + * tree-ssa-structalias.c (do_ds_constraint): Simplify escape handling. 2009-06-26 Steven Bosscher <steven@gcc.gnu.org> @@ -406,8 +412,7 @@ * config/avr/avr.md (movmemhi): Use add_reg_note. (andhi3, andsi3): Don't use AS2 with "and". (iorhi3, iorsi3): Don't use AS2 with "or". - * config/avr/avr-protos.h (class_likely_spilled_p): Update - declaration. + * config/avr/avr-protos.h (class_likely_spilled_p): Update declaration. * config/crx/crx.c: Include "df.h". (crx_attribute_table): Make static. * config/m32r/m32r.c: Include "df.h". @@ -635,8 +640,7 @@ HARD_REGNO_NREGS, to calculate the number of registers each hard register takes for each type. (rs6000_debug_reg_print): New function for -mdebug=reg support. - (rs6000_debug_vector_unit): New array, map rs6000_vector to - string. + (rs6000_debug_vector_unit): New array, map rs6000_vector to string. (+rs6000_init_hard_regno_mode_ok): New function, move calculation of HARD_REGNO_NREGS, CLASS_MAX_NREGS, REGNO_REG_CLASS, and vector unit information here so it is calculated once at compiler startup diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 32acab3..80fe78b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-06-28 Uros Bizjak <ubizjak@gmail.com> + + PR tree-optimization/40550 + * gcc.dg/pr40550.c: New test. + 2009-06-28 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/overflow_sum2.adb: New test diff --git a/gcc/testsuite/gcc.dg/pr40550.c b/gcc/testsuite/gcc.dg/pr40550.c new file mode 100644 index 0000000..27935ab --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr40550.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +#ifdef __i386__ +#include "cpuid.h" +#endif + +typedef float v2sf __attribute__ ((vector_size (2 * sizeof(float)))); + +static void test (void) +{ + v2sf a = {1.0, 0.0}; + v2sf b = {0.0, 1.0}; + v2sf d; + d = a + b; +} + +int main () +{ + +#ifdef __i386__ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + if (!(edx & bit_SSE)) + return 0; +#endif + + test (); + + return 0; +} diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index d99d713..9ef0239 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -482,8 +482,10 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi) tree vector_compute_type = type_for_widest_vector_mode (TYPE_MODE (TREE_TYPE (type)), op, TYPE_SATURATING (TREE_TYPE (type))); - if (vector_compute_type != NULL_TREE) - compute_type = vector_compute_type; + if (vector_compute_type != NULL_TREE + && (TYPE_VECTOR_SUBPARTS (vector_compute_type) + < TYPE_VECTOR_SUBPARTS (compute_type))) + compute_type = vector_compute_type; } /* If we are breaking a BLKmode vector into smaller pieces, |