This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 4/4 v3][PR 67328] Optimize some masked comparisons to efficient bittest
- From: Richard Biener <rguenther at suse dot de>
- To: Yuri Gribov <tetra2005 at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Alan Modra <amodra at gmail dot com>, rguenth at gcc dot gnu dot org
- Date: Wed, 31 May 2017 13:19:20 +0200 (CEST)
- Subject: Re: [PATCH 4/4 v3][PR 67328] Optimize some masked comparisons to efficient bittest
- Authentication-results: sourceware.org; auth=none
- References: <CAJOtW+4i56i_F-8NEQKR3E6PDjY4n+2PbKWtEi51X4EjgdRQjQ@mail.gmail.com>
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.