From: Richard Guenther Date: Fri, 23 Dec 2011 09:16:08 +0000 (+0000) Subject: re PR rtl-optimization/50396 (SSE division by zero generates incorrect code with... X-Git-Tag: releases/gcc-4.6.3~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c20da620344ad8ac24aa89fb144bd8b4971b8a57;p=thirdparty%2Fgcc.git re PR rtl-optimization/50396 (SSE division by zero generates incorrect code with optimizations enabled) 2011-12-23 Richard Guenther PR rtl-optimization/50396 * simplify-rtx.c (simplify_binary_operation_1): Properly guard code that only works for integers. * gcc.dg/torture/pr50396.c: New testcase. From-SVN: r182654 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 02d2aa5916ad..bb71f57f66ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-12-23 Richard Guenther + + PR rtl-optimization/50396 + * simplify-rtx.c (simplify_binary_operation_1): Properly + guard code that only works for integers. + 2011-12-22 Doug Kwan Backport from mainline diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index ed4019622017..42b1be60b153 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2777,7 +2777,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, } } } - else + else if (SCALAR_INT_MODE_P (mode)) { /* 0/x is 0 (or x&0 if x has side-effects). */ if (trueop0 == CONST0_RTX (mode) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 24bdfd049288..c923c3f10b93 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-12-23 Richard Guenther + + PR rtl-optimization/50396 + * gcc.dg/torture/pr50396.c: New testcase. + 2011-12-22 Doug Kwan Backport from mainline diff --git a/gcc/testsuite/gcc.dg/torture/pr50396.c b/gcc/testsuite/gcc.dg/torture/pr50396.c new file mode 100644 index 000000000000..8e5d008ca01f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr50396.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ + +extern void abort (void); +typedef float vf128 __attribute__((vector_size(16))); +typedef float vf64 __attribute__((vector_size(8))); +int main() +{ +#if !__FINITE_MATH_ONLY__ +#if __FLT_HAS_QUIET_NAN__ + vf128 v = (vf128){ 0.f, 0.f, 0.f, 0.f }; + vf64 u = (vf64){ 0.f, 0.f }; + v = v / (vf128){ 0.f, 0.f, 0.f, 0.f }; + if (v[0] == v[0]) + abort (); + u = u / (vf64){ 0.f, 0.f }; + if (u[0] == u[0]) + abort (); +#endif +#endif + return 0; +}