On Wed, 1 Apr 2026 07:59:01 GMT, Andrew Haley <[email protected]> wrote:
>> Xiaohong Gong has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Add comment
>
> src/hotspot/cpu/aarch64/aarch64.ad line 2692:
>
>> 2690: Node* u = n->unique_out();
>> 2691: if (u->Opcode() == Op_AndVMask) {
>> 2692: return true;
>
> Suggestion:
>
> // Check whether n is only used by an AndVMask node.
> return n->outcnt() == 1 && n->unique_out() == Op_AndVMask;
>
>
> Then you hardly even need a comment.
Hi @theRealAph , I can add more strict condition to clone the `maskAll` node
here, like:
static bool is_vector_mask_bitwise_andnot_pattern(Node* n, Node* m) {
if (n == nullptr || m == nullptr) {
return false;
}
if (n->Opcode() == Op_XorVMask &&
VectorNode::is_all_ones_vector(m)) {
if (n->outcnt() > 1 || n->unique_out()->Opcode() != Op_AndVMask) {
return false;
}
// Another input of the AndVMask should not be a bitwise not pattern.
Node* andVMask = n->unique_out();
Node* other_input = andVMask->in(1) == n ? andVMask->in(2) :
andVMask->in(1);
return !(VectorNode::is_vectormask_bitwise_not_pattern(other_input) &&
other_input->outcnt() == 1);
}
return false;
}
The advantage of this approach is that we can ensure maskAll itself is never
cloned, whereas the downside is that the andNot rule can not be matched
successfully.
There may be other ways to make these rules match together without generating
duplicate machnodes. For example, we could clone a dedicated maskAll at the IR
level for this specific pattern during the final reshaping stage. However, this
feels more like a workaround to satisfy backend match rules, and I am not sure
whether it is an appropriate solution.
Do you have any suggestions or best practices for handling this kind of
situation?
Hi @eme64 , @iwanowww , could I get any suggestions or ideas from your side?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30013#discussion_r3031946067