fpu/softfloat: set invalid excp flag for RISC-V muladd instructions
PATCH v2 1/1 fpu/softfloat: set invalid excp flag for RISC-V muladd instructions
From: Frank Chang <[email protected]>
In IEEE 754-2008 spec:
Invalid operation exception is signaled when doing:
fusedMultiplyAdd(0, Inf, c) or fusedMultiplyAdd(Inf, 0, c) unless c is a quiet NaN; if c is a quiet NaN then it is implementation defined whether the invalid operation exception is signaled.
In RISC-V Unprivileged ISA spec:
The fused multiply-add instructions must set the invalid operation exception flag when the multiplicands are Inf and zero, even when the addend is a quiet NaN.
This commit set invalid operation execption flag for RISC-V when multiplicands of muladd instructions are Inf and zero.
--- fpu/softfloat-specialize.c.inc | 6 ++++++ 1 file changed, 6 insertions(+)
fpu/softfloat-specialize.c.inc +6 -0
@@ -624,6 +624,12 @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls, } else { return 1; } +#elif defined(TARGET_RISCV) + /* For RISC-V, InvalidOp is set when multiplicands are Inf and zero */ + if (infzero) { + float_raise(float_flag_invalid, status); + } + return 3; /* deafult NaN */ #elif defined(TARGET_XTENSA) /* * For Xtensa, the (inf,zero,nan) case sets InvalidOp and returns
Signature · 1 line
2.17.1
Quoted 14 lines · On 4/19/21 6:31 PM, [email protected] wrote:
From: Frank Chang<[email protected]>
In IEEE 754-2008 spec:
Invalid operation exception is signaled when doing:
fusedMultiplyAdd(0, Inf, c)orfusedMultiplyAdd(Inf, 0, c)unless c is a quiet NaN; if c is a quiet NaN then it is implementation defined whether the invalid operation exception is signaled.In RISC-V Unprivileged ISA spec:
The fused multiply-add instructions must set the invalid operation exception flag when the multiplicands are Inf and zero, even when the addend is a quiet NaN.
Quoted 8 lines
This commit set invalid operation execption flag for RISC-V when multiplicands of muladd instructions are Inf and zero.
Signed-off-by Frank Chang<[email protected]>--- fpu/softfloat-specialize.c.inc | 6 ++++++ 1 file changed, 6 insertions(+)
Alistair, will you take this via your riscv queue?
r~
Quoted 25 lines · Richard Henderson
Quoted 14 lines · On 4/19/21 6:31 PM, [email protected] wrote:
From: Frank Chang<[email protected]>
In IEEE 754-2008 spec:
Invalid operation exception is signaled when doing:
fusedMultiplyAdd(0, Inf, c)orfusedMultiplyAdd(Inf, 0, c)unless c is a quiet NaN; if c is a quiet NaN then it is implementation defined whether the invalid operation exception is signaled.In RISC-V Unprivileged ISA spec:
The fused multiply-add instructions must set the invalid operation exception flag when the multiplicands are Inf and zero, even when the addend is a quiet NaN.Quoted 8 lines
This commit set invalid operation execption flag for RISC-V when multiplicands of muladd instructions are Inf and zero.
Signed-off-by Frank Chang<[email protected]>--- fpu/softfloat-specialize.c.inc | 6 ++++++ 1 file changed, 6 insertions(+)
Quoted 3 lines
Reviewed-by Richard Henderson <[email protected]>Alistair, will you take this via your riscv queue?
Yep, getting it now
Alistair
Quoted 4 lines
r~
Quoted 1 line · On 4/19/21 6:31 PM, [email protected] wrote:
+ return 3; /* deafult NaN */
Late notice of spelling error: default.
r~
Alistair Francis
AppliedQuoted 5 lines · Richard Henderson
Quoted 1 line · On 4/19/21 6:31 PM, [email protected] wrote:
+ return 3; /* deafult NaN */
Late notice of spelling error: default.
Fixed when I applied it.
Thanks!
Applied to riscv-to-apply.next
Alistair
Quoted 3 lines
r~