This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Optimize a >= 0 && a < b if VR info says b >= 0 (PR tree-optimization/77664)


On Thu, 6 Oct 2016, Jakub Jelinek wrote:

For signed a, if we see a >= 0 && a < b and from VR know that b >= 0,
we can optimize those 2 comparisons into one unsigned -
(unsigned) a < (unsigned) b.  Similarly for a < 0 || a > b (and also
for a <= b in the first and a >= b in the second).

I guess that the slightly more general:
X >= A && X < B where we know that A <= B
--> (unsigned)X - (unsigned)A < (unsigned)B - (unsigned)A

generates too many operations and does not gain anything? The case where A and B are constants seems to be handled by ifcombine, currently.

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]