fold-const.c (fold_strip_sign_ops): Handle COMPOUND_EXPR and COND_EXPR.
* fold-const.c (fold_strip_sign_ops): Handle COMPOUND_EXPR and COND_EXPR. testsuite: * gcc.dg/builtins-20.c: Add more cases. From-SVN: r118802
This commit is contained in:
parent
833bf445b0
commit
b7e85170cf
4 changed files with 73 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2006-11-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* fold-const.c (fold_strip_sign_ops): Handle COMPOUND_EXPR and
|
||||
COND_EXPR.
|
||||
|
||||
2006-11-13 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* config/m32c/m32c.c (m32c_prepare_shift): Use a separate
|
||||
|
|
|
@ -13368,6 +13368,22 @@ fold_strip_sign_ops (tree exp)
|
|||
arg1 ? arg1 : TREE_OPERAND (exp, 1));
|
||||
break;
|
||||
|
||||
case COMPOUND_EXPR:
|
||||
arg0 = TREE_OPERAND (exp, 0);
|
||||
arg1 = fold_strip_sign_ops (TREE_OPERAND (exp, 1));
|
||||
if (arg1)
|
||||
return fold_build2 (COMPOUND_EXPR, TREE_TYPE (exp), arg0, arg1);
|
||||
break;
|
||||
|
||||
case COND_EXPR:
|
||||
arg0 = fold_strip_sign_ops (TREE_OPERAND (exp, 1));
|
||||
arg1 = fold_strip_sign_ops (TREE_OPERAND (exp, 2));
|
||||
if (arg0 || arg1)
|
||||
return fold_build3 (COND_EXPR, TREE_TYPE (exp), TREE_OPERAND (exp, 0),
|
||||
arg0 ? arg0 : TREE_OPERAND (exp, 1),
|
||||
arg1 ? arg1 : TREE_OPERAND (exp, 2));
|
||||
break;
|
||||
|
||||
case CALL_EXPR:
|
||||
/* Strip sign ops from the argument of "odd" math functions. */
|
||||
if (negate_mathfn_p (builtin_mathfn_code (exp)))
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2006-11-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* gcc.dg/builtins-20.c: Add more cases.
|
||||
|
||||
2006-11-13 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR fortran/29759
|
||||
|
|
|
@ -89,6 +89,22 @@ void test2(double x, double y)
|
|||
if (cos(-fabs(tan(x/-y))) != cos(tan(x/y)))
|
||||
link_error ();
|
||||
|
||||
if (cos(y<10 ? -x : y) != cos(y<10 ? x : y))
|
||||
link_error ();
|
||||
|
||||
if (cos(y<10 ? x : -y) != cos(y<10 ? x : y))
|
||||
link_error ();
|
||||
|
||||
if (cos(y<10 ? -fabs(x) : tan(x<20 ? -x : -fabs(y)))
|
||||
!= cos(y<10 ? x : tan(x<20 ? x : y)))
|
||||
link_error ();
|
||||
|
||||
if (cos((y*=3, -x)) != cos((y*=3,x)))
|
||||
link_error ();
|
||||
|
||||
if (cos((y*=2, -fabs(tan(x/-y)))) != cos((y*=2,tan(x/y))))
|
||||
link_error ();
|
||||
|
||||
if (hypot (x, 0) != fabs(x))
|
||||
link_error ();
|
||||
|
||||
|
@ -190,6 +206,22 @@ void test2f(float x, float y)
|
|||
if (cosf(-fabsf(tanf(x/-y))) != cosf(tanf(x/y)))
|
||||
link_error ();
|
||||
|
||||
if (cosf(y<10 ? -x : y) != cosf(y<10 ? x : y))
|
||||
link_error ();
|
||||
|
||||
if (cosf(y<10 ? x : -y) != cosf(y<10 ? x : y))
|
||||
link_error ();
|
||||
|
||||
if (cosf(y<10 ? -fabsf(x) : tanf(x<20 ? -x : -fabsf(y)))
|
||||
!= cosf(y<10 ? x : tanf(x<20 ? x : y)))
|
||||
link_error ();
|
||||
|
||||
if (cosf((y*=3, -x)) != cosf((y*=3,x)))
|
||||
link_error ();
|
||||
|
||||
if (cosf((y*=2, -fabsf(tanf(x/-y)))) != cosf((y*=2,tanf(x/y))))
|
||||
link_error ();
|
||||
|
||||
if (hypotf (x, 0) != fabsf(x))
|
||||
link_error ();
|
||||
|
||||
|
@ -292,6 +324,22 @@ void test2l(long double x, long double y)
|
|||
if (cosl(-fabsl(tanl(x/-y))) != cosl(tanl(x/y)))
|
||||
link_error ();
|
||||
|
||||
if (cosl(y<10 ? -x : y) != cosl(y<10 ? x : y))
|
||||
link_error ();
|
||||
|
||||
if (cosl(y<10 ? x : -y) != cosl(y<10 ? x : y))
|
||||
link_error ();
|
||||
|
||||
if (cosl(y<10 ? -fabsl(x) : tanl(x<20 ? -x : -fabsl(y)))
|
||||
!= cosl(y<10 ? x : tanl(x<20 ? x : y)))
|
||||
link_error ();
|
||||
|
||||
if (cosl((y*=3, -x)) != cosl((y*=3,x)))
|
||||
link_error ();
|
||||
|
||||
if (cosl((y*=2, -fabsl(tanl(x/-y)))) != cosl((y*=2,tanl(x/y))))
|
||||
link_error ();
|
||||
|
||||
if (hypotl (x, 0) != fabsl(x))
|
||||
link_error ();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue