Integrated: 8275643: C2's unaryOp vector intrinsic does not properly handle LongVector.neg

Tobias Hartmann thartmann at openjdk.java.net
Fri Nov 19 07:10:49 UTC 2021


On Wed, 17 Nov 2021 11:41:04 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

> Code in `LongVector::lanewiseTemplate` currently implements the `NEG` operation as a `SUB` and has a corresponding `FIXME` comment:
> https://github.com/openjdk/jdk/blob/e9934e1243929514e147ecdd3cefa74168ed0500/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java#L534-L541
> 
> The implicit assumption is that since we will never pass `NEG` to `VectorSupport.unaryOp` in line 540, the corresponding C2 intrinsic does not need to handle that case. That's not guaranteed though because C2 might still compile that path when not being able to prove that it's unreachable at parse time. As a result, we then assert in the intrinsic because the negation operation on a long vector is currently not supported (i.e. there is no `Op_NegVL`). I propose to simply handle this case in ` VectorSupport::vop2ideal`. We will then bail out from intrinsification with `operation not supported: opc=NegL bt=long` because `VectorNode::opcode` returns 0:
> https://github.com/openjdk/jdk/blob/e9934e1243929514e147ecdd3cefa74168ed0500/src/hotspot/share/opto/vectorIntrinsics.cpp#L390-L394
> 
> Question to the Vector API experts: There are other `FIXME: Support this in the JIT` comments in the code. Do these code paths suffer from similar issues? Is there a tracking RFE/bug?
> 
> Thanks,
> Tobias

This pull request has now been integrated.

Changeset: 47564cae
Author:    Tobias Hartmann <thartmann at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/47564caeb0628e5c03a0e7f04093adce77d6dd3b
Stats:     51 lines in 2 files changed: 51 ins; 0 del; 0 mod

8275643: C2's unaryOp vector intrinsic does not properly handle LongVector.neg

Reviewed-by: chagedorn, sviswanathan

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

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


More information about the hotspot-dev mailing list