JDK-8214239 (?): Missing x86_64.ad patterns for clearing and setting long vector bits

John Rose john.r.rose at oracle.com
Fri Nov 8 23:00:52 UTC 2019


On Nov 8, 2019, at 3:40 AM, B. Blaser <bsrbnd at gmail.com> wrote:
> 
> Yes, I'll also consider adding patterns for non-constant masks which
> might help in collections like BitSet or EnumSet (see [1] & [2]) by
> subsuming the shift operation provided that we do successful
> experiments.

Yes.  There’s lots of code like that out there.  If you make a micro
of enum performance, please be aware of this missing bit:
  https://bugs.openjdk.java.net/browse/JDK-8161245

I added you as a watcher.  The problem is that, although an
enum *object* often constant folds, its *ordinal field* fails to constant
fold (last time I looked).  The above is a point fix, but we also need
a more comprehensive fix.

> The range check of LLVM classification switch is somewhat different in
> the sense that it uses BT (bit test) which unfortunately sets uncommon
> flags (CF) instead of regular AND/TEST flags (ZF,...) which might
> require some additional work to replace the existing operations?

That may be.  Flag handling is a tricky part of C2.  I think there are
pre-existing instructions that work with CF which can serves as examples.

FWIW I noticed this as a possibly relevant change to LLVM:
  https://reviews.llvm.org/D48606

> However, the current patch being almost ready to be pushed, I'll look
> at these questions in separate issues.

That makes perfect sense; don’t delay what you have.  If you get stalled on
the follow-up work, please do post your learnings on JBS (like JDK-8214239).

> Thanks for these suggestions,
> Bernard

Thank you for taking this on!

— John

> 
> [1] http://hg.openjdk.java.net/jdk/jdk/file/c709424ad48f/src/java.base/share/classes/java/util/BitSet.java#l452
> [2] http://hg.openjdk.java.net/jdk/jdk/file/c709424ad48f/src/java.base/share/classes/java/util/RegularEnumSet.java#l165
> 
> On Thu, 7 Nov 2019 at 22:59, John Rose <john.r.rose at oracle.com> wrote:
>> 
>> Would you consider adding patterns for non-constant masks also?
>> It would be something like (And (LShift n) x), etc.
>> It could be in this set or in an a follow-on.
>> Thanks (says John who always wants more).



More information about the hotspot-compiler-dev mailing list