FS_OPT_MUX_TO_SHR, /**< Mux(a > b, a, b) = a >> b */
FS_OPT_IDEM_UNARY, /**< Idempotent unary operation */
FS_OPT_MINUS_NOT, /**< -(~x) = x + 1 */
- FS_OPT_NOT_MINUS_1, /**< ~(x-1) = -x */
+ FS_OPT_NOT_MINUS_1, /**< ~(x - 1) = -x */
+ FS_OPT_NOT_PLUS_1, /**< ~x + 1 = -x */
FS_OPT_CONST_PHI, /**< Constant evaluation on Phi */
FS_BE_IA32_LEA, /**< Lea was created */
FS_BE_IA32_LOAD_LEA, /**< Load merged with a Lea */
DBG_OPT_ALGSIM0(oldn, n, FS_OPT_ADD_MUL_A_X_A);
}
}
+ /* Here we rely on constants be on the RIGHT side */
+ else if (is_Not(a) && classify_Const(b) == CNST_ONE) {
+ /* ~x + 1 = -x */
+ ir_node *op = get_Not_op(a);
+ ir_node *blk = get_irn_n(n, -1);
+ n = new_rd_Minus(get_irn_dbg_info(n), current_ir_graph, blk, op, mode);
+ DBG_OPT_ALGSIM0(oldn, n, FS_OPT_NOT_PLUS_1);
+ }
}
return n;
} /* transform_node_Add */
{ FS_OPT_MUX_TO_SHR, "algebraic simplification: Mux(a > b, a, b) = a >> b" },
{ FS_OPT_IDEM_UNARY, "algebraic simplification: Idempotent unary operation" },
{ FS_OPT_MINUS_NOT, "algebraic simplification: -(~x) = x + 1" },
- { FS_OPT_NOT_MINUS_1, "algebraic simplification: ~(x-1) = -x" },
+ { FS_OPT_NOT_MINUS_1, "algebraic simplification: ~(x - 1) = -x" },
+ { FS_OPT_NOT_PLUS_1, "algebraic simplification: ~x + 1 = -x" },
{ FS_OPT_CONST_PHI, "constant evaluation on Phi node" },
{ FS_BE_IA32_LEA, "ia32 Backend transformation: Lea was created" },
{ FS_BE_IA32_LOAD_LEA, "ia32 Backend transformation: Load merged with a Lea" },