On Mon, 24 Aug 2026 07:18:21 GMT, Dingli Zhang <[email protected]> wrote:
>> src/hotspot/cpu/riscv/riscv_v.ad line 4642:
>>
>>> 4640: instruct vmask_xnorI(vRegMask dst, vRegMask src1, vRegMask src2,
>>> immI_M1 m1) %{
>>> 4641: match(Set dst (XorVMask (XorVMask src1 src2) (MaskAll m1)));
>>> 4642: match(Set dst (XorVMask src1 (XorVMask src2 (MaskAll m1))));
>>
>> Question: There are two matchings for this instruct. But seems the newly-add
>> IR test only covered one of them, right? I am wondering if we really need
>> both of them.
>
> Thanks for checking. Both matches are intentional and are exercised by
> different tests.
> The first pattern:
>
> (XorVMask (XorVMask src1 src2) (MaskAll m1))
>
> corresponds to `avm.xor(bvm).not()` and is covered by `testMaskXnorI`.
>
> The second pattern:
>
> (XorVMask src1 (XorVMask src2 (MaskAll m1)))
>
> corresponds to `avm.eq(bvm)` and is covered by `testMaskEqI`.
> `AbstractMask::eq()` is implemented as `return xor(m.not());`, which produces
> this second shape.
>
> C2 does not currently reassociate these two `XorVMask` shapes, so both match
> patterns are needed.
OK. That makes sense to me.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/32480#discussion_r3841806111