1
0
mirror of https://github.com/antonblanchard/microwatt.git synced 2026-01-11 23:43:15 +00:00

FPU: Fix setting of r.x for single-precision operations

The fp_rounding function expects r.x to have been set based on the lower
31 bits of r.r, not 29 as presently done, so change 28 to SP_RBIT-1
(SP_RBIT is 31).  Also add a test to check.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
This commit is contained in:
Paul Mackerras 2025-12-06 11:15:11 +11:00
parent 577bbb8f5d
commit 2f29daab2d
3 changed files with 2 additions and 1 deletions

View File

@ -3239,7 +3239,7 @@ begin
-- If shifting right, test if bits of R will be shifted out of significance
if r.longmask = '1' then
mshift := to_signed(28, EXP_BITS);
mshift := to_signed(SP_RBIT - 1, EXP_BITS);
else
mshift := to_signed(-1, EXP_BITS);
end if;

View File

@ -680,6 +680,7 @@ struct roundvals {
{ FPS_RN_NEAR, 0x38012345b0000000, 0x38012345c0000000, FPS_FR|FPS_FI },
{ FPS_RN_NEAR, 0x37c12345b0000000, 0x37c1234400000000, FPS_FI },
{ FPS_RN_NEAR, 0x0000008800000088, 0, FPS_FI },
{ FPS_RN_NEAR, 0xc2000000c2000000, 0xc2000000c0000000, FPS_FI },
};
int test8(long arg)

Binary file not shown.