RFR: 8370481: C2 SuperWord: Long/Integer.compareUnsigned return wrong value in SLP [v8]

Hamlin Li mli at openjdk.org
Tue Oct 28 09:56:54 UTC 2025


> Hi,
> Can you help to review the patch? @eme64 
> 
> ##  Issue
> 
> Currently, in SLP when transform from (Bool + CmpU + CMove) to (VectorMaskCmp + VectorBlend), the unsigned-ness in CmpU is lost, then end up doing a signed instead of unsigned comparison in VectorMaskCmp.
> For details please check code at `SuperWordVTransformBuilder::make_vector_vtnode_for_pack` and `PackSet::get_bool_test`.
> 
> ##  Fix
> Currently, `BoolTest` does not support an unsigned construction (`BoolTest( mask btm ) : _test(btm) { assert((btm & unsigned_compare) == 0, "unsupported");}`), seems to me a feasible solution would be get the unsigned information from CmpU (which could be an input of Bool) and pass it to VectorMaskCmp.
> 
> Thanks
> 
> This pr could also lead to more optimizations, like: https://github.com/openjdk/jdk/pull/25336 and https://github.com/openjdk/jdk/pull/25341.

Hamlin Li has updated the pull request incrementally with two additional commits since the last revision:

 - Update src/hotspot/share/opto/superword.cpp
   
   Co-authored-by: Emanuel Peter <emanuel.peter at oracle.com>
 - Update src/hotspot/share/opto/superword.cpp
   
   Co-authored-by: Emanuel Peter <emanuel.peter at oracle.com>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27942/files
  - new: https://git.openjdk.org/jdk/pull/27942/files/ecb38321..b356d39e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27942&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27942&range=06-07

  Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/27942.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27942/head:pull/27942

PR: https://git.openjdk.org/jdk/pull/27942


More information about the hotspot-compiler-dev mailing list