On Tue, 17 Oct 2023 09:52:15 GMT, Ilya Gavrilin <igavri...@openjdk.org> wrote:
>> src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp line 1682: >> >>> 1680: // use floating-point 1.0 with a sign of input >>> 1681: is_double ? fsgnj_d(dst, one, src) >>> 1682: : fsgnj_s(dst, one, src); >> >> What if the `src` argument contains zero? Math.signum(float/double) is >> supposed to return zero if the argument is zero [1]. >> >> [1] >> https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/Math.java#L2602 > > According to IEEE754, we can get positive or negative zero in the `src` > register (also positive zero can be named as zero) , and these cases included > to mask for the tmp1 (L1671-1676) and `src` value returned. I see. Thanks for the answer. I can approve this once my other comments are resolved. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16186#discussion_r1363440282