RFR: 8360116: Add support for AVX10 floating point minmax instruction [v2]
Manuel Hässig
mhaessig at openjdk.org
Thu Jun 26 09:09:36 UTC 2025
On Thu, 26 Jun 2025 08:43:27 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>> src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 1246:
>>
>>> 1244: opc == Op_MaxV || opc == Op_MaxReductionV, "sanity");
>>> 1245: if (elem_bt == T_FLOAT) {
>>> 1246: evminmaxps(dst, mask, src1, src2, true, opc == Op_MinV || opc == Op_MinReductionV ? 0x4 : 0x5, vlen_enc);
>>
>> Perhaps `0x4` and `0x5` should be factored into named constants since they are used in multiple places and it would also help readability if one does not have the documentation handy when reading the code.
>
> Hi @mhaessig ,
> Command bits are in accordance with Tables 11.1 and 11.2 of section 11.2. First 2 bits [1:0] signify the operation kind, 00 for min and 01 for max. Next two bits [3:2] signify the sign selection logic and 4th bit 0 for both min/max, with this command word we can emulate the semantics of Math.max/min using a single AVX10 instruciton.
I got that from the documentation you kindly linked in the description. My question was rather to define a constant like `AVX10_MINMAX_MAX_COMPARE_SIGN = 0x5` that can be used instead of the plain magic numbers. Because people looking at the code later will not have the "luxury" of being provided a link to the relevant documentation right when puzzling about what `0x4` means in this case.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25914#discussion_r2168582443
More information about the hotspot-dev
mailing list