On Tue, 15 Feb 2022 08:25:29 GMT, Lutz Schmidt <l...@openjdk.org> wrote:

> Hi Claes, I'm working on the s390 implementation. 

Awesome, thanks!

> 
> Just for clarification: the return value must be the index of the first 
> negative byte?

Yes, or the length if there are no such bytes. 

I've considered (and am still considering) writing the spec of `countPositives` 
to allow intrinsics to do an early return of a value that is less than the 
index if it's prohibitively expensive or complicated to implement the intrinsic 
to be precise in the case where it finds a negative byte. While it must be 
precise w.r.t. returning the full length if it's all positive bytes, no call 
site would break if the intrinsic returned 0 or some convenient number less 
than the first negative index (my first experiments with the x86 intrinsic did 
it like this, but since the semantics of the intrinsic would then differ from 
the java code I was asked to try and make it precise). The aarch64 algorithm is 
proving to be a challenge to work with and I might ask again for some leeway in 
a first implementation there.

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

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

Reply via email to