Skip to content

Commit

Permalink
[POWERPC] Fix rounding bug in emulation for double float operating
Browse files Browse the repository at this point in the history
This patch fixes rounding bug in emulation for double float operating on PowerPC platform.

When pack double float operand, it need to truncate the tail due to the limited precision.
If the truncated part is not zero, the last bit of work bit (totally 3 bits) need to '|' 1.

This patch is completed in _FP_FRAC_SRS_2(X,N,sz) (arch/powerpc/math-emu/op-2.h).
Originally the code leftwards rotates the operand to just keep the truncated part,
then check whether it is zero. However, the number it rotates is not correct when
N is not smaller than _FP_W_TYPE_SIZE, and it will cause the work bit '|' 1 in the improper case.

This patch fixes this issue.

Signed-off-by: Liu Yu <b13201@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
  • Loading branch information
Liu Yu authored and Kumar Gala committed Dec 14, 2007
1 parent e8b5f43 commit c896862
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/powerpc/math-emu/op-2.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
else \
{ \
X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE) | \
(((X##_f1 << (sz - (N))) | X##_f0) != 0)); \
(((X##_f1 << (2 * _FP_W_TYPE_SIZE - (N))) | \
X##_f0) != 0)); \
X##_f1 = 0; \
} \
} while (0)
Expand Down

0 comments on commit c896862

Please sign in to comment.