This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 3/5] Rewrite part of and_comparisons_1 into match.pd.
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Martin Liška <mliska at suse dot cz>
- Cc: Richard Biener <rguenther at suse dot de>, Li Jia He <helijia at linux dot ibm dot com>, Andrew Pinski <pinskia at gmail dot com>, Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Segher Boessenkool <segher at kernel dot crashing dot org>, wschmidt at linux dot ibm dot com, Martin Liska <mliska at suse dot de>
- Date: Tue, 10 Sep 2019 13:19:47 +0200 (CEST)
- Subject: Re: [PATCH 3/5] Rewrite part of and_comparisons_1 into match.pd.
- References: <1561615913-22109-1-git-send-email-helijia@linux.ibm.com> <6fb28248-5134-cec5-5045-45253e4d2eb0@redhat.com> <6d333ccf-9905-e929-c2dc-fc611ff929f1@linux.ibm.com> <CA+=Sn1mgUXkEBQTzp5Nv5gcANtpZeutisEtQbez_L7xgg39ppw@mail.gmail.com> <alpine.LSU.2.20.1907010920230.10704@zhemvz.fhfr.qr> <bc69c05f-d966-cab7-b79f-a188523f9258@linux.ibm.com> <alpine.LSU.2.20.1907021007050.2976@zhemvz.fhfr.qr> <alpine.LSU.2.20.1907021031040.2976@zhemvz.fhfr.qr> <845bc280-7bd6-509b-3830-4ebde50f1b20@linux.ibm.com> <nycvar.YFH.7.76.1909051446520.5566@zhemvz.fhfr.qr> <daa3c217-3bfc-086d-da27-175a63da2c59@suse.cz> <c04bad8c-a1ba-239a-9fee-c9dc9be7e3a3@suse.cz> <4efa66d4-c04c-e5a6-18ff-2f4310d7f64d@suse.cz> <3b78e414-ff03-daa8-448f-4eaf766a2635@suse.cz>
- Reply-to: gcc-patches at gcc dot gnu dot org
(some quick comments, I didn't check in details)
+ (and:c (code1 @0 INTEGER_CST@1) (code2 @0 INTEGER_CST@2))
[...]
+ (if (code1 == NE_EXPR && !val) (code2 @0 @2))))))))
How about
(and:c (code1 @0 INTEGER_CST@1) (code2@3 @0 INTEGER_CST@2))
[...]
(if (code1 == NE_EXPR && !val) @3)))))))
instead? This is also a way to check how well the generator handles this,
when @3 may not really exist (was in a gimple_cond).
(and:c (eq@3 @0 INTEGER_CST@1) (code2 @0 INTEGER_CST@2))
could be simplified to
(and @3 (code2 @1 @2))
always (a trivial transform) and let the rest of the machinery fold code2
on constants and then and with a constant. This way you would only need to
handle code1==NE_EXPR in the complicated transform, it might be slightly
more readable. (I am not saying we absolutely have to do it this way, it
is just a suggestion)
+ (and (code1:c @0 INTEGER_CST@1) (code2:c @0 INTEGER_CST@2))
Don't we canonicalize 3 < X to X > 3? That would make the :c unnecessary.
Actually I don't remember how :c works on non-commutative operations
(there was also :C I think).
+ /* Chose the more restrictive of two < or <= comparisons. */
Choose?
--
Marc Glisse