RFR: 8275643: C2's unaryOp vector intrinsic does not properly handle LongVector.neg
Tobias Hartmann
thartmann at openjdk.java.net
Wed Nov 17 11:48:49 UTC 2021
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
-------------
Commit messages:
- 8275643: C2's unaryOp vector intrinsic does not properly handle LongVector.neg
Changes: https://git.openjdk.java.net/jdk/pull/6428/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6428&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8275643
Stats: 51 lines in 2 files changed: 51 ins; 0 del; 0 mod
Patch: https://git.openjdk.java.net/jdk/pull/6428.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/6428/head:pull/6428
PR: https://git.openjdk.java.net/jdk/pull/6428
More information about the hotspot-dev
mailing list