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: Alan Lawrence <alan dot lawrence at arm dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Michael Collison <michael dot collison at linaro dot org>, gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 05 Aug 2015 17:07:56 +0100
- 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>
Richard Biener wrote:
Furthermore it doesn't work for three such ops which would require
an additional pattern like
(simplfiy
(bit_and:c (op @0 (min @1 @2)) (op @0 @3))
(op @0 (min (min @1 @2) @3))))
if that's profitable?
Shouldn't that be just a case of binding @1 in the original pattern:
+/* Transform (@0 < @1 and @0 < @2) to use min */
+(for op (lt le)
+(simplify
+(bit_and:c (op @0 @1) (op @0 @2))
>> +(if (INTEGRAL_TYPE_P (TREE_TYPE (@0)))
>> +(op @0 (min @1 @2)))))
to (min @1 @2) in your three-way pattern, @2 in the original to @3 in yours, and
@0 to @0 ?
Or is @1 not allowed to bind to a 'min' ?
Secondly: should/can Michael's fix reference PR57600 ?
Cheers,
Alan