X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Fcommon%2Fsim-bits.c;h=4ba0f79055c158c4093cf9ee255481a20729524d;hb=3c765a54971db6d8dbeafdf5230ad692cad271b3;hp=ecfb73bf6b424218d10c99a997d662de55020fb2;hpb=c906108c21474dfb4ed285bcc0ac6fe02cd400cc;p=deliverable%2Fbinutils-gdb.git diff --git a/sim/common/sim-bits.c b/sim/common/sim-bits.c index ecfb73bf6b..4ba0f79055 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 }