Hello, this patch implements the X op !X patterns within tree-ssa-forwprop.c without using here const-fold routines. Additionally it does some trivial folding for X op X. Implementation also looks through [(type)] X op [(type)] !X, if type of X is integral and precision is suitable for operation. ChangeLog gcc/ 2011-06-28 Kai Tietz * tree-ssa-forwprop.c (operand_precision_onep): New function. (find_possible_not_expr_argument): Likewise. (simplify_bitwise_binary_1): Likewise. (simplify_bitwise_binary): Use simplify_bitwise_binary_1 for detecting various X op !X optimizations. ChangeLog gcc/testsuite 2011-06-28 Kai Tietz * gcc.dg/binop-notand1a.c: New test. * gcc.dg/binop-notand2a.c: New test. * gcc.dg/binop-notand3a.c: New test. * gcc.dg/binop-notand4a.c: New test. * gcc.dg/binop-notand5a.c: New test. * gcc.dg/binop-notand6a.c: New test. * gcc.dg/binop-notor1.c: New test. * gcc.dg/binop-notor2.c: New test. * gcc.dg/binop-notxor1.c: New test. * gcc.dg/binop-notxor2.c: New test. Bootstrapped and regression tested for all languages plus Ada and Obj-C for x86_64-pc-linux-gnu. Ok for apply? Regards, Kai