RFR: 8352585: Add special case handling for Float16.max/min x86 backend [v7]
Emanuel Peter
epeter at openjdk.org
Thu Apr 3 09:05:56 UTC 2025
On Tue, 1 Apr 2025 16:17:22 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>> This bugfix patch adds the special handling as per x86 AVX512-FP16 ISA specification[1][2] to compute max/min operations with +/-0.0 or NaN operands.
>>
>> Special handling leverage the instruction semantic, central idea is to shuffle the operands such that smaller input gets assigned to second operand for min operation or a larger input gets assigned to second operand for max operation, in addition result equals NaN if an unordered comparison detects first input as a NaN value else we return the result of min/max operation.
>>
>> Kindly review and share your feedback.
>>
>> Best Regards,
>> Jatin
>>
>> [1] https://www.felixcloutier.com/x86/vminsh
>> [2] https://www.felixcloutier.com/x86/vmaxsh
>
> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>
> Review comments resolution
Testing is green :)
src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 7108:
> 7106: // dst = max(xtmp1, xtmp2)
> 7107: vmaxsh(dst, xtmp1, xtmp2);
> 7108: // isNaN = is_unordered_quite(xtmp1)
Suggestion:
// isNaN = is_unordered_quiet(xtmp1)
Does the Q stand for quiet or quite?
src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 7129:
> 7127: // dst = min(xtmp1, xtmp2)
> 7128: vminsh(dst, xtmp1, xtmp2);
> 7129: // isNaN = is_unordered_quite(xtmp1)
Suggestion:
// isNaN = is_unordered_quiet(xtmp1)
-------------
Marked as reviewed by epeter (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/24169#pullrequestreview-2739047288
PR Review Comment: https://git.openjdk.org/jdk/pull/24169#discussion_r2026532906
PR Review Comment: https://git.openjdk.org/jdk/pull/24169#discussion_r2026533225
More information about the hotspot-compiler-dev
mailing list