This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Optimize certain end of loop conditions into min/max operation
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Michael Collison <michael dot collison at linaro dot org>
- Cc: gcc-patches at gcc dot gnu dot org, Jeff Law <law at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>
- Date: Sat, 19 Sep 2015 00:01:12 +0200 (CEST)
- Subject: Re: [PATCH] Optimize certain end of loop conditions into min/max operation
- Authentication-results: sourceware.org; auth=none
- References: <55B5A884 dot 4060105 at linaro dot org> <CAFiYyc1ObfTFaChzLiAezxEzVziVFnDzCTBhvS0v975-xXRosw at mail dot gmail dot com> <55B65A4B dot 3050705 at redhat dot com> <CAFiYyc2J8zo6cVVSj-06+DHoELacugJTeTz1ezqgva2cD44hYA at mail dot gmail dot com> <55BBA052 dot 2060900 at redhat dot com> <55BBBBE6 dot 2070207 at linaro dot org> <55BBBE2E dot 1020408 at redhat dot com> <55FBAFD1 dot 9080300 at linaro dot org> <alpine dot DEB dot 2 dot 20 dot 1509180850360 dot 1946 at laptop-mg dot saclay dot inria dot fr> <55FC84F2 dot 1060108 at linaro dot org>
- Reply-to: gcc-patches at gcc dot gnu dot org
On Fri, 18 Sep 2015, Michael Collison wrote:
Can you elaborate on merging the patterns using 'ext' as mentioned in your
post? I don't see any documentation or examples.
https://gcc.gnu.org/onlinedocs/gccint/The-Language.html
"for" lets you iterate on several variables at the same time.
For instance,
(for bitop (bit_and bit_ior)
rbitop (bit_ior bit_and)
(simplify
(bitop:c (rbitop:c @0 @1) (bit_not@2 @0))
(bitop @1 @2)))
expands to
(simplify
(bit_and:c (bit_ior:c @0 @1) (bit_not@2 @0))
(bit_and @1 @2))
(simplify
(bit_ior:c (bit_and:c @0 @1) (bit_not@2 @0))
(bit_ior @1 @2))
there are other examples using
(for cmp (eq ne)
icmp (ne eq)
or
(for cmp (simple_comparison)
scmp (swapped_simple_comparison)
and you can have repetitions
(for logs (LOG LOG
LOG2 LOG2
LOG10 LOG10)
exps (SQRT CBRT)
(the iteration wraps around for exps).
--
Marc Glisse