RFR: 8290034: Auto vectorize reverse bit operations.
Xiaohong Gong
xgong at openjdk.org
Tue Jul 19 07:58:04 UTC 2022
On Mon, 18 Jul 2022 08:01:09 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
> Summary of changes:
> - Intrinsify scalar bit reverse APIs to emit efficient instruction sequence for X86 targets with and w/o GFNI feature.
> - Handle auto-vectorization of Integer/Long.reverse bit operations.
> - Backend implementation for these were added with 4th incubation of VectorAPIs.
>
> Following are performance number for newly added JMH mocro benchmarks:-
>
>
> No-GFNI(CLX):
> =============
> Baseline:
> Benchmark (size) Mode Cnt Score Error Units
> Integers.reverse 500 avgt 2 1.085 us/op
> Longs.reverse 500 avgt 2 1.236 us/op
> WithOpt:
> Benchmark (size) Mode Cnt Score Error Units
> Integers.reverse 500 avgt 2 0.104 us/op
> Longs.reverse 500 avgt 2 0.255 us/op
>
> With-GFNI(ICX):
> ===============
> Baseline:
> Benchmark (size) Mode Cnt Score Error Units
> Integers.reverse 500 avgt 2 0.887 us/op
> Longs.reverse 500 avgt 2 1.095 us/op
>
> Without:
> Benchmark (size) Mode Cnt Score Error Units
> Integers.reverse 500 avgt 2 0.037 us/op
> Longs.reverse 500 avgt 2 0.145 us/op
>
>
> Kindly review and share feedback.
>
> Best Regards,
> Jatin
Common codes looks good to me. Just some style issues.
src/hotspot/share/opto/subnode.cpp line 1917:
> 1915: const TypeInt* t1int = t1->isa_int();
> 1916: if (t1int && t1int->is_con()) {
> 1917: jint res = reverse_bits(t1int->get_con());
There is one more space between `res = reverse_bits`
src/hotspot/share/opto/subnode.cpp line 1924:
> 1922:
> 1923: const Type* ReverseLNode::Value(PhaseGVN* phase) const {
> 1924: const Type *t1 = phase->type( in(1) );
The same with `"ReverseINode::Value"`
src/hotspot/share/opto/subnode.cpp line 1930:
> 1928: const TypeLong* t1long = t1->isa_long();
> 1929: if (t1long->is_con()) {
> 1930: jint res = reverse_bits(t1long->get_con());
ditto
-------------
PR: https://git.openjdk.org/jdk/pull/9535
More information about the hotspot-compiler-dev
mailing list