Self

The following is a list of simplifications done by the tree folder and the rtl simplifier (note this is not the C expressions but the tree/rtl based ones). Combine transforms marked as n/a are because combine_simplify_rtx calls simplify_binary_operation and friends.

 Simplification Tree Folder (fold-const.c) RTL Simplifier (simplify-rtx.c) Combine (combine.c) i - C > i   -> false yes in fold_binary (PR20922) yes n/a - (NOT A) -> A + 1 yes in fold_unary yes in simplify_unary_operation_1 n/a - (A + 1) -> NOT A yes in fold_unary yes in simplify_unary_operation_1 n/a - (X - Y) -> Y - X yes in negate_expr yes in simplify_unary_operation_1 n/a NOT (-A) -> A - 1 yes in fold_unary yes in simplify_unary_operation_1 as A + -1. n/a NOT (NOT A) -> A yes in fold_unary yes in simplify_unary_operation_1 n/a NOT (A - 1) -> -A yes in fold_unary yes in simplify_unary_operation_1 ABS (ABS X) -> ABS X yes in fold_unary since ABS is nonnegative no yes in combine_simplify_rtx ABS (-x) -> ABS X yes in fold_unary no yes in combine_simplify_rtx ABS X >= 0 -> true yes in fold_binary yes in simplify_const_relational_operation n/a ABS X < 0 -> false yes in fold_binary yes in simplify_const_relational_operation n/a x +/- 0 -> x yes in fold_binary yes in simplify_binary_operation_1 n/a MIN (X, X) -> X yes in fold_binary yes in simplify_binary_operation_1 n/a MAX (X, X) -> X yes in fold_binary yes in simplify_binary_operation_1 n/a X % +/- 1 -> 0 yes in fold_binary yes in simplify_binary_operation_1 n/a 0 % X -> 0 yes in fold_binary yes in simplify_binary_operation_1 n/a X & -1 -> X yes in fold_binary yes by X & NOT constant_with_bits_off_in_X in simplify_binary_operation_1 n/a X & 0 -> 0 yes in fold_binary yes in simplify_binary_operation_1 n/a X & X -> X yes in fold_binary yes in simplify_binary_operation_1 n/a NOT X & X -> 0 yes in fold_binary yes in simplify_binary_operation_1 n/a X & NOT X -> 0 yes in fold_binary yes in simplify_binary_operation_1 n/a NOT X & NOT Y -> NOT (X IOR Y) yes in fold_binary no no (NOT X) XOR (NOT Y) -> (X XOR Y) yes in fold_binary no yes in simplify_logical NOT (X XOR Y) -> (NOT X) XOR Y or X XOR (NOT Y) yes in fold_binary (To NOT (X XOR Y) is not done.) no yes in simplify_logical as (NOT X) XOR Y or X XOR (NOT Y) to NOT (X XOR Y) ((int)b & 1) != 0 -> (b & 1) != 0 yes in simplify_relational_operation_1 n/a (a >> c1)>>c2 -> a >> (c1 + c2) yes in fold_binary, PR14796 yes n/a (a >> c) << c -> a & (-1 << c) yes in fold_binary ? ? (a << c) >> c -> a & (-1 >> c) for unsigned a yes in fold_binary ? ? (int)(a+b) -> (int)a + (int)b PR14844, is done also in the C/C++ front-ends kinda, done after reload no a & b & ~a & ~b -> 0 no yes, re-associative *&a->b -> a->b yes by expand, CSE, and others n/a x * -1 -> -x yes in fold_binary yes n/a &a["b"] - &a["c"] -> (b - c)*sizeof(*a) yes in fold_binary PR21082 n/a yes but because we expand it to be &a + b*sizeof(*a) - (&a + c*sizeof(*a)) (X >> C) & 1 != 0 -> X & C' != 0 n/a n/a bool_var != 0 -> bool_var yes in fold_binary PR15618 no and cannot be done, unless in BImode n/a A % (2**N) -> A & (2**N - 1) for positive values of A yes, in fold_binary ? ? ~X CMP ~Y -> Y CMP X yes, in fold_comparison ? ? x & ((~x) | y) -> y & x NO PR33512 NO PR33512 n/a

None: Simplifications (last edited 2010-06-02 16:03:13 by PaoloBonzini)