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>
pull/457/head
Paul Mackerras 2 weeks ago
parent 577bbb8f5d
commit 2f29daab2d

@ -3239,7 +3239,7 @@ begin


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

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


int test8(long arg) int test8(long arg)

Binary file not shown.
Loading…
Cancel
Save