]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
From 2000-06-25 Stephane Carrez <Stephane.Carrez@worldnet.fr>:
authorAndrew Cagney <cagney@redhat.com>
Thu, 27 Jul 2000 11:07:01 +0000 (11:07 +0000)
committerAndrew Cagney <cagney@redhat.com>
Thu, 27 Jul 2000 11:07:01 +0000 (11:07 +0000)
* sim-bits.h (_MSB_16, _LSB_16): Define for 16-bit targets.
(MASK, LSBIT, MSBIT): Likewise and use _MSB_16 and _LSB_16.
(EXTENDED): Define for 16-bit word size.
* sim-bits.c (LSEXTRACTED, MSEXTRACTED, LSINSERTED,
MSINSERTED, LSSEXT, MSSEXT): Implement for 16-bit word size.
* sim-types.h: Added support for 16-bit targets.

sim/common/ChangeLog
sim/common/sim-bits.c
sim/common/sim-bits.h
sim/common/sim-types.h

index 9343a07d44e16f8c006eb02478531a327d834c38..3cc07321f3f98966247ff7f21b5a2b7edcfe5af6 100644 (file)
@@ -1,3 +1,13 @@
+Thu Jul 27 20:37:47 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       From 2000-06-25 Stephane Carrez <Stephane.Carrez@worldnet.fr>:
+       * sim-bits.h (_MSB_16, _LSB_16): Define for 16-bit targets.
+       (MASK, LSBIT, MSBIT): Likewise and use _MSB_16 and _LSB_16.
+       (EXTENDED): Define for 16-bit word size.
+       * sim-bits.c (LSEXTRACTED, MSEXTRACTED, LSINSERTED,
+       MSINSERTED, LSSEXT, MSSEXT): Implement for 16-bit word size.
+       * sim-types.h: Added support for 16-bit targets.
+
 2000-06-23  Frank Ch. Eigler  <fche@redhat.com>
 
        * cgen-trace.h (TRACE_USEFUL_MASK): Remove TRACE_EVENTS_IDX.
index ecfb73bf6b424218d10c99a997d662de55020fb2..4ba0f79055c158c4093cf9ee255481a20729524d 100644 (file)
@@ -72,6 +72,17 @@ LSEXTRACTED (unsigned_word val,
       return val;
     }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  if (stop >= 16)
+    return 0;
+  else
+    {
+      if (start < 16)
+       val &= LSMASK (start, 0);
+      val >>= stop;
+      return val;
+    }
+#endif
 }
 
 
@@ -96,6 +107,17 @@ MSEXTRACTED (unsigned_word val,
       return val;
     }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  if (stop < 16)
+    return 0;
+  else
+    {
+      if (start >= 16)
+       val &= MSMASK (start, 64 - 1);
+      val >>= (64 - stop - 1);
+      return val;
+    }
+#endif
 }
 
 
@@ -121,6 +143,18 @@ LSINSERTED (unsigned_word val,
       return val;
     }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  /* Bit numbers are 63..0, even for 16 bit targets.
+     On 16 bit targets we ignore 63..16  */
+  if (stop >= 16)
+    return 0;
+  else
+    {
+      val <<= stop;
+      val &= LSMASK (start, stop);
+      return val;
+    }
+#endif
 }
 
 INLINE_SIM_BITS\
@@ -145,6 +179,18 @@ MSINSERTED (unsigned_word val,
       return val;
     }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  /* Bit numbers are 0..63, even for 16 bit targets.
+     On 16 bit targets we ignore 0..47.  */
+  if (stop < 32 + 16)
+    return 0;
+  else
+    {
+      val <<= ((64 - 1) - stop);
+      val &= MSMASK (start, stop);
+      return val;
+    }
+#endif
 }
 
 
@@ -166,6 +212,14 @@ LSSEXT (signed_word val,
     return val;
   }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  if (sign_bit >= 16)
+    return val;
+  else {
+    val = LSSEXT16 (val, sign_bit);
+    return val;
+  }
+#endif
 }
 
 INLINE_SIM_BITS\
@@ -185,6 +239,14 @@ MSSEXT (signed_word val,
     return val;
   }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  if (sign_bit < 32 + 16)
+    return val;
+  else {
+    val = MSSEXT16 (val, sign_bit - 32 - 16);
+    return val;
+  }
+#endif
 }
 
 
index d111bcd4569b57cc4afdecf7757ebd5fa46fda60..caebf0a902b6c699dc77079d918fad8723478a8c 100644 (file)
 #define _MSB_32(START, STOP) (START <= STOP \
                              ? (START < 32 ? 0 : START - 32) \
                              : (STOP < 32 ? 0 : STOP - 32))
+#define _MSB_16(START, STOP) (START <= STOP \
+                             ? (START < 48 ? 0 : START - 48) \
+                             : (STOP < 48 ? 0 : STOP - 48))
 #else
 #define _MSB_32(START, STOP) (START >= STOP \
                              ? (START >= 32 ? 31 : START) \
                              : (STOP >= 32 ? 31 : STOP))
+#define _MSB_16(START, STOP) (START >= STOP \
+                             ? (START >= 16 ? 15 : START) \
+                             : (STOP >= 16 ? 15 : STOP))
 #endif
 
 #if (WITH_TARGET_WORD_MSB == 0)
 #define _LSB_32(START, STOP) (START <= STOP \
                              ? (STOP < 32 ? 0 : STOP - 32) \
                              : (START < 32 ? 0 : START - 32))
+#define _LSB_16(START, STOP) (START <= STOP \
+                             ? (STOP < 48 ? 0 : STOP - 48) \
+                             : (START < 48 ? 0 : START - 48))
 #else
 #define _LSB_32(START, STOP) (START >= STOP \
                              ? (STOP >= 32 ? 31 : STOP) \
                              : (START >= 32 ? 31 : START))
+#define _LSB_16(START, STOP) (START >= STOP \
+                             ? (STOP >= 16 ? 15 : STOP) \
+                             : (START >= 16 ? 15 : START))
 #endif
 
 #if (WITH_TARGET_WORD_MSB == 0)
 
 #if (WITH_TARGET_WORD_BITSIZE == 64)
 #define LSBIT(POS) LSBIT64 (POS)
-#else
+#endif
+#if (WITH_TARGET_WORD_BITSIZE == 32)
 #define LSBIT(POS) ((unsigned32)((POS) >= 32 \
                                 ? 0 \
                                 : (1 << ((POS) >= 32 ? 0 : (POS)))))
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+#define LSBIT(POS) ((unsigned16)((POS) >= 16 \
+                                ? 0 \
+                                : (1 << ((POS) >= 16 ? 0 : (POS)))))
+#endif
 
 
 #define MSBIT8(POS)  ((unsigned8) 1 << ( 8 - 1 - (POS)))
 
 #if (WITH_TARGET_WORD_BITSIZE == 64)
 #define MSBIT(POS) MSBIT64 (POS)
-#else
+#endif
+#if (WITH_TARGET_WORD_BITSIZE == 32)
 #define MSBIT(POS) ((unsigned32)((POS) < 32 \
                                 ? 0 \
                                 : (1 << ((POS) < 32 ? 0 : (64 - 1) - (POS)))))
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+#define MSBIT(POS) ((unsigned16)((POS) < 48 \
+                                ? 0 \
+                                : (1 << ((POS) < 48 ? 0 : (64 - 1) - (POS)))))
+#endif
 
 
 /* Bit operations */
                      _MSB_POS (32, 0), \
                      _MSB_32 ((START), (STOP))))))
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+#define MASK(START, STOP) \
+     (_POS_LE ((START), (STOP)) \
+      ? (_POS_LE ((STOP), _MSB_POS (64, 15)) \
+        ? 0 \
+        : _MASKn (16, \
+                  _MSB_16 ((START), (STOP)), \
+                  _LSB_16 ((START), (STOP)))) \
+      : (_MASKn (16, \
+                _LSB_16 ((START), (STOP)), \
+                _LSB_POS (16, 0)) \
+        | (_POS_LE ((STOP), _MSB_POS (64, 15)) \
+           ? 0 \
+           : _MASKn (16, \
+                     _MSB_POS (16, 0), \
+                     _MSB_16 ((START), (STOP))))))
+#endif
 #if !defined (MASK)
 #error "MASK never undefined"
 #endif
@@ -475,6 +516,9 @@ INLINE_SIM_BITS(unsigned_word) MSINSERTED (unsigned_word val, int start, int sto
 #if (WITH_TARGET_WORD_BITSIZE == 32)
 #define EXTENDED(X)     (X)
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+#define EXTENDED(X)     (X)
+#endif
 
 
 /* memory alignment macro's */
index babc59814b04d71467d58795cbcce845f02c7150..afd008faaa43e7c1f670ea7436b3f0d9fda084dc 100644 (file)
@@ -164,6 +164,10 @@ typedef signed64 signed_word;
 typedef unsigned32 unsigned_word;
 typedef signed32 signed_word;
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+typedef unsigned16 unsigned_word;
+typedef signed16 signed_word;
+#endif
 
 
 /* Other instructions */
@@ -175,6 +179,10 @@ typedef signed64 signed_address;
 typedef unsigned32 unsigned_address;
 typedef signed32 signed_address;
 #endif
+#if (WITH_TARGET_ADDRESS_BITSIZE == 16)
+typedef unsigned16 unsigned_address;
+typedef signed16 signed_address;
+#endif
 typedef unsigned_address address_word;