RFR: 8302908: RISC-V: Support masked vector arithmetic instructions for Vector API [v12]

Dingli Zhang dzhang at openjdk.org
Tue Apr 18 06:36:50 UTC 2023


On Mon, 17 Apr 2023 13:53:02 GMT, Dingli Zhang <dzhang at openjdk.org> wrote:

>> Hi, @DingliZhang, I have the same concern here. As the scalar version of Float-point comparison, we have `is_unordered` flag to return the right result if operands contain NaN(s) [1]. Does vfcmp need this flag too?
>> 
>> Also, I see an example of implementing `isgreater()` when operands contain NaN(s) for vfcmp [2], which checks NaN for both operands.
>> 
>> 1. https://github.com/openjdk/jdk/blob/7f56de8f78c0b54e5cf313f53213102a3495234f/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L1010-L1037
>> 2. https://github.com/riscv/riscv-v-spec/blob/b9afd6f5709fe3f91ce39bb83695bcfaa78eef94/v-spec.adoc?plain=1#L3700-L3706
>
> Hi @feilongjiang , thanks for the view!
> 
> I think maybe we don't need to distinguish whether it is unordered or not here at the moment. For example, the aarch64 greater(than) or less(than) comparison of sve_comapre[1] in the vmaskcmp call uses the GE/GT[2][3] in the Assembler condition to make the determination (instead of using the LE/LT flag bits, which would include unordered as well).
> 
> The most obvious difference in the results between the sequence of `isgreater()`[4] and the sequence of this patch is that `isgreater()` does not set the invalid operation exception flag (NV=1) if operands contain NaN(s). It seems that we would be better to use the sequence like `isgreater()`  for the case if operands contain NaN(s).
> 
> We will update PR later.
> 
> [1] https://github.com/openjdk/jdk/blob/2b81faeb3514060e6c8c950ef4e39e299c43199d/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp#L1127-L1143
> [2] https://developer.arm.com/documentation/ddi0596/2021-12/Shared-Pseudocode/Shared-Functions?lang=en#impl-shared.FPCompareGE.3
> [3] https://developer.arm.com/documentation/ddi0596/2021-12/Shared-Pseudocode/Shared-Functions?lang=en#impl-shared.FPCompareGT.3
> [4] https://github.com/riscv/riscv-v-spec/blob/b9afd6f5709fe3f91ce39bb83695bcfaa78eef94/v-spec.adoc?plain=1#L3700-L3706

Fixed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/12682#discussion_r1169557323


More information about the hotspot-compiler-dev mailing list