Refine code comments

This commit is contained in:
erfang 2025-12-15 02:54:52 +00:00
parent a14cec2cf9
commit 2ce36c8ddd
3 changed files with 5 additions and 5 deletions

View File

@ -1051,7 +1051,7 @@ Node* VectorNode::Ideal(PhaseGVN* phase, bool can_reshape) {
//
// Due to the unique nature of vector masks, for specific IR patterns,
// VectorMaskCast does not affect the output results. For example:
// (VectorStoreMask (VectorMaskCast ... (VectorLoadMask x))) => (x)
// (VectorStoreMask (VectorMaskCast* (VectorLoadMask x))) => (x)
// x remains to be a bool vector with no changes.
// This function can be used to eliminate the VectorMaskCast in such patterns.
Node* VectorNode::uncast_mask(Node* n) {
@ -1486,7 +1486,7 @@ Node* VectorLoadMaskNode::Identity(PhaseGVN* phase) {
Node* VectorStoreMaskNode::Identity(PhaseGVN* phase) {
// Identity transformation on boolean vectors.
// VectorStoreMask (VectorMaskCast ... VectorLoadMask bv) elem_size ==> bv
// VectorStoreMask (VectorMaskCast* VectorLoadMask bv) elem_size ==> bv
// vector[n]{bool} => vector[n]{t} => vector[n]{bool}
Node* in1 = VectorNode::uncast_mask(in(1));
if (in1->Opcode() == Op_VectorLoadMask && length() == in1->as_Vector()->length()) {
@ -1920,7 +1920,7 @@ Node* VectorMaskOpNode::Ideal(PhaseGVN* phase, bool can_reshape) {
}
Node* VectorMaskCastNode::Identity(PhaseGVN* phase) {
// (VectorMaskCast (VectorMaskCast ... x)) => (x)
// (VectorMaskCast+ x) => (x)
// If the types of the input and output nodes in a VectorMaskCast chain are
// exactly the same, the intermediate VectorMaskCast nodes can be eliminated.
Node* n = VectorNode::uncast_mask(this);

View File

@ -60,7 +60,7 @@ public class VectorMaskCastIdentityTest {
VectorMask<Integer> mInt128 = VectorMask.fromArray(IntVector.SPECIES_128, mr, 0);
mInt128 = mInt128.cast(IntVector.SPECIES_128);
// Insert a not() to prevent the casts being optimized by the optimization:
// (VectorStoreMask (VectorMaskCast ... (VectorLoadMask x))) => x
// (VectorStoreMask (VectorMaskCast* (VectorLoadMask x))) => x
return mInt128.not().trueCount();
}

View File

@ -239,7 +239,7 @@ public class VectorMaskToLongTest {
// Test VectorMask.fromLong().toLong() with Float species.
// For floating-point types, VectorMaskCast is inserted between fromLong and toLong to convert
// between float and integer types. There are two relevant optimizations:
// 1. (VectorStoreMask (VectorMaskCast ... (VectorLoadMask x))) => (x)
// 1. (VectorStoreMask (VectorMaskCast* (VectorLoadMask x))) => (x)
// 2. (VectorMaskToLong (VectorLongToMask x)) => (x)
// The optimization behavior varies by architecture:
// - SVE with bitperm: IR chain is (VectorMaskToLong (VectorStoreMask (VectorMaskCast