diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-02-01 09:47:27 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-02-01 09:47:27 +0100 |
commit | 654745e6f967ebf1c8819f9d51a74a042c153639 (patch) | |
tree | 7bcc0c81e3c7db63d667990548f937db05f85f56 /gcc | |
parent | e6c0c44b5b43c4fef77f3a566d035db5c589ff99 (diff) | |
download | gcc-654745e6f967ebf1c8819f9d51a74a042c153639.zip gcc-654745e6f967ebf1c8819f9d51a74a042c153639.tar.gz gcc-654745e6f967ebf1c8819f9d51a74a042c153639.tar.bz2 |
re PR rtl-optimization/69570 (if-conversion bug on i?86)
PR rtl-optimization/69570
* ifcvt.c (bb_ok_for_noce_convert_multiple_sets): Return true only
if there is more than one set, not if there is a single set.
* g++.dg/opt/pr69570.C: New test.
From-SVN: r233033
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ifcvt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr69570.C | 70 |
4 files changed, 82 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bf63f26..b0ba5c2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-02-01 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/69570 + * ifcvt.c (bb_ok_for_noce_convert_multiple_sets): Return true only + if there is more than one set, not if there is a single set. + 2016-02-01 Richard Henderson <rth@redhat.com> PR rtl-opt/69535 diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 74958fb..53cb41f 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -3295,7 +3295,7 @@ bb_ok_for_noce_convert_multiple_sets (basic_block test_bb, if (count > limit) return false; - return count > 0; + return count > 1; } /* Given a simple IF-THEN-JOIN or IF-THEN-ELSE-JOIN block, attempt to convert diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d05a689..6462028 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-02-01 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/69570 + * g++.dg/opt/pr69570.C: New test. + 2016-02-01 Richard Henderson <rth@redhat.com> * gcc.dg/pr69535.c: New test. diff --git a/gcc/testsuite/g++.dg/opt/pr69570.C b/gcc/testsuite/g++.dg/opt/pr69570.C new file mode 100644 index 0000000..11ed416 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr69570.C @@ -0,0 +1,70 @@ +// PR rtl-optimization/69570 +// { dg-do run } +// { dg-options "-O2" } +// { dg-additional-options "-fpic" { target fpic } } +// { dg-additional-options "-march=i686" { target ia32 } } + +template <typename T> inline const T & +min (const T &a, const T &b) +{ + if (b < a) + return b; + return a; +} + +template <typename T> inline const T & +max (const T &a, const T &b) +{ + if (a < b) + return b; + return a; +} + +static inline void +foo (unsigned x, unsigned y, unsigned z, double &h, double &s, double &l) +{ + double r = x / 255.0; + double g = y / 255.0; + double b = z / 255.0; + double m = max (r, max (g, b)); + double n = min (r, min (g, b)); + double d = m - n; + double e = m + n; + h = 0.0, s = 0.0, l = e / 2.0; + if (d > 0.0) + { + s = l > 0.5 ? d / (2.0 - e) : d / e; + if (m == r && m != g) + h = (g - b) / d + (g < b ? 6.0 : 0.0); + if (m == g && m != b) + h = (b - r) / d + 2.0; + if (m == b && m != r) + h = (r - g) / d + 4.0; + h /= 6.0; + } +} + +__attribute__ ((noinline, noclone)) +void bar (unsigned x[3], double y[3]) +{ + double h, s, l; + foo (x[0], x[1], x[2], h, s, l); + y[0] = h; + y[1] = s; + y[2] = l; +} + +int +main () +{ + unsigned x[3] = { 0, 128, 0 }; + double y[3]; + + bar (x, y); + if (__builtin_fabs (y[0] - 0.33333) > 0.001 + || __builtin_fabs (y[1] - 1) > 0.001 + || __builtin_fabs (y[2] - 0.25098) > 0.001) + __builtin_abort (); + + return 0; +} |