diff options
author | nickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-07-31 09:09:29 +0000 |
---|---|---|
committer | nickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-07-31 09:09:29 +0000 |
commit | 3a44f5e6ca1c27d08b737a5cce1daade3e645c9e (patch) | |
tree | 8de31a6c11e026f1bf000f8dd3508a37466d9238 /libgcc/config/stormy16/lib2funcs.c | |
parent | 04032ba7af3b2657193828ed375b3a85851d98a6 (diff) | |
download | gcc-3a44f5e6ca1c27d08b737a5cce1daade3e645c9e.tar.gz |
* config/stormy16/lib2funcs.c (__clrsbhi2): New function.
Implements __clrsb for an HImode argument.
* config/stormy16/clrsbhi2.c: New file:
* config/stormy16/t-stormy16 (LIB2ADD): Add clrsbhi2.c.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189997 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc/config/stormy16/lib2funcs.c')
-rw-r--r-- | libgcc/config/stormy16/lib2funcs.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libgcc/config/stormy16/lib2funcs.c b/libgcc/config/stormy16/lib2funcs.c index a10a9b28119..a996fd15e24 100644 --- a/libgcc/config/stormy16/lib2funcs.c +++ b/libgcc/config/stormy16/lib2funcs.c @@ -311,6 +311,22 @@ __ffshi2 (UHWtype u) } #endif +#ifdef XSTORMY16_CLRSBHI2 +/* Returns the number of leading redundant sign bits in X. + I.e. the number of bits following the most significant bit which are + identical to it. There are no special cases for 0 or other values. */ + +int +__clrsbhi2 (HWtype x) +{ + if (x < 0) + x = ~x; + if (x == 0) + return 15; + return __builtin_clz (x) - 1; +} +#endif + #ifdef XSTORMY16_UCMPSI2 /* Performs an unsigned comparison of two 32-bit values: A and B. If A is less than B, then 0 is returned. If A is greater than B, |