/* ~x | x -> -1 */
/* ~x ^ x -> -1 */
-/* ~x + x -> -1 */
-(for op (bit_ior bit_xor plus)
+(for op (bit_ior bit_xor)
(simplify
(op:c (convert? @0) (convert? (bit_not @0)))
(convert { build_all_ones_cst (TREE_TYPE (@0)); })))
/* ~A + A -> -1 */
(simplify
- (plus:c (bit_not @0) @0)
+ (plus:c (convert? (bit_not @0)) (convert? @0))
(if (!TYPE_OVERFLOW_TRAPS (type))
- { build_all_ones_cst (type); }))
+ (convert { build_all_ones_cst (TREE_TYPE (@0)); })))
/* ~A + 1 -> -A */
(simplify
(scmp @0 (bit_not @1)))))
(for cmp (simple_comparison)
- /* Fold (double)float1 CMP (double)float2 into float1 CMP float2. */
- (simplify
- (cmp (convert@2 @0) (convert? @1))
- (if (FLOAT_TYPE_P (TREE_TYPE (@0))
- && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@2))
- == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0)))
- && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@2))
- == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@1))))
- (with
- {
- tree type1 = TREE_TYPE (@1);
- if (TREE_CODE (@1) == REAL_CST && !DECIMAL_FLOAT_TYPE_P (type1))
- {
- REAL_VALUE_TYPE orig = TREE_REAL_CST (@1);
- if (TYPE_PRECISION (type1) > TYPE_PRECISION (float_type_node)
- && exact_real_truncate (TYPE_MODE (float_type_node), &orig))
- type1 = float_type_node;
- if (TYPE_PRECISION (type1) > TYPE_PRECISION (double_type_node)
- && exact_real_truncate (TYPE_MODE (double_type_node), &orig))
- type1 = double_type_node;
- }
- tree newtype
- = (TYPE_PRECISION (TREE_TYPE (@0)) > TYPE_PRECISION (type1)
- ? TREE_TYPE (@0) : type1);
- }
- (if (TYPE_PRECISION (TREE_TYPE (@2)) > TYPE_PRECISION (newtype))
- (cmp (convert:newtype @0) (convert:newtype @1))))))
-
(simplify
(cmp @0 REAL_CST@1)
/* IEEE doesn't distinguish +0 and -0 in comparisons. */
(if (cmp == LT_EXPR || cmp == LE_EXPR)
{ constant_boolean_node (above ? true : false, type); }
(if (cmp == GT_EXPR || cmp == GE_EXPR)
- { constant_boolean_node (above ? false : true, type); }))))))))))))
+ { constant_boolean_node (above ? false : true, type); })))))))))
+ /* Fold (double)float1 CMP (double)float2 into float1 CMP float2. */
+ (if (FLOAT_TYPE_P (TREE_TYPE (@00))
+ && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0))
+ == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@00)))
+ && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0))
+ == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@10))))
+ (with
+ {
+ tree type1 = TREE_TYPE (@10);
+ if (TREE_CODE (@10) == REAL_CST && !DECIMAL_FLOAT_TYPE_P (type1))
+ {
+ REAL_VALUE_TYPE orig = TREE_REAL_CST (@10);
+ if (TYPE_PRECISION (type1) > TYPE_PRECISION (float_type_node)
+ && exact_real_truncate (TYPE_MODE (float_type_node), &orig))
+ type1 = float_type_node;
+ if (TYPE_PRECISION (type1) > TYPE_PRECISION (double_type_node)
+ && exact_real_truncate (TYPE_MODE (double_type_node), &orig))
+ type1 = double_type_node;
+ }
+ tree newtype
+ = (TYPE_PRECISION (TREE_TYPE (@00)) > TYPE_PRECISION (type1)
+ ? TREE_TYPE (@00) : type1);
+ }
+ (if (TYPE_PRECISION (TREE_TYPE (@0)) > TYPE_PRECISION (newtype))
+ (cmp (convert:newtype @00) (convert:newtype @10))))))))
+
(for cmp (eq ne)
(simplify