[fixed-point] Patch to fix a bug when shifting

Fu, Chao-Ying fu@mips.com
Mon Apr 16 23:36:00 GMT 2007


Hi,

  This patch fixed a bug in fixed-point emulation code.
We need to cast to an unsigned type when shifting right.
Thanks!

Regards,
Chao-ying

2007-04-16  Chao-ying Fu  <fu@mips.com>

	* config/fixed-bit.c (FIXED_MULHELPER): We need to cast to an
	unsigned type when shifting right.

Index: config/fixed-bit.c
===================================================================
--- config/fixed-bit.c  (revision 123884)
+++ config/fixed-bit.c  (working copy)
@@ -349,7 +349,7 @@
   s.ll = r.ll;
   r.ll = 0;
 #else
-  s.ll = s.ll >> FBITS;
+  s.ll = ((UINT_C_TYPE)s.ll) >> FBITS;
   temp1.ll = r.ll << (FIXED_WIDTH - FBITS);
   s.ll = s.ll | temp1.ll;
   r.ll = r.ll >> FBITS;



More information about the Gcc-patches mailing list