From a18c462b27f526af36a8fd1ce6af315fe1d60a95 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Wed, 10 Dec 2025 09:34:20 +1100 Subject: [PATCH] FPU: Ignore stale P contents in short-circuit multiply-add When a multiply-add is done with A or C equal to zero, the actual multiplication operation is not done, hence P is not valid, so in FINISH state we shouldn't set X based on P being non-zero. Fix this by clearing the is_multiply flag in the short-circuit case. Signed-off-by: Paul Mackerras --- fpu.vhdl | 1 + 1 file changed, 1 insertion(+) diff --git a/fpu.vhdl b/fpu.vhdl index b97e768..6990413 100644 --- a/fpu.vhdl +++ b/fpu.vhdl @@ -3129,6 +3129,7 @@ begin if scinfo.immed_result = '1' then -- state machine is in the DO_SPECIAL or DO_FSQRT state here set_r := '1'; + v.is_multiply := '0'; -- P is not valid opsel_r <= RES_MISC; opsel_sel <= scinfo.result_sel; if scinfo.qnan_result = '1' then