RFR: 8318827: RISC-V: Improve readability of fclass result testing
Ludovic Henry
luhenry at openjdk.org
Wed Oct 25 15:24:35 UTC 2023
On Wed, 25 Oct 2023 14:42:07 GMT, Feilong Jiang <fjiang at openjdk.org> wrote:
> Hi, please consider.
>
> Currently, we test results of `fclass` instruction with hard-coded bits which has bad readability. This patch adds an enumeration of the flcass mask bits for ease of use.
>
> Testing:
>
> - [ ] tier1 with release build
src/hotspot/cpu/riscv/assembler_riscv.hpp line 1094:
> 1092: FCLASS_NAN = FCLASS_SNAN | FCLASS_QNAN,
> 1093: FCLASS_FINITE = FCLASS_ZERO | FCLASS_SUBNORM | FCLASS_NORM,
> 1094: };
We use lower-case and no prefix for similar enums (ex: https://github.com/openjdk/jdk/blob/069bb87693ec7944f08062e3a7e460653324e6cb/src/hotspot/cpu/riscv/assembler_riscv.hpp#L1119-L1145)
Suggestion:
enum fclass_mask {
minf = 1 << 0, // negative infinite
mnorm = 1 << 1, // negative normal number
msubnorm = 1 << 2, // negative subnormal number
mzero = 1 << 3, // negative zero
pzero = 1 << 4, // positive zero
psubnorm = 1 << 5, // positive subnormal number
pnorm = 1 << 6, // positive normal number
pinf = 1 << 7, // positive infinite
snan = 1 << 8, // signaling NaN
qnan = 1 << 9, // quiet NaN
zero = mzero | pzero,
subnorm = msubnorm | psubnorm,
norm = mnorm | pnorm,
inf = minf | pinf,
nan = snan | qnan,
finite = zero | subnorm | norm,
};
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16362#discussion_r1371949559
More information about the hotspot-dev
mailing list