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 4/4 v3][PR 67328] Optimize some masked comparisons to efficient bittest


On Mon, 29 May 2017, Yuri Gribov wrote:

> This no longer fixes the PR but still works in some cases as
> demonstrated by the test. So I decided to keep it.

As Richard noticed you don't need widest_ints but can use wide_ints.
Please use == 0 instead of ! on wide-ints as well.

+(for cmp (le gt)
+ (simplify
..
+      (switch
+       (if (cmp == LE_EXPR)
+       (eq:type (bit_and @1 { wide_int_to_tree (ty, hi_bits); }) { 
build_zero_cst (ty); }))
+       (if (cmp == GT_EXPR)
+       (ne:type (bit_and @1 { wide_int_to_tree (ty, hi_bits); }) { 
build_zero_cst (ty); })))))))))

long lines plus you can simplify this with using

 (for cmp (le gt)
      eqcmp (eq ne)
 ...

     (eqcmp (bit_and @1 { wide_int_to_tree (ty, hi_bits); }) 
{build_zero_cst (ty); }))))

no need to spell out :type on the result as well.

Richard.


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