match.pd: Add BIT_FIELD_REF canonicalizations.
authorRichard Biener <rguenther@suse.de>
Tue, 24 Jul 2018 13:29:07 +0000 (13:29 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 24 Jul 2018 13:29:07 +0000 (13:29 +0000)
2018-07-24  Richard Biener  <rguenther@suse.de>

* match.pd: Add BIT_FIELD_REF canonicalizations.

From-SVN: r262946

gcc/ChangeLog
gcc/match.pd

index cf93d5f2a06c9bb34d8f8d7be2f2990979386e24..ff8ed780cf99ae59059e0bc8734027a06da1a411 100644 (file)
@@ -1,3 +1,7 @@
+2018-07-24  Richard Biener  <rguenther@suse.de>
+
+       * match.pd: Add BIT_FIELD_REF canonicalizations.
+
 2018-07-23  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR c/86617
index 730bbabb593f18edae7fa6263475a3ca582ed339..0ae1af0ce06873417d3533aad760b9e3a38a4c3d 100644 (file)
@@ -4658,6 +4658,19 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 
 /* Canonicalizations of BIT_FIELD_REFs.  */
 
+(simplify
+ (BIT_FIELD_REF (BIT_FIELD_REF @0 @1 @2) @3 @4)
+ (BIT_FIELD_REF @0 @3 { const_binop (PLUS_EXPR, bitsizetype, @2, @4); }))
+
+(simplify
+ (BIT_FIELD_REF (view_convert @0) @1 @2)
+ (BIT_FIELD_REF @0 @1 @2))
+
+(simplify
+ (BIT_FIELD_REF @0 @1 integer_zerop)
+ (if (tree_int_cst_equal (@1, TYPE_SIZE (TREE_TYPE (@0))))
+  (view_convert @0)))
+
 (simplify
  (BIT_FIELD_REF @0 @1 @2)
  (switch