From cc49641a7132b66a8fdf26038aa1343e60473eaa Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 3 Jul 2019 12:47:07 +0000 Subject: [PATCH] re PR tree-optimization/91069 (Miscompare of 453.povray since r272843) 2019-07-03 Richard Biener PR middle-end/91069 * match.pd (vec_perm -> bit_insert): Fix element read from first vector. * gcc.dg/pr91069.c: New testcase. From-SVN: r273007 --- gcc/ChangeLog | 6 ++++++ gcc/match.pd | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr91069.c | 20 ++++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr91069.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63160aab268..b3695cf5604 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-07-03 Richard Biener + + PR middle-end/91069 + * match.pd (vec_perm -> bit_insert): Fix element read from + first vector. + 2019-07-03 Martin Liska * dbgcnt.def (DEBUG_COUNTER): Add match debug counter. diff --git a/gcc/match.pd b/gcc/match.pd index f8e35e96d22..4a7aa0185d8 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -5520,7 +5520,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) first vector we only can insert the first elt from the first vector. */ at = 0; - if ((ins = fold_read_from_vector (cop0, 0))) + if ((ins = fold_read_from_vector (cop0, sel[0]))) op0 = op1; } else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0214647af97..95db1ad5806 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-03 Richard Biener + + PR middle-end/91069 + * gcc.dg/pr91069.c: New testcase. + 2019-07-03 Martin Liska * gcc.dg/tree-prof/val-prof-2.c: Update scanned pattern diff --git a/gcc/testsuite/gcc.dg/pr91069.c b/gcc/testsuite/gcc.dg/pr91069.c new file mode 100644 index 00000000000..221da30a94c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr91069.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-options "-std=gnu11" } */ + +typedef double v2df __attribute__((vector_size(16))); +typedef long v2di __attribute__((vector_size(16))); + +void foo (v2df *res, v2df *src) +{ + v2df x = *src; + *res = __builtin_shuffle ((v2df) { 1.0, 0.0 }, x, (v2di) { 1, 3 }); +} + +int main() +{ + v2df x = (v2df) { 0.0, 2.0 }; + foo (&x, &x); + if (x[0] != 0.0 || x[1] != 2.0) + __builtin_abort (); + return 0; +} -- 2.30.2