[12] RFR(M): 8210215: C2 should optimize trichotomy calculations
Tobias Hartmann
tobias.hartmann at oracle.com
Wed Sep 26 08:25:17 UTC 2018
Hi John,
thanks for looking at this again!
On 26.09.2018 01:57, John Rose wrote:
> `res[9][9]` should be `res[illegal+1][illegal+1]` and should have rows and columns for `never`
> (code smell: `9` is a naked constant; makes it hard to tell your table is out of date)
Right, I've updated the table.
> In the test cases `compare1` has `(a < b) ? -1 : (a == b) ? 0 : 1`.
> Shouldn’t you also test `(a < b) ? -1 : (a <= b) ? 0 : 1`?
> And similarly, for other cases where the second test overlaps
> with the first.
I did not add tests for all the 6² operator combinations but I think more overlapping tests won't
hurt. I've added
(a < b) ? -1 : (a <= b) ? 0 : 1;
(a > b) ? 1 : (a >= b) ? 0 : -1;
(a == b) ? 0 : (a <= b) ? -1 : 1;
(a == b) ? 0 : (a >= b) ? 1 : -1;
and verified that all inlined comparisons fold.
Here's the new webrev:
http://cr.openjdk.java.net/~thartmann/8210215/webrev.01/
Thanks,
Tobias
More information about the hotspot-compiler-dev
mailing list