RFR: 8370481: C2 SuperWord: Long/Integer.compareUnsigned return wrong value in SLP [v2]
    Hamlin Li 
    mli at openjdk.org
       
    Thu Oct 23 12:41:11 UTC 2025
    
    
  
On Thu, 23 Oct 2025 11:20:31 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Hamlin Li has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - tests
>>  - switch
>
> src/hotspot/share/opto/superword.cpp line 1755:
> 
>> 1753:     mask = BoolTest::unsigned_mask(mask);
>> 1754:     break;
>> 1755:   } // switch
> 
> Given that we just missed some cases in the old "if": you should definitively have a `default` case, that hits an assert. That way, we don't have missing cases that silently do the wrong thing.
Not sure I understand you correctly.
Do you mean add some code like below?
@@ -1752,6 +1752,8 @@ VTransformBoolTest PackSet::get_bool_test(const Node_List* bool_pack) const {
   case Op_CmpUL3:
     mask = BoolTest::unsigned_mask(mask);
     break;
+  default:
+    ShouldNotReachHere(); // or assert
   } // switch
But besides of Op_CmpF/D, Op_CmpUxx, there could be other Cmp ops call into `PackSet::get_bool_test`.
Or maybe I misunderstood you?
> test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java line 743:
> 
>> 741:             r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd;
>> 742:         }
>> 743:     }
> 
> Why does this not vectorize, but `testCMoveUIGTforF` does? Is that not strange?
These test cases are converted from signed ones above, for example `testCMoveUIGTforI` is from `testCMoveIGTforI`.
To answer your question, I think the reason is at the comment above `testCMoveIGTforI`.
In https://github.com/openjdk/jdk/pull/25336, I'm going to enable this vectorization, but previously https://github.com/openjdk/jdk/pull/25336 was blocked by unsigned comparison issue (check the discussion at: https://github.com/openjdk/jdk/pull/25336#discussion_r2123518238).
With this pr pushed in, I think I can restart the work of https://github.com/openjdk/jdk/pull/25336.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27942#discussion_r2454988006
PR Review Comment: https://git.openjdk.org/jdk/pull/27942#discussion_r2454985371
    
    
More information about the hotspot-compiler-dev
mailing list