qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fpu/softfloat: set invalid excp flag for RISC-V muladd instr


From: Richard Henderson
Subject: Re: [PATCH] fpu/softfloat: set invalid excp flag for RISC-V muladd instructions
Date: Mon, 19 Apr 2021 08:28:40 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 4/18/21 10:56 PM, frank.chang@sifive.com wrote:
+#elif defined(TARGET_RISCV)
+    /*
+     * For RISC-V, InvalidOp is set when multiplicands are Inf and zero
+     * and returns default NaN.
+     */
+    if (infzero) {
+        float_raise(float_flag_invalid, status);
+        return 3;
+    }
+
+    if (is_nan(a_cls)) {
+        return 0;
+    } else if (is_nan(b_cls)) {
+        return 1;
+    } else {
+        return 2;
+    }

This second half of the function made me go look into the spec to make sure you had got that selection right. But RISCV is always in default_nan mode, so all this is unused (and overridden in pick_nan_muladd).

I think for avoidance of confusion, you should use

    if (infzero) {
        float_raise(float_flag_invalid, status);
    }
    return 3; /* default nan */


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]