aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
AgeCommit message (Collapse)AuthorFilesLines
2005-04-05i386.md (*truncdfsf2_i387_1): New pattern.Roger Sayle1-1/+0
* config/i386/i386.md (*truncdfsf2_i387_1): New pattern. * fold-const.c (maybe_lvalue_p): Delete orphaned comment. From-SVN: r97594
2005-04-04re PR rtl-optimization/16104 (ICE in reload_cse_simplify_operands, at ↵Jakub Jelinek1-3/+11
postreload.c:378 with SSE2 code on -O2) PR rtl-optimization/16104 * fold-const.c (fold_unary): Fix folding of vector conversions. * gcc.c-torture/execute/20050316-1.c: New test. From-SVN: r97529
2005-04-04re PR c++/19199 (Wrong warning about returning a reference to a temporary)Roger Sayle1-9/+28
2005-04-03 Roger Sayle <roger@eyesopen.com> Alexandre Oliva <aoliva@redhat.com> PR c++/19199 * fold-const.c (non_lvalue): Split tests into... (maybe_lvalue_p): New function. (fold_cond_expr_with_comparison): Preserve lvalue-ness for the C++ front-end prior to lowering into gimple form. * g++.dg/expr/lval2.C: New. * expr2.C: Fixed. From-SVN: r97522
2005-04-01* bb-reorder.c, fold-const.c, varasm.c: Fix comment typos.Kazu Hirata1-3/+3
From-SVN: r97395
2005-03-25re PR tree-optimization/20470 (Branching sequence generated for ABS(x-y))Pat Haugen1-2/+10
2005-03-25 Pat Haugen <pthaugen@us.ibm.com> PR tree-optimization/20470 * fold-const.c (fold_cond_expr_with_comparison): Recognize/fold ABS(x-y). From-SVN: r97062
2005-03-25fold-const.c: Convert uses of fold (build (...)) to fold_buildN.Kazu Hirata1-521/+521
* fold-const.c: Convert uses of fold (build (...)) to fold_buildN. From-SVN: r97046
2005-03-22fold-const.c (fold_build1, [...]): New.Kazu Hirata1-0/+45
* fold-const.c (fold_build1, fold_build2, fold_build3): New. * tree.h: Add corresponding prototypes. From-SVN: r96881
2005-03-22fold-const.c (fold_ternary): Take decomposed arguments of CALL_EXPR.Kazu Hirata1-16/+11
* fold-const.c (fold_ternary): Take decomposed arguments of CALL_EXPR. (fold): Update a call to fold_ternary. From-SVN: r96880
2005-03-22fold-const.c (fold_unary, [...]): Update comments about arguments.Kazu Hirata1-6/+6
* fold-const.c (fold_unary, fold_binary): Update comments about arguments. From-SVN: r96855
2005-03-21builtins.c (fold_builtin): Take decomposed arguments of CALL_EXPR.Kazu Hirata1-1/+3
* builtins.c (fold_builtin): Take decomposed arguments of CALL_EXPR. * fold-const.c (fold_ternary): Update a call to fold_builtin. * gimplify.c (gimplify_call_expr): Likewise. * tree-ssa-ccp.c (ccp_fold, ccp_fold_builtin): Likewise. * tree.h: Update the prototype of fold_builtin. From-SVN: r96800
2005-03-21re PR middle-end/20539 (ICE in simplify_subreg, at simplify-rtx.c:3674)Roger Sayle1-3/+11
PR middle-end/20539 * fold-const.c (fold_binary): Fix type mismatch between TRUTH_{AND,OR,XOR}_EXPR nodes an their operands' types. (fold_binary) <TRUTH_XOR_EXPR>: Avoid calling invert_truthvalue for non-truth-valued expressions. * c-common.c (c_common_truthvalue_conversion): Handle ERROR_MARK and FUNCTION_DECL in the main switch. <TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, TRUTH_AND_EXPR, TRUTH_OR_EXPR, TRUTH_XOR_EXPR>: When changing the result type of these tree nodes, we also need to convert their operands to match. <TRUTH_NOT_EXPR>: Likewise. * gcc.c-torture/compile/pr13066-1.c: New test case. * gcc.c-torture/compile/pr20539-1.c: Likewise. * g++.dg/opt/pr13066-1.C: Likewise. From-SVN: r96777
2005-03-19re PR middle-end/20493 (Bootstrap failure because of aliased symbols)John David Anglin1-0/+18
PR middle-end/20493 * fold-const.c (fold_widened_comparison): Don't optimize casts of function pointers on targets that require function pointer canonicalization. (fold_sign_changed_comparison): Likewise. From-SVN: r96733
2005-03-16re PR tree-optimization/17454 (ICE with --enable-checking=fold)Roger Sayle1-2/+5
PR tree-optimization/17454 * tree.c (tree_size): Add case for TREE_BINFO. * fold-const.c (fold_checksum_tree): Only clear the overloaded field TYPE_CACHED_VALUES if TYPE_CACHED_VALUES_P is set. From-SVN: r96548
2005-03-13re PR middle-end/19331 (Inefficient code generated for bitfield assignment)Roger Sayle1-4/+7
PR middle-end/19331 * tree.c (get_unwidened): Treat CONVERT_EXPR and NOP_EXPR identically. * fold-const.c (fold_sign_changed_comparison): Likewise. (fold_binary): Optimize comparisons against widened operands if the extension is represented by a CONVERT_EXPR, same as a NOP_EXPR. From-SVN: r96397
2005-03-10re PR tree-optimization/15784 (fold misses binary optimization)Jeff Law1-0/+15
PR tree-optimization/15784 * fold-const.c (fold): Fold ~A + 1 to -A. Fold -A - 1 and -1 - A to ~A. * stmt.c (expand_case): Don't change index_type. Convert minval to the proper type. From-SVN: r96289
2005-03-11re PR tree-optimization/20130 (Fold a * -1 - 1 into ~a;)James A. Morrison1-0/+3
2005-03-11 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/20130 * fold-const.c (fold): Fold x * -1 into -x. From-SVN: r96283
2005-03-09* fold-const.c (fold_unary_to_constant): Add FIX_ROUND_EXPR case.Kaveh R. Ghazi1-0/+1
From-SVN: r96204
2005-03-09fold-const.c (fold_unary, [...]): Take decomposed arguments, code, type, ↵Kazu Hirata1-16/+14
op0, and op1 in case of fold_binary. * fold-const.c (fold_unary, fold_binary): Take decomposed arguments, code, type, op0, and op1 in case of fold_binary. (fold): Update calls to fold_unary and fold_binary. From-SVN: r96202
2005-03-09fold-const.c (fold_unary, [...]): Return NULL_TREE when a given tree is not ↵Kazu Hirata1-33/+37
simplified. * fold-const.c (fold_unary, fold_binary, fold_ternary): Return NULL_TREE when a given tree is not simplified. (fold): Return the original tree when any of the functions mentioned above NULL_TREE. From-SVN: r96201
2005-03-09* fold-const.c (int_const_binop): Remove no_overflow.Kazu Hirata1-2/+0
From-SVN: r96165
2005-03-07fold-const.c (fold_binary_op_with_conditional_arg): Fix typo ordering ops ↵David Edelsohn1-1/+1
from earlier change. * fold-const.c (fold_binary_op_with_conditional_arg): Fix typo ordering ops from earlier change. From-SVN: r96046
2005-03-07fold-const.c (fold_binary): Unroll the very first "for" loop.Kazu Hirata1-17/+41
* fold-const.c (fold_binary): Unroll the very first "for" loop. From-SVN: r96003
2005-03-07* fold-const.c (fold_binary): Remove handling of RANGE_EXPR.Kazu Hirata1-10/+0
From-SVN: r96002
2005-03-06* fold-const.c (fold_unary): Use build1 instead of copy_node.Kazu Hirata1-2/+1
From-SVN: r95989
2005-03-06fold-const.c (fold_binary_op_with_conditional_arg): Take decomposed ↵Kazu Hirata1-10/+11
arguments code, type, op0, and op1 instead of t. * fold-const.c (fold_binary_op_with_conditional_arg): Take decomposed arguments code, type, op0, and op1 instead of t. (fold_binary): Update a call to fold_range_test. From-SVN: r95978
2005-03-06fold-const.c (fold_range_test): Take decomposed arguments code, type, op0, ↵Kazu Hirata1-17/+16
and op1 instead of t. * fold-const.c (fold_range_test): Take decomposed arguments code, type, op0, and op1 instead of t. (fold_binary): Update a call to fold_range_test. From-SVN: r95977
2005-03-06fold-const.c (optimize_minmax_comparison): Take decomposed arguments code, ↵Kazu Hirata1-13/+27
type, op0, and op1 instead of t. * fold-const.c (optimize_minmax_comparison): Take decomposed arguments code, type, op0, and op1 instead of t. (fold_binary): Update a call to optimize_minmax_comparison. From-SVN: r95971
2005-03-06* fold-const.c (fold_binary): Use code instead of t.Kazu Hirata1-1/+1
From-SVN: r95970
2005-03-06fold-const.c (fold_binary): Avoid directly using the original expression t ↵Kazu Hirata1-7/+7
as much as possible. * fold-const.c (fold_binary): Avoid directly using the original expression t as much as possible. From-SVN: r95962
2005-03-06* fold-const.c (fold): Remove handling of binary expressions.Kazu Hirata1-2598/+0
From-SVN: r95961
2005-03-05fold-const.c (fold_binary): New.Kazu Hirata1-0/+2617
* fold-const.c (fold_binary): New. (fold): Call fold_binary on binary expressions. From-SVN: r95938
2005-03-04fold-const.c (fold_ternary): Unroll the "for" loop to extract operands.Kazu Hirata1-59/+47
* fold-const.c (fold_ternary): Unroll the "for" loop to extract operands. From-SVN: r95895
2005-03-03revert: re PR tree-optimization/15784 (fold misses binary optimization)Andrew Pinski1-15/+0
2005-03-04 Andrew Pinski <pinskia@physics.uc.edu> Revert for now: 2005-03-03 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/15784 * fold-const.c (fold): Fold ~A + 1 to -1. Fold -A - 1 and -1 - A to ~A. From-SVN: r95880
2005-03-04fold-const.c (fold_ternary): New.Kazu Hirata1-185/+241
* fold-const.c (fold_ternary): New. (fold): Call fold_ternary on ternary expressions. Remove handling of ternary expressions. From-SVN: r95871
2005-03-04re PR tree-optimization/15784 (fold misses binary optimization)James A. Morrison1-0/+15
2005-03-03 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/15784 * fold-const.c (fold): Fold ~A + 1 to -1. Fold -A - 1 and -1 - A to ~A. From-SVN: r95870
2005-03-03fold-const.c (fold_unary): Avoid directly using the original expression t as ↵Kazu Hirata1-31/+25
much as possible. * fold-const.c (fold_unary): Avoid directly using the original expression t as much as possible. From-SVN: r95837
2005-03-03* fold-const.c (fold): Remove handling of unary expressions.Kazu Hirata1-398/+2
From-SVN: r95836
2005-03-02fold-const.c (fold_unary): New.Kazu Hirata1-0/+435
* fold-const.c (fold_unary): New. (fold): Call fold_unary on unary expressions. From-SVN: r95783
2005-02-24re PR middle-end/19953 (Special-case real + complex arithmetic operation ↵Richard Henderson1-18/+163
(-ffast-math)) PR middle-end/19953 * builtins.c (fold_builtin_complex_mul, fold_builtin_complex_div): New. (fold_builtin_1): Call them. * fold-const.c (fold_complex_mult_parts): Split out from ... (fold_complex_mult): ... here. Fix typo in both imaginary case. (fold_complex_div_parts, fold_complex_div): New. (fold): Use them. * tree.h (fold_complex_mult_parts, fold_complex_div_parts): Declare. From-SVN: r95511
2005-02-18fold-const.c (constant_boolean_node): Always create values of the specified ↵Roger Sayle1-3/+0
type... * fold-const.c (constant_boolean_node): Always create values of the specified type, don't bother calling truthvalue_conversion. From-SVN: r95237
2005-02-18re PR middle-end/20030 (Broken arguments access)Andrew Pinski1-2/+13
2005-02-18 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/20030 * fold-const.c (fold_indirect_ref_1): Use the correct index for zero access, the lower bound of the array type if it exists. From-SVN: r95226
2005-02-17fold-const.c (invert_truthvalue): <INTEGER_CST>: Call constant_boolean_node.James A. Morrison1-2/+1
2005-02-16 James A. Morrison <phython@gcc.gnu.org> * fold-const.c (invert_truthvalue): <INTEGER_CST>: Call constant_boolean_node. From-SVN: r95146
2005-02-16re PR middle-end/19857 (alignment check of SSE constant fails in simple test ↵Jakub Jelinek1-3/+8
program) PR middle-end/19857 * fold-const.c (fold): Don't optimize (T)(x & cst) to (T)x & (T)cst if (T)cst overflows. * convert.c (convert_to_integer) <case POINTER_TYPE>: Pass TYPE_UNSIGNED (type) as type_for_size's UNSIGNEDP argument. * gcc.dg/tree-ssa/20050215-1.c: New test. * gcc.c-torture/execute/20050215-1.c: New test. From-SVN: r95106
2005-02-15fold-const.c (fold): Fold -(~A) to A + 1.James A. Morrison1-0/+15
2005-02-15 James A. Morrison <phython@gcc.gnu.org> * fold-const.c (fold): Fold -(~A) to A + 1. Fold ~(-A) to A - 1. Fold ~(A - 1) and ~(A + -1) to -A. From-SVN: r95074
2005-02-14re-apply fold_indirect_ref patchJason Merrill1-6/+36
From-SVN: r95024
2005-02-14re PR tree-optimization/19944 (cris-elf testsuite failures: ↵James A. Morrison1-0/+20
gcc.dg/pr15784-1.c, gcc.dg/pr15784-2.c) 2005-02-13 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/19944 * fold-const.c (fold): Re-add ABS_EXPR folding. From-SVN: r95002
2005-02-13temporarily revert last changesJason Merrill1-59/+6
From-SVN: r94987
2005-02-13re PR libmudflap/19319 (Mudflap produce many violations on simple, correct ↵Jason Merrill1-6/+36
c++ program) PR mudflap/19319 * gimplify.c (gimplify_modify_expr_rhs) [CALL_EXPR]: Make return slot explicit. PR c++/16405 * fold-const.c (fold_indirect_ref_1): Split out from... (build_fold_indirect_ref): Here. (fold_indirect_ref): New fn. * tree.h: Declare it. * gimplify.c (gimplify_compound_lval): Call fold_indirect_ref. (gimplify_modify_expr_rhs): Likewise. (gimplify_expr): Likewise. From-SVN: r94979
2005-02-13re PR tree-optimization/14303 ([tree-ssa] gcc.c-torture/execute/20020720-1.c ↵James A. Morrison1-0/+23
is not fully folded) 2005-02-13 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/14303 PR tree-optimization/15784 * fold-const.c (fold): Fold ABS_EXPR<x> >= 0 to true, when possible. Fold ABS_EXPR<x> < 0 to false. Fold ABS_EXPR<x> == 0 to x == 0 and ABS_EXPR<x> != 0 to x != 0. From-SVN: r94977
2005-02-11tree-complex.c (expand_complex_libcall): New.Richard Henderson1-0/+184
* tree-complex.c (expand_complex_libcall): New. (expand_complex_multiplication): Use it for c99 compliance. (expand_complex_division): Likewise. * fold-const.c (fold_complex_add, fold_complex_mult): New. (fold): Call them. * builtins.c (built_in_names): Remove const. * tree.c (build_common_builtin_nodes): Build complex arithmetic builtins. * tree.h (BUILT_IN_COMPLEX_MUL_MIN, BUILT_IN_COMPLEX_MUL_MAX): New. (BUILT_IN_COMPLEX_DIV_MIN, BUILT_IN_COMPLEX_DIV_MAX): New. (built_in_names): Remove const. * c-common.c (c_common_type_for_mode): Handle complex modes. * flags.h, toplev.c (flag_complex_method): Rename from flag_complex_divide_method. * libgcc2.c (__divsc3, __divdc3, __divxc3, __divtc3, __mulsc3, __muldc3, __mulxc3, __multc3): New. * libgcc2.h: Declare them. * libgcc-std.ver: Export them. * mklibgcc.in (lib2funcs): Build them. From-SVN: r94909