Commit 9677aa89 by Joseph Myers Committed by Joseph Myers

libgcc2.c (__addvSI3, [...]): Use unsigned arithmetic.

	* libgcc2.c (__addvSI3, __addvsi3, __addvDI3, __subvSI3,
	__subvsi3, __subvDI3, __negvSI2, __negvsi2, __negvDI2, __absvSI2,
	__absvsi2, __absvDI2): Use unsigned arithmetic.

From-SVN: r132815
parent f3130d75
2008-03-02 Joseph Myers <joseph@codesourcery.com>
* libgcc2.c (__addvSI3, __addvsi3, __addvDI3, __subvSI3,
__subvsi3, __subvDI3, __negvSI2, __negvsi2, __negvDI2, __absvSI2,
__absvsi2, __absvDI2): Use unsigned arithmetic.
2008-03-02 Andi Kleen <ak@suse.de> 2008-03-02 Andi Kleen <ak@suse.de>
Richard Guenther <rguenther@suse.de> Richard Guenther <rguenther@suse.de>
......
...@@ -84,7 +84,7 @@ __negdi2 (DWtype u) ...@@ -84,7 +84,7 @@ __negdi2 (DWtype u)
Wtype Wtype
__addvSI3 (Wtype a, Wtype b) __addvSI3 (Wtype a, Wtype b)
{ {
const Wtype w = a + b; const Wtype w = (UWtype) a + (UWtype) b;
if (b >= 0 ? w < a : w > a) if (b >= 0 ? w < a : w > a)
abort (); abort ();
...@@ -95,7 +95,7 @@ __addvSI3 (Wtype a, Wtype b) ...@@ -95,7 +95,7 @@ __addvSI3 (Wtype a, Wtype b)
SItype SItype
__addvsi3 (SItype a, SItype b) __addvsi3 (SItype a, SItype b)
{ {
const SItype w = a + b; const SItype w = (USItype) a + (USItype) b;
if (b >= 0 ? w < a : w > a) if (b >= 0 ? w < a : w > a)
abort (); abort ();
...@@ -109,7 +109,7 @@ __addvsi3 (SItype a, SItype b) ...@@ -109,7 +109,7 @@ __addvsi3 (SItype a, SItype b)
DWtype DWtype
__addvDI3 (DWtype a, DWtype b) __addvDI3 (DWtype a, DWtype b)
{ {
const DWtype w = a + b; const DWtype w = (UDWtype) a + (UDWtype) b;
if (b >= 0 ? w < a : w > a) if (b >= 0 ? w < a : w > a)
abort (); abort ();
...@@ -122,7 +122,7 @@ __addvDI3 (DWtype a, DWtype b) ...@@ -122,7 +122,7 @@ __addvDI3 (DWtype a, DWtype b)
Wtype Wtype
__subvSI3 (Wtype a, Wtype b) __subvSI3 (Wtype a, Wtype b)
{ {
const Wtype w = a - b; const Wtype w = (UWtype) a - (UWtype) b;
if (b >= 0 ? w > a : w < a) if (b >= 0 ? w > a : w < a)
abort (); abort ();
...@@ -133,7 +133,7 @@ __subvSI3 (Wtype a, Wtype b) ...@@ -133,7 +133,7 @@ __subvSI3 (Wtype a, Wtype b)
SItype SItype
__subvsi3 (SItype a, SItype b) __subvsi3 (SItype a, SItype b)
{ {
const SItype w = a - b; const SItype w = (USItype) a - (USItype) b;
if (b >= 0 ? w > a : w < a) if (b >= 0 ? w > a : w < a)
abort (); abort ();
...@@ -147,7 +147,7 @@ __subvsi3 (SItype a, SItype b) ...@@ -147,7 +147,7 @@ __subvsi3 (SItype a, SItype b)
DWtype DWtype
__subvDI3 (DWtype a, DWtype b) __subvDI3 (DWtype a, DWtype b)
{ {
const DWtype w = a - b; const DWtype w = (UDWtype) a - (UDWtype) b;
if (b >= 0 ? w > a : w < a) if (b >= 0 ? w > a : w < a)
abort (); abort ();
...@@ -187,7 +187,7 @@ __mulvsi3 (SItype a, SItype b) ...@@ -187,7 +187,7 @@ __mulvsi3 (SItype a, SItype b)
Wtype Wtype
__negvSI2 (Wtype a) __negvSI2 (Wtype a)
{ {
const Wtype w = -a; const Wtype w = -(UWtype) a;
if (a >= 0 ? w > 0 : w < 0) if (a >= 0 ? w > 0 : w < 0)
abort (); abort ();
...@@ -198,7 +198,7 @@ __negvSI2 (Wtype a) ...@@ -198,7 +198,7 @@ __negvSI2 (Wtype a)
SItype SItype
__negvsi2 (SItype a) __negvsi2 (SItype a)
{ {
const SItype w = -a; const SItype w = -(USItype) a;
if (a >= 0 ? w > 0 : w < 0) if (a >= 0 ? w > 0 : w < 0)
abort (); abort ();
...@@ -212,7 +212,7 @@ __negvsi2 (SItype a) ...@@ -212,7 +212,7 @@ __negvsi2 (SItype a)
DWtype DWtype
__negvDI2 (DWtype a) __negvDI2 (DWtype a)
{ {
const DWtype w = -a; const DWtype w = -(UDWtype) a;
if (a >= 0 ? w > 0 : w < 0) if (a >= 0 ? w > 0 : w < 0)
abort (); abort ();
...@@ -231,7 +231,7 @@ __absvSI2 (Wtype a) ...@@ -231,7 +231,7 @@ __absvSI2 (Wtype a)
#ifdef L_negvsi2 #ifdef L_negvsi2
w = __negvSI2 (a); w = __negvSI2 (a);
#else #else
w = -a; w = -(UWtype) a;
if (w < 0) if (w < 0)
abort (); abort ();
...@@ -249,7 +249,7 @@ __absvsi2 (SItype a) ...@@ -249,7 +249,7 @@ __absvsi2 (SItype a)
#ifdef L_negvsi2 #ifdef L_negvsi2
w = __negvsi2 (a); w = __negvsi2 (a);
#else #else
w = -a; w = -(USItype) a;
if (w < 0) if (w < 0)
abort (); abort ();
...@@ -270,7 +270,7 @@ __absvDI2 (DWtype a) ...@@ -270,7 +270,7 @@ __absvDI2 (DWtype a)
#ifdef L_negvdi2 #ifdef L_negvdi2
w = __negvDI2 (a); w = __negvDI2 (a);
#else #else
w = -a; w = -(UDWtype) a;
if (w < 0) if (w < 0)
abort (); abort ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment