RFR: 8278868: Add x86 vectorization support for Long.bitCount() [v2]

Jatin Bhateja jbhateja at openjdk.java.net
Tue Dec 21 05:18:16 UTC 2021


On Mon, 20 Dec 2021 19:49:09 GMT, Vamsi Parasa <duke at openjdk.java.net> wrote:

>> Vectorization support of Integer.bitCount() already exists but currently the same support is lacking for Long.bitCount(). Similar to the C2 PopCountVI node, we created a C2 PopCountVL node and used vpopcntq x86 instruction to enable vectorized Long.bitCount(). This patch shows 2.57x improvement in performance on a JMH micro benchmark due to x86 vectorization.
>
> Vamsi Parasa has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add JMH micro benchmark to measure performance

src/hotspot/share/opto/superword.cpp line 2951:

> 2949:   if (VectorNode::is_vpopcntq(use)) {
> 2950:     // VPOPCNTQ takes longs and produces ints - hence the special checks
> 2951:     // on alignment and size.

Use IR node reference instead of target specific instruction.

src/hotspot/share/opto/vectornode.hpp line 517:

> 515: };
> 516: 
> 517: //------------------------------SqrtVFNode--------------------------------------

I think we can remove "I" specialization from existing PopCountVI and make the IR node generic.  It already has a type which should be sufficient to emit type specific instruction. There are many vector node which are common across types.

test/hotspot/jtreg/compiler/vectorization/TestPopCountVectorLong.java line 65:

> 63:     }
> 64: 
> 65:     public void vectorizeBitCount() {

We can add check based on new IR framework here.

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

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


More information about the hotspot-compiler-dev mailing list