RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

erifan duke at openjdk.org
Wed Jun 25 10:16:40 UTC 2025


On Wed, 11 Jun 2025 08:51:50 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

>> erifan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Support negating unsigned comparison for BoolTest::mask
>>   
>>   Added a static method `negate_mask(mask btm)` into BoolTest class to
>>   negate both signed and unsigned comparison.
>
> src/hotspot/share/opto/vectornode.cpp line 2237:
> 
>> 2235:       !VectorNode::is_all_ones_vector(in2)) {
>> 2236:     return nullptr;
>> 2237:   }
> 
> This part can be refined more clearly:
> 
> // Swap and put all_ones_vector to right
> if (!VectorNode::is_all_ones_vector(in1)) {
>    swap(in1, in2);
> }
> 
> // uncast mask
> bool need_cast = false;
> if (in1->Opcode() == Op_VectorMaskCast &&
>     in1->outcnt() == 1) {
>     assert(in1->bottom_type()->eq(bottom_type()), "");
>     need_cast = true;
>     in1 = in1->in(1);
> }
> 
> // Check mask cmp pattern
> if (in1->Opcode() != Op_VectorMaskCmp ||
>     in1->outcnt() > 1 ||
>     !in1->as_VectorMaskCmp()->predicate_can_be_negated()) {
>     return nullptr;    
> }
> 
> // Convert VectorMaskCmp + not
> 
> 
> // Cast back
> if (need_cast) {
>   res = new VectorMaskCastNode(phase->transform(res), vect_type());
> }

Done

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24674#discussion_r2166351241


More information about the hotspot-compiler-dev mailing list