Deleted Added
full compact
builtins.c (132727) builtins.c (146906)
1/* Expand builtin functions.
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 1694 unchanged lines hidden (view full) ---

1703 target = gen_reg_rtx (mode);
1704
1705 /* Wrap the computation of the argument in a SAVE_EXPR, as we may
1706 need to expand the argument again. This way, we will not perform
1707 side-effects more the once. */
1708 narg = save_expr (arg);
1709 if (narg != arg)
1710 {
1/* Expand builtin functions.
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 1694 unchanged lines hidden (view full) ---

1703 target = gen_reg_rtx (mode);
1704
1705 /* Wrap the computation of the argument in a SAVE_EXPR, as we may
1706 need to expand the argument again. This way, we will not perform
1707 side-effects more the once. */
1708 narg = save_expr (arg);
1709 if (narg != arg)
1710 {
1711 arg = narg;
1711 arglist = build_tree_list (NULL_TREE, arg);
1712 exp = build_function_call_expr (fndecl, arglist);
1713 }
1714
1715 op0 = expand_expr (arg, subtarget, VOIDmode, 0);
1716
1717 emit_queue ();
1718 start_sequence ();

--- 116 unchanged lines hidden (view full) ---

1835
1836 if (! flag_errno_math || ! HONOR_NANS (mode))
1837 errno_set = false;
1838
1839 /* Alway stabilize the argument list. */
1840 narg = save_expr (arg1);
1841 if (narg != arg1)
1842 {
1712 arglist = build_tree_list (NULL_TREE, arg);
1713 exp = build_function_call_expr (fndecl, arglist);
1714 }
1715
1716 op0 = expand_expr (arg, subtarget, VOIDmode, 0);
1717
1718 emit_queue ();
1719 start_sequence ();

--- 116 unchanged lines hidden (view full) ---

1836
1837 if (! flag_errno_math || ! HONOR_NANS (mode))
1838 errno_set = false;
1839
1840 /* Alway stabilize the argument list. */
1841 narg = save_expr (arg1);
1842 if (narg != arg1)
1843 {
1844 arg1 = narg;
1843 temp = build_tree_list (NULL_TREE, narg);
1844 stable = false;
1845 }
1846 else
1847 temp = TREE_CHAIN (arglist);
1848
1849 narg = save_expr (arg0);
1850 if (narg != arg0)
1851 {
1845 temp = build_tree_list (NULL_TREE, narg);
1846 stable = false;
1847 }
1848 else
1849 temp = TREE_CHAIN (arglist);
1850
1851 narg = save_expr (arg0);
1852 if (narg != arg0)
1853 {
1854 arg0 = narg;
1852 arglist = tree_cons (NULL_TREE, narg, temp);
1853 stable = false;
1854 }
1855 else if (! stable)
1856 arglist = tree_cons (NULL_TREE, arg0, temp);
1857
1858 if (! stable)
1859 exp = build_function_call_expr (fndecl, arglist);

--- 4716 unchanged lines hidden (view full) ---

6576 tree expfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0);
6577 arg = fold (build (MULT_EXPR, type,
6578 TREE_VALUE (TREE_OPERAND (arg, 1)),
6579 build_real (type, dconsthalf)));
6580 arglist = build_tree_list (NULL_TREE, arg);
6581 return build_function_call_expr (expfn, arglist);
6582 }
6583
1855 arglist = tree_cons (NULL_TREE, narg, temp);
1856 stable = false;
1857 }
1858 else if (! stable)
1859 arglist = tree_cons (NULL_TREE, arg0, temp);
1860
1861 if (! stable)
1862 exp = build_function_call_expr (fndecl, arglist);

--- 4716 unchanged lines hidden (view full) ---

6579 tree expfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0);
6580 arg = fold (build (MULT_EXPR, type,
6581 TREE_VALUE (TREE_OPERAND (arg, 1)),
6582 build_real (type, dconsthalf)));
6583 arglist = build_tree_list (NULL_TREE, arg);
6584 return build_function_call_expr (expfn, arglist);
6585 }
6586
6584 /* Optimize sqrt(pow(x,y)) = pow(x,y*0.5). */
6587 /* Optimize sqrt(pow(x,y)) = pow(|x|,y*0.5). */
6585 if (flag_unsafe_math_optimizations
6586 && (fcode == BUILT_IN_POW
6587 || fcode == BUILT_IN_POWF
6588 || fcode == BUILT_IN_POWL))
6589 {
6590 tree powfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0);
6591 tree arg0 = TREE_VALUE (TREE_OPERAND (arg, 1));
6592 tree arg1 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg, 1)));
6588 if (flag_unsafe_math_optimizations
6589 && (fcode == BUILT_IN_POW
6590 || fcode == BUILT_IN_POWF
6591 || fcode == BUILT_IN_POWL))
6592 {
6593 tree powfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0);
6594 tree arg0 = TREE_VALUE (TREE_OPERAND (arg, 1));
6595 tree arg1 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg, 1)));
6593 tree narg1 = fold (build (MULT_EXPR, type, arg1,
6594 build_real (type, dconsthalf)));
6596 tree narg1;
6597 if (!tree_expr_nonnegative_p (arg0))
6598 arg0 = build1 (ABS_EXPR, type, arg0);
6599 narg1 = fold (build (MULT_EXPR, type, arg1,
6600 build_real (type, dconsthalf)));
6595 arglist = tree_cons (NULL_TREE, arg0,
6596 build_tree_list (NULL_TREE, narg1));
6597 return build_function_call_expr (powfn, arglist);
6598 }
6599 }
6600 break;
6601
6602 case BUILT_IN_SIN:

--- 437 unchanged lines hidden ---
6601 arglist = tree_cons (NULL_TREE, arg0,
6602 build_tree_list (NULL_TREE, narg1));
6603 return build_function_call_expr (powfn, arglist);
6604 }
6605 }
6606 break;
6607
6608 case BUILT_IN_SIN:

--- 437 unchanged lines hidden ---