diff mbox

[7/8,tree-optimization] : Bitwise not logic for fold_unary_loc.

Message ID CAEwic4YvxPwFujYeM_FejsaEUCgMH+48p5iLLDqH2D9hGOTvHQ@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz July 13, 2011, 7:36 a.m. UTC
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

Comments

Richard Biener July 13, 2011, 10:31 a.m. UTC | #1
On Wed, Jul 13, 2011 at 9:36 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
> Hello,
>
> This patch adds support to fold_unary_loc for one-bit precision
> typed bitwise-not expression.

Similar ...

> 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;
>
diff mbox

Patch

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;