RFR: 8306302: C2 Superword fix: use VectorMaskCmp and VectorBlend instead of CMoveVF/D

Fei Gao fgao at openjdk.org
Thu May 11 08:26:48 UTC 2023


On Thu, 11 May 2023 04:11:16 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/superword.cpp line 2855:
>> 
>>> 2853:           //
>>> 2854:           // The VectorMaskCmpNode does a comparison directly on in1 and in2, in the java
>>> 2855:           // standard way (all comparisons are ordered, except NEQ is unordered).
>> 
>> Sorry, I'm a bit confusing about the comment here. Based on your following description, are `LT` and `LE` unordered either?
>
> @fg1417 thanks for the suggestion about running with the flags over all jtreg. I'll do that now...

> The issue is this: `CmpF -> Bool [lt/le]` is unordered, because they both accept the return code `-1` from the `CmpF`, which also makes comparisons with `NaN` true. This means that such comparisons are `unordered`.
> 
> But `VectorMaskCmp` would interpret `lt/le` test-codes as `ordered`, so they would return false for `NaN` comparisons. So that is why we need to make a transformation here.
> 
> How would you improve my comments?

Thanks for your clarification.

Your comment is quite clear already. Maybe just highlight the mismatch between `VectorMaskCmp` and `bol_test` here, like:

          //
          // But with these two cases, which `VectorMaskCmp` interprets as ordered,
          // we must convert the unordered into an ordered comparison:
          //   BoolTest::lt:  Case -1    -> LT_U
          //   BoolTest::le:  Case -1, 0 -> LE_U
          //

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13493#discussion_r1190808991


More information about the hotspot-compiler-dev mailing list