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]

Re: [Patch] PR67351 Implement << N & >> N optimizers


+/* Optimize (x >> c) << c into x & (-1<<c).  */
+(simplify
+ (lshift (rshift @0 INTEGER_CST@1) @1)
+ (if (tree_fits_uhwi_p (@1)
+      && tree_to_uhwi (@1) < TYPE_PRECISION (type))
+  (bit_and @0 (lshift { build_minus_one_cst (type); } @1))))

It looks like vectors might match, so please use element_precision instead of TYPE_PRECISION, as in the fold-const.c code you are converting from.

--
Marc Glisse


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