From a0755935f4bbfe4b93a13c05f82c7e1ca63e167c Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 9 Dec 2025 11:35:12 +1100 Subject: [PATCH] FPU: Normalize B for fmadd family instructions If B is denormalized, but the A*C product is much smaller, then the result is B; in the UE=1 case we need to normalize the result, and the left shift to do that can bring in low-order product bits from S and corrupt the result. To avoid this, make sure B is normalized. Signed-off-by: Paul Mackerras --- fpu.vhdl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fpu.vhdl b/fpu.vhdl index 84f968b..c539e9d 100644 --- a/fpu.vhdl +++ b/fpu.vhdl @@ -1824,7 +1824,7 @@ begin if r.c.denorm = '1' then -- must be either fmul or fmadd/sub v.state := RENORM_C; - elsif r.b.denorm = '1' and r.is_addition = '0' then + elsif r.b.denorm = '1' and (r.is_addition = '0' or r.is_multiply = '1') then v.state := RENORM_B; elsif r.is_multiply = '1' and r.b.class = ZERO then v.state := DO_FMUL;