This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch 7/8 tree-optimization]: Bitwise not logic for fold_unary_loc.
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Guenther <richard dot guenther at gmail dot com>
- Date: Wed, 13 Jul 2011 09:36:28 +0200
- Subject: [patch 7/8 tree-optimization]: Bitwise not logic for fold_unary_loc.
Hello,
This patch adds support to fold_unary_loc for one-bit precision
typed bitwise-not expression.
ChangeLog
2011-07-13 Kai Tietz <ktietz@redhat.com>
* fold-const.c (fold_unary_loc): Add
support for one-bit bitwise-not optimizeation.
Bootstrapped and regression tested with prior patches of this series
for x86_64-pc-linux-gnu.
Ok for apply?
Regards,
Kai
Index: gcc/gcc/fold-const.c
===================================================================
--- gcc.orig/gcc/fold-const.c 2011-07-13 08:49:50.000000000 +0200
+++ gcc/gcc/fold-const.c 2011-07-13 08:56:45.170171300 +0200
@@ -8094,6 +8094,12 @@ fold_unary_loc (location_t loc, enum tre
if (i == count)
return build_vector (type, nreverse (list));
}
+ if (INTEGRAL_TYPE_P (type) && TYPE_PRECISION (type) == 1)
+ {
+ tem = fold_truth_not_expr (loc, arg0);
+ if (tem)
+ return fold_convert_loc (loc, type, tem);
+ }
return NULL_TREE;