Linux PARISC architecture development
 help / color / mirror / Atom feed
* [PATCH] PARISC: Avoid undefined shift in cnv_float.h
@ 2012-04-01 16:57 John David Anglin
  2012-04-01 17:06 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: John David Anglin @ 2012-04-01 16:57 UTC (permalink / raw)
  To: linux-parisc List; +Cc: James Bottomley

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]

The attached change fixes a float conversion problem found running the
GCC testsuite with GCC configured with --with-arch=2.0.

Signed-off-by: John David Anglin <dave.anglin@bell.net>



[-- Attachment #2: cnv-float-patch.txt --]
[-- Type: text/plain, Size: 1082 bytes --]

diff --git a/arch/parisc/math-emu/cnv_float.h b/arch/parisc/math-emu/cnv_float.h
index 9071e09..37299c7 100644
--- a/arch/parisc/math-emu/cnv_float.h
+++ b/arch/parisc/math-emu/cnv_float.h
@@ -347,16 +347,15 @@
     Sgl_isinexact_to_fix(sgl_value,exponent)
 
 #define Duint_from_sgl_mantissa(sgl_value,exponent,dresultA,dresultB)	\
-  {Sall(sgl_value) <<= SGL_EXP_LENGTH;  /*  left-justify  */		\
+  {unsigned int val = Sall(sgl_value) << SGL_EXP_LENGTH;		\
     if (exponent <= 31) {						\
     	Dintp1(dresultA) = 0;						\
-    	Dintp2(dresultB) = (unsigned)Sall(sgl_value) >> (31 - exponent); \
+    	Dintp2(dresultB) = val >> (31 - exponent);			\
     }									\
     else {								\
-    	Dintp1(dresultA) = Sall(sgl_value) >> (63 - exponent);		\
-    	Dintp2(dresultB) = Sall(sgl_value) << (exponent - 31);		\
+    	Dintp1(dresultA) = val >> (63 - exponent);			\
+    	Dintp2(dresultB) = exponent <= 62 ? val << (exponent - 31) : 0;	\
     }									\
-    Sall(sgl_value) >>= SGL_EXP_LENGTH;  /* return to original */	\
   }
 
 #define Duint_setzero(dresultA,dresultB) 	\

[-- Attachment #3: Type: text/plain, Size: 45 bytes --]



--
John David Anglin	dave.anglin@bell.net


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-01 17:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-01 16:57 [PATCH] PARISC: Avoid undefined shift in cnv_float.h John David Anglin
2012-04-01 17:06 ` James Bottomley
2012-04-01 17:25   ` John David Anglin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox