[vectorIntrinsics] RFR: 8283709: Add x86 back-end implementation for bit BIT_COUNT operation [v7]

Sandhya Viswanathan sviswanathan at openjdk.java.net
Fri Apr 8 21:47:14 UTC 2022


On Fri, 8 Apr 2022 19:14:58 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4478:
>> 
>>> 4476: 
>>> 4477: void C2_MacroAssembler::vector_popcount_int(XMMRegister dst, XMMRegister src, XMMRegister xtmp1,
>>> 4478:                                             XMMRegister xtmp2, Register rtmp, int vec_enc) {
>> 
>> Comments need updating. Majority of comments above this method need to move to vector_popcount_byte. And then it is better to give comments at each step below in the method for easy review and maintenance. Please add comments to short, byte, long as well on similar lines.
>
> New code has been modularized byte vector popcount is the leaf level operation and all the other primitive type operation build on top of it.

Without comments around the instructions it is very hard to review what the set of instructions are supposed to do.

>> src/hotspot/cpu/x86/x86.ad line 8637:
>> 
>>> 8635:              VM_Version::supports_avx512_vpopcntdq()) ||
>>> 8636:             (is_subword_type(Matcher::vector_element_basic_type(n->in(1))) &&
>>> 8637:              VM_Version::supports_avx512_bitalg()));
>> 
>> This sort of check is happening multiple times. Should we have a function which takes bt and tells us if vpopcnt instruction is supported for the type.
>
> This is only in couple of predicates, so it think it will not hurt much.

It is about maintenance and review.

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

PR: https://git.openjdk.java.net/panama-vector/pull/185


More information about the panama-dev mailing list