diff options
author | Andrew Cagney <cagney@redhat.com> | 2000-07-27 11:07:01 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2000-07-27 11:07:01 +0000 |
commit | 3c765a54971db6d8dbeafdf5230ad692cad271b3 (patch) | |
tree | 756b8c00633eb607f9651a74c24c720b25923849 /sim/common/sim-bits.c | |
parent | 0a17cd59446fd9191aa49369b8fd8b42a0c748cf (diff) | |
download | gdb-3c765a54971db6d8dbeafdf5230ad692cad271b3.zip gdb-3c765a54971db6d8dbeafdf5230ad692cad271b3.tar.gz gdb-3c765a54971db6d8dbeafdf5230ad692cad271b3.tar.bz2 |
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.
Diffstat (limited to 'sim/common/sim-bits.c')
-rw-r--r-- | sim/common/sim-bits.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/sim/common/sim-bits.c b/sim/common/sim-bits.c index ecfb73b..4ba0f79 100644 --- a/sim/common/sim-bits.c +++ b/sim/common/sim-bits.c @@ -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 } |