On Thu, Sep 11, 2025 at 3:16 PM Matteo Nicoli
<matteo.nicoli...@gmail.com> wrote:
>
> I am writing this follow-up email to specify that I executed the tests 
> contained in this patch on aarch64-arm64-linux-gnu

The changelog part of the commit message is formatted wrongly.

  * gcc/match.pd: added the following optimizations for bitwise operations:
    - (a != b) & ((a|b) != 0) -> (a != b)

all lines should be indented exactly by 1 tab, the 'gcc/' part is
superfluous, it
should be just '* match.pd'

  * gcc.dg/int-bwise-opt-1.c: Tests the following optimisation patterns:
    - (a != b) & ((a|b) != 0) -> (a != b)

Likewise for the indenting.

+(simplify
+ (bit_and:c (ne:c @0 @1) (ne:c (bit_ior @0 @1) integer_zerop))
+ (ne:c @0 @1))

The ':c' on the != 0 is superfluous.  Canonicalization guarantees constants
are ordered second.  The :c on the simplification result is useless.  So:

(simplify
 (bit_and:c (ne:c @0 @1) (ne (bit_ior @0 @1) integer_zerop))
 (ne @0 @1))

+(simplify
+ (bit_and:c (ne:c @0 @1) (eq:c (bit_ior @0 @1) integer_zerop))
+ { integer_zero_node; })
+(simplify
+ (bit_ior:c (eq:c @0 @1) (ne:c (bit_ior @0 @1) integer_zerop))
+ { integer_one_node; })

Using integer_zero/one_node is wrong, you should use
build_zero_cst (type); and build_one_cst (type) instead to get
appropriately typed results.  This probably means you do not have
coverage for these cases.

Otherwise this looks OK to me.

Thanks,
Richard.

> Best regards,
> Matteo
>
>
> On Sep 9, 2025, at 10:39 PM, Matteo Nicoli <matteo.nicoli...@gmail.com> wrote:
>
> Dear reviewers,
>
> I attached the patch for this Bugzilla issue: 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117760
> I also attached an SMT file for the formal verifications of these properties. 
> At the bottom of the file I pasted its output (executed with Z3).
>
> Best regards,
> Matteo
>
> <117760.smt2>
> <tree-optimization-117760.patch>
>
>

Reply via email to