On Mon, 15 May 2023 08:56:37 GMT, Andrew Haley <a...@openjdk.org> wrote:
> That makes sense. Is it likely that there are more of these combined > operations on vector masks that could be matched? if so, it might make sense > to do the job earlier, in the C2 optimizer. Thanks for your review. I have tried to optimize ```VectorMask.firstTrue()``` [1] and ```VectorMask.lastTrue()``` [2] in the same way as this patch, but these two operations are strong correlated with xtn, we cannot simply remove it. I didn't find a way to optimize these two operations, they are hignly optimized in C2 backend and there are not extra instructions. [1]: https://github.com/openjdk/jdk/blob/8d49ba9e8d3095f850b3007b56488a0c0cf8ddff/src/hotspot/cpu/aarch64/aarch64_vector.ad#L5517 [2]: https://github.com/openjdk/jdk/blob/8d49ba9e8d3095f850b3007b56488a0c0cf8ddff/src/hotspot/cpu/aarch64/aarch64_vector.ad#L5624 ------------- PR Comment: https://git.openjdk.org/jdk/pull/13974#issuecomment-1547484838