RFR: 8279282: [vectorapi] Matcher::supports_vector_comparison_unsigned is not needed on x86

Paul Sandoz psandoz at openjdk.java.net
Wed Jan 5 18:22:20 UTC 2022


On Wed, 5 Jan 2022 10:30:46 GMT, Quan Anh Mai <duke at openjdk.java.net> wrote:

> Hi,
> 
> Currently, unsigned comparison on AVX is implemented by zero extending elements and comparing the results. This leads to unnecessary complexity. This patch changes the implementation to use the identity existing in `Integer/Long.compareUnsigned`, that is `compareUnsigned(x, y) == compare(x ^ min_value, y ^ min_value)`.
> 
> Thank you very much.

src/hotspot/cpu/x86/x86.ad line 7332:

> 7330:             Matcher::vector_length_in_bytes(n->in(1)->in(1)) <= 32 && // src1
> 7331:             is_integral_type(Matcher::vector_element_basic_type(n->in(1)->in(1))) &&
> 7332:             (n->in(2)->get_int() == BoolTest::eq ||

It's tempting to add a method to check the third bit of a `BoolTest` value, which controls the sense of the result e.g. `eq(0)` and `ne(4)`, rather than three separate checks e.g. `is_negated` perhaps. That it turn may result in more clearer naming of the methods rather than using `_pri` and `_sec`, and the logic percolates down into `vpcmpCCW` via the `ComparisonPredicate` value and the use of the tmp register.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6966


More information about the hotspot-compiler-dev mailing list