RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()
Quan Anh Mai
qamai at openjdk.org
Thu Jan 19 03:54:26 UTC 2023
On Thu, 19 Jan 2023 03:45:43 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:
>> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java line 219:
>>
>>> 217: @ForceInline
>>> 218: public VectorMask<E> indexInRange(int offset, int limit) {
>>> 219: if (offset < 0) {
>>
>> These fast-paths penalise every usage of `VectorMask::indexInRange`, especially the common use case of tail processing an array. So I don't think it is needed, the user can implement it themselves if their use cases find it beneficial. Thanks.
>
> This "offset < 0" path can be optimized out by compiler if the "offset >= 0" in the common cases (i.e. normal loop with no tail loop).
Yes but I don't think it is common enough to deserve special treatment. A fast path should be common for this branch otherwise we are regressing the common path for the corner cases.
-------------
PR: https://git.openjdk.org/jdk/pull/12064
More information about the hotspot-compiler-dev
mailing list