From d88981fc3e1d9b1394a45074ead47d0ced23212b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 14 Mar 2015 10:56:39 +0100 Subject: [PATCH] re PR target/65369 (nettle test failure on powerpc64le-linux-gnu when built with -O3) PR tree-optimization/65369 * tree-vect-stmts.c (vectorizable_load) : Set bump to vs * TYPE_SIZE_UNIT (elem_type) - 1 instead of (vs - 1) * TYPE_SIZE_UNIT (elem_type). * gcc.c-torture/execute/pr65369.c: New test. From-SVN: r221435 --- gcc/ChangeLog | 5 +++ gcc/testsuite/ChangeLog | 3 ++ gcc/testsuite/gcc.c-torture/execute/pr65369.c | 45 +++++++++++++++++++ gcc/tree-vect-stmts.c | 6 +-- 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr65369.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8a387687eac..e87e5fccb73 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2015-03-14 Jakub Jelinek + PR tree-optimization/65369 + * tree-vect-stmts.c (vectorizable_load) : + Set bump to vs * TYPE_SIZE_UNIT (elem_type) - 1 instead of + (vs - 1) * TYPE_SIZE_UNIT (elem_type). + PR tree-optimization/65418 * tree-ssa-reassoc.c (extract_bit_test_mask): If there are casts in the first PLUS_EXPR operand, ensure tbias and diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e4a92af2dab..cbd544d12b1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2015-03-14 Jakub Jelinek + PR tree-optimization/65369 + * gcc.c-torture/execute/pr65369.c: New test. + PR tree-optimization/65418 * gcc.c-torture/execute/pr65418-1.c: New test. * gcc.c-torture/execute/pr65418-2.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr65369.c b/gcc/testsuite/gcc.c-torture/execute/pr65369.c new file mode 100644 index 00000000000..339915e9521 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr65369.c @@ -0,0 +1,45 @@ +/* PR tree-optimization/65369 */ + +static const char data[] = + "12345678901234567890123456789012345678901234567890" + "123456789012345678901234567890"; + +__attribute__ ((noinline)) +static void foo (const unsigned int *buf) +{ + if (__builtin_memcmp (buf, data, 64)) + __builtin_abort (); +} + +__attribute__ ((noinline)) +static void bar (const unsigned char *block) +{ + unsigned int buf[16]; + __builtin_memcpy (buf + 0, block + 0, 4); + __builtin_memcpy (buf + 1, block + 4, 4); + __builtin_memcpy (buf + 2, block + 8, 4); + __builtin_memcpy (buf + 3, block + 12, 4); + __builtin_memcpy (buf + 4, block + 16, 4); + __builtin_memcpy (buf + 5, block + 20, 4); + __builtin_memcpy (buf + 6, block + 24, 4); + __builtin_memcpy (buf + 7, block + 28, 4); + __builtin_memcpy (buf + 8, block + 32, 4); + __builtin_memcpy (buf + 9, block + 36, 4); + __builtin_memcpy (buf + 10, block + 40, 4); + __builtin_memcpy (buf + 11, block + 44, 4); + __builtin_memcpy (buf + 12, block + 48, 4); + __builtin_memcpy (buf + 13, block + 52, 4); + __builtin_memcpy (buf + 14, block + 56, 4); + __builtin_memcpy (buf + 15, block + 60, 4); + foo (buf); +} + +int +main () +{ + unsigned char input[sizeof data + 16] __attribute__((aligned (16))); + __builtin_memset (input, 0, sizeof input); + __builtin_memcpy (input + 1, data, sizeof data); + bar (input + 1); + return 0; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 41ff80245e5..e0cebc685b1 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -6468,9 +6468,8 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, case dr_explicit_realign: { tree ptr, bump; - tree vs_minus_1; - vs_minus_1 = size_int (TYPE_VECTOR_SUBPARTS (vectype) - 1); + tree vs = size_int (TYPE_VECTOR_SUBPARTS (vectype)); if (compute_in_loop) msq = vect_setup_realignment (first_stmt, gsi, @@ -6499,8 +6498,9 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, vect_finish_stmt_generation (stmt, new_stmt, gsi); msq = new_temp; - bump = size_binop (MULT_EXPR, vs_minus_1, + bump = size_binop (MULT_EXPR, vs, TYPE_SIZE_UNIT (elem_type)); + bump = size_binop (MINUS_EXPR, bump, size_one_node); ptr = bump_vector_ptr (dataref_ptr, NULL, gsi, stmt, bump); new_stmt = gimple_build_assign (NULL_TREE, BIT_AND_EXPR, ptr, -- 2.30.2