summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2009-01-07 01:12:51 +0000
committerHans-Peter Nilsson <hp@axis.com>2009-01-07 01:12:51 +0000
commit2225d5bdd8543c2078ffacbc371a4177e80617bd (patch)
treeb91ee11af8223aafe93f2ce5c7264d3e99e889d7
parent7b1a28404bcfbaea19b07a09c60e0c0e842fadf0 (diff)
downloadbinutils-gdb-2225d5bdd8543c2078ffacbc371a4177e80617bd.tar.gz
* cgen-ops.h (ADDQI, SUBQI, MULQI, NEGQI, ABSQI, ADDHI, SUBHI)
(MULHI, NEGHI, ABSHI, ADDSI, SUBSI, MULSI, NEGSI, ABSSI, ADDDI) (SUBDI, MULDI, NEGDI, ABSDI): Cast arguments to the unsigned type variant; UQI, UHI, USI, UDI, and cast the result to the signed type, QI, HI, SI, DI.
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/cgen-ops.h40
2 files changed, 26 insertions, 20 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 031c4c799cc..91ba924147d 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,11 @@
2009-01-07 Hans-Peter Nilsson <hp@axis.com>
+ * cgen-ops.h (ADDQI, SUBQI, MULQI, NEGQI, ABSQI, ADDHI, SUBHI)
+ (MULHI, NEGHI, ABSHI, ADDSI, SUBSI, MULSI, NEGSI, ABSSI, ADDDI)
+ (SUBDI, MULDI, NEGDI, ABSDI): Cast arguments to the unsigned type
+ variant; UQI, UHI, USI, UDI, and cast the result to the signed
+ type, QI, HI, SI, DI.
+
* callback.c (os_error): Mark as being a noreturn function.
* sim-io.h (sim_io_error): Similar for sim_io_error.
diff --git a/sim/common/cgen-ops.h b/sim/common/cgen-ops.h
index d90eb20b2e4..063bf7af4a3 100644
--- a/sim/common/cgen-ops.h
+++ b/sim/common/cgen-ops.h
@@ -59,9 +59,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define GTUBI(x, y) ((BI) (x) > (BI) (y))
#define GEUBI(x, y) ((BI) (x) >= (BI) (y))
-#define ADDQI(x, y) ((x) + (y))
-#define SUBQI(x, y) ((x) - (y))
-#define MULQI(x, y) ((x) * (y))
+#define ADDQI(x, y) ((QI) ((UQI) (x) + (UQI) (y)))
+#define SUBQI(x, y) ((QI) ((UQI) (x) - (UQI) (y)))
+#define MULQI(x, y) ((QI) ((UQI) (x) * (UQI) (y)))
#define DIVQI(x, y) ((QI) (x) / (QI) (y))
#define UDIVQI(x, y) ((UQI) (x) / (UQI) (y))
#define MODQI(x, y) ((QI) (x) % (QI) (y))
@@ -74,10 +74,10 @@ extern QI ROLQI (QI, int);
#define ANDQI(x, y) ((x) & (y))
#define ORQI(x, y) ((x) | (y))
#define XORQI(x, y) ((x) ^ (y))
-#define NEGQI(x) (- (x))
+#define NEGQI(x) ((QI) (- (UQI) (x)))
#define NOTQI(x) (! (QI) (x))
#define INVQI(x) (~ (x))
-#define ABSQI(x) ((x) < 0 ? -(x) : (x))
+#define ABSQI(x) ((QI) ((QI) (x) < 0 ? -(UQI) (x) : (UQI) (x)))
#define EQQI(x, y) ((QI) (x) == (QI) (y))
#define NEQI(x, y) ((QI) (x) != (QI) (y))
#define LTQI(x, y) ((QI) (x) < (QI) (y))
@@ -89,9 +89,9 @@ extern QI ROLQI (QI, int);
#define GTUQI(x, y) ((UQI) (x) > (UQI) (y))
#define GEUQI(x, y) ((UQI) (x) >= (UQI) (y))
-#define ADDHI(x, y) ((x) + (y))
-#define SUBHI(x, y) ((x) - (y))
-#define MULHI(x, y) ((x) * (y))
+#define ADDHI(x, y) ((HI) ((UHI) (x) + (UHI) (y)))
+#define SUBHI(x, y) ((HI) ((UHI) (x) - (UHI) (y)))
+#define MULHI(x, y) ((HI) ((UHI) (x) * (UHI) (y)))
#define DIVHI(x, y) ((HI) (x) / (HI) (y))
#define UDIVHI(x, y) ((UHI) (x) / (UHI) (y))
#define MODHI(x, y) ((HI) (x) % (HI) (y))
@@ -104,10 +104,10 @@ extern HI ROLHI (HI, int);
#define ANDHI(x, y) ((x) & (y))
#define ORHI(x, y) ((x) | (y))
#define XORHI(x, y) ((x) ^ (y))
-#define NEGHI(x) (- (x))
+#define NEGHI(x) ((HI) (- (UHI) (x)))
#define NOTHI(x) (! (HI) (x))
#define INVHI(x) (~ (x))
-#define ABSHI(x) ((x) < 0 ? -(x) : (x))
+#define ABSHI(x) ((HI) ((HI) (x) < 0 ? -(UHI) (x) : (UHI) (x)))
#define EQHI(x, y) ((HI) (x) == (HI) (y))
#define NEHI(x, y) ((HI) (x) != (HI) (y))
#define LTHI(x, y) ((HI) (x) < (HI) (y))
@@ -119,9 +119,9 @@ extern HI ROLHI (HI, int);
#define GTUHI(x, y) ((UHI) (x) > (UHI) (y))
#define GEUHI(x, y) ((UHI) (x) >= (UHI) (y))
-#define ADDSI(x, y) ((x) + (y))
-#define SUBSI(x, y) ((x) - (y))
-#define MULSI(x, y) ((x) * (y))
+#define ADDSI(x, y) ((SI) ((USI) (x) + (USI) (y)))
+#define SUBSI(x, y) ((SI) ((USI) (x) - (USI) (y)))
+#define MULSI(x, y) ((SI) ((USI) (x) * (USI) (y)))
#define DIVSI(x, y) ((SI) (x) / (SI) (y))
#define UDIVSI(x, y) ((USI) (x) / (USI) (y))
#define MODSI(x, y) ((SI) (x) % (SI) (y))
@@ -134,10 +134,10 @@ extern SI ROLSI (SI, int);
#define ANDSI(x, y) ((x) & (y))
#define ORSI(x, y) ((x) | (y))
#define XORSI(x, y) ((x) ^ (y))
-#define NEGSI(x) (- (x))
+#define NEGSI(x) ((SI) (- (USI) (x)))
#define NOTSI(x) (! (SI) (x))
#define INVSI(x) (~ (x))
-#define ABSSI(x) ((x) < 0 ? -(x) : (x))
+#define ABSSI(x) ((SI) ((SI) (x) < 0 ? -(USI) (x) : (USI) (x)))
#define EQSI(x, y) ((SI) (x) == (SI) (y))
#define NESI(x, y) ((SI) (x) != (SI) (y))
#define LTSI(x, y) ((SI) (x) < (SI) (y))
@@ -179,9 +179,9 @@ extern int LEUDI (UDI, UDI);
extern int GTUDI (UDI, UDI);
extern int GEUDI (UDI, UDI);
#else /* ! DI_FN_SUPPORT */
-#define ADDDI(x, y) ((x) + (y))
-#define SUBDI(x, y) ((x) - (y))
-#define MULDI(x, y) ((x) * (y))
+#define ADDDI(x, y) ((DI) ((UDI) (x) + (UDI) (y)))
+#define SUBDI(x, y) ((DI) ((UDI) (x) - (UDI) (y)))
+#define MULDI(x, y) ((DI) ((UDI) (x) * (UDI) (y)))
#define DIVDI(x, y) ((DI) (x) / (DI) (y))
#define UDIVDI(x, y) ((UDI) (x) / (UDI) (y))
#define MODDI(x, y) ((DI) (x) % (DI) (y))
@@ -194,10 +194,10 @@ extern DI ROLDI (DI, int);
#define ANDDI(x, y) ((x) & (y))
#define ORDI(x, y) ((x) | (y))
#define XORDI(x, y) ((x) ^ (y))
-#define NEGDI(x) (- (x))
+#define NEGDI(x) ((DI) (- (UDI) (x)))
#define NOTDI(x) (! (DI) (x))
#define INVDI(x) (~ (x))
-#define ABSDI(x) ((x) < 0 ? -(x) : (x))
+#define ABSDI(x) ((DI) ((DI) (x) < 0 ? -(UDI) (x) : (UDI) (x)))
#define EQDI(x, y) ((DI) (x) == (DI) (y))
#define NEDI(x, y) ((DI) (x) != (DI) (y))
#define LTDI(x, y) ((DI) (x) < (DI) (y))