This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]