RFR: 8297753: AArch64: Add optimized rules for vector compare with zero on NEON [v4]

Chang Peng duke at openjdk.org
Fri Feb 10 04:23:48 UTC 2023


On Fri, 10 Feb 2023 03:53:03 GMT, Chang Peng <duke at openjdk.org> wrote:

>> src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp line 976:
>> 
>>> 974:       case BoolTest::gt: fcm(Assembler::GT, dst, size, src); break;
>>> 975:       case BoolTest::le: fcm(Assembler::LE, dst, size, src); break;
>>> 976:       case BoolTest::lt: fcm(Assembler::LT, dst, size, src); break;
>> 
>> The key to this problem of endless switch statements is a function from `BoolTest` cond to `Assembler::Condition`.
>> 
>> Such a function is `cmpOpOper(BoolTest::overflow).ccode()` .
>> 
>> Please use it everywhere a `BoolTest` needs to be converted to a `Condition`.
>
> Thanks for pointing this usage, I didn't know that before. I found that cmpOpOper is generated by cmpOp operand defined in aarch64.ad, and it is able to convert input BoolTest condition and Assembler condition. However, the vector compare operand in VectorMaskCmp is ConINode, while cmpOp operand can only match BoolNode. How about adding a new standalone function like x86 https://github.com/openjdk/jdk/blob/e245620f6f6a836aef8ddef9f699cc540f2a5eb6/src/hotspot/cpu/x86/x86.ad#L2498 to convert from BoolTest to Assembler::Condition?

Maybe we can use cmpOpOper by following way in aarch64_vector.ad:


Assembler::Condition condition = (Assembler::Condition)(cmpOpOper((BoolTest::mask) (int)($cond$$constant)).ccode());


but I think this code style is a little ugly and cmpOpOper should be used as a operand but not a utility.

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

PR: https://git.openjdk.org/jdk/pull/11822


More information about the hotspot-compiler-dev mailing list