aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/stormy16
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-11-27 18:56:10 +0000
committerNick Clifton <nickc@gcc.gnu.org>2009-11-27 18:56:10 +0000
commitba96438334721b0d48bf9a1413a6c0963ddbd30f (patch)
treec9d56ccf47b4f1ac9b76b795492e4508065b5dae /gcc/config/stormy16
parentc7f06e130978925eec2f188d7d2f3ec9b378e8ac (diff)
downloadgcc-ba96438334721b0d48bf9a1413a6c0963ddbd30f.zip
gcc-ba96438334721b0d48bf9a1413a6c0963ddbd30f.tar.gz
gcc-ba96438334721b0d48bf9a1413a6c0963ddbd30f.tar.bz2
stormy16-lib2.c: Arrange for separate compilation of each function.
* config/stormy16/stormy16-lib2.c: Arrange for separate compilation of each function. (__ffshi2): New function. (__stormy16_count_leading_zeros): New function. * config/stormy16/t-stormy16 (LIB2FUNCS_EXTRA): Use stub files to compile each function into its own object file. (stormy16-lib2-ashlsi3.c): New stub file. (stormy16-lib2-ashrsi3.c): New stub file. (stormy16-lib2-clzhi2.c): New stub file. (stormy16-lib2-count-leading-zeros.c): New stub file. (stormy16-lib2-ctzhi2.c): New stub file. (stormy16-lib2-divsi3.c): New stub file. (stormy16-lib2-ffshi2.c): New stub file. (stormy16-lib2-lshrsi3.c): New stub file. (stormy16-lib2-modsi3.c): New stub file. (stormy16-lib2-parityhi2.c): New stub file. (stormy16-lib2-popcounthi2.c): New stub file. (stormy16-lib2-udivmodsi4.c): New stub file. (stormy16-lib2-udivsi3.c): New stub file. (stormy16-lib2-umodsi3.c): New stub file. * longlong.h (count_leading_zeros): Define macro for stormy16 target. (COUNT_LEADING_ZEROS_0): Likewise. From-SVN: r154713
Diffstat (limited to 'gcc/config/stormy16')
-rw-r--r--gcc/config/stormy16/stormy16-lib2-ashlsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-ashrsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-clzhi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-count-leading-zeros.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-ctzhi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-divsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-ffshi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-lshrsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-modsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-parityhi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-popcounthi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-udivmodsi4.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-udivsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-umodsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2.c86
-rw-r--r--gcc/config/stormy16/t-stormy1616
16 files changed, 115 insertions, 15 deletions
diff --git a/gcc/config/stormy16/stormy16-lib2-ashlsi3.c b/gcc/config/stormy16/stormy16-lib2-ashlsi3.c
new file mode 100644
index 0000000..d6cabc6
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-ashlsi3.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_ASHLSI3
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-ashrsi3.c b/gcc/config/stormy16/stormy16-lib2-ashrsi3.c
new file mode 100644
index 0000000..151e3d0
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-ashrsi3.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_ASHRSI3
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-clzhi2.c b/gcc/config/stormy16/stormy16-lib2-clzhi2.c
new file mode 100644
index 0000000..066fdf1
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-clzhi2.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_CLZHI2
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-count-leading-zeros.c b/gcc/config/stormy16/stormy16-lib2-count-leading-zeros.c
new file mode 100644
index 0000000..1b98d30
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-count-leading-zeros.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_COUNT_LEADING_ZEROS
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-ctzhi2.c b/gcc/config/stormy16/stormy16-lib2-ctzhi2.c
new file mode 100644
index 0000000..c1497db
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-ctzhi2.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_CTZHI2
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-divsi3.c b/gcc/config/stormy16/stormy16-lib2-divsi3.c
new file mode 100644
index 0000000..33c370d
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-divsi3.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_DIVSI3
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-ffshi2.c b/gcc/config/stormy16/stormy16-lib2-ffshi2.c
new file mode 100644
index 0000000..4b629dd
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-ffshi2.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_FFSHI2
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-lshrsi3.c b/gcc/config/stormy16/stormy16-lib2-lshrsi3.c
new file mode 100644
index 0000000..cd769ee
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-lshrsi3.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_LSHRSI3
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-modsi3.c b/gcc/config/stormy16/stormy16-lib2-modsi3.c
new file mode 100644
index 0000000..587d007
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-modsi3.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_MODSI3
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-parityhi2.c b/gcc/config/stormy16/stormy16-lib2-parityhi2.c
new file mode 100644
index 0000000..1d12817
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-parityhi2.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_PARITYHI2
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-popcounthi2.c b/gcc/config/stormy16/stormy16-lib2-popcounthi2.c
new file mode 100644
index 0000000..f07d668
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-popcounthi2.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_POPCOUNTHI2
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-udivmodsi4.c b/gcc/config/stormy16/stormy16-lib2-udivmodsi4.c
new file mode 100644
index 0000000..d555e64
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-udivmodsi4.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_UDIVMODSI4
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-udivsi3.c b/gcc/config/stormy16/stormy16-lib2-udivsi3.c
new file mode 100644
index 0000000..fdcd64a
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-udivsi3.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_UDIVSI3
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-umodsi3.c b/gcc/config/stormy16/stormy16-lib2-umodsi3.c
new file mode 100644
index 0000000..87921f2
--- /dev/null
+++ b/gcc/config/stormy16/stormy16-lib2-umodsi3.c
@@ -0,0 +1,2 @@
+#define XSTORMY16_UMODSI3
+#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2.c b/gcc/config/stormy16/stormy16-lib2.c
index d5ab1c3..91c3c3d 100644
--- a/gcc/config/stormy16/stormy16-lib2.c
+++ b/gcc/config/stormy16/stormy16-lib2.c
@@ -75,7 +75,7 @@ extern int __clzhi2 (UHWtype);
extern int __ctzhi2 (UHWtype);
-
+#ifdef XSTORMY16_UDIVMODSI4
USItype
udivmodsi4 (USItype num, USItype den, word_type modwanted)
{
@@ -102,7 +102,9 @@ udivmodsi4 (USItype num, USItype den, word_type modwanted)
return num;
return res;
}
+#endif
+#ifdef XSTORMY16_DIVSI3
SItype
__divsi3 (SItype a, SItype b)
{
@@ -128,7 +130,9 @@ __divsi3 (SItype a, SItype b)
return res;
}
+#endif
+#ifdef XSTORMY16_MODSI3
SItype
__modsi3 (SItype a, SItype b)
{
@@ -151,19 +155,25 @@ __modsi3 (SItype a, SItype b)
return res;
}
+#endif
+#ifdef XSTORMY16_UDIVSI3
SItype
__udivsi3 (SItype a, SItype b)
{
return udivmodsi4 (a, b, 0);
}
+#endif
+#ifdef XSTORMY16_UMODSI3
SItype
__umodsi3 (SItype a, SItype b)
{
return udivmodsi4 (a, b, 1);
}
+#endif
+#ifdef XSTORMY16_ASHLSI3
SItype
__ashlsi3 (SItype a, SItype b)
{
@@ -177,7 +187,9 @@ __ashlsi3 (SItype a, SItype b)
a <<= 1;
return a;
}
+#endif
+#ifdef XSTORMY16_ASHRSI3
SItype
__ashrsi3 (SItype a, SItype b)
{
@@ -191,7 +203,9 @@ __ashrsi3 (SItype a, SItype b)
a >>= 1;
return a;
}
+#endif
+#ifdef XSTORMY16_LSHRSI3
USItype
__lshrsi3 (USItype a, USItype b)
{
@@ -205,9 +219,11 @@ __lshrsi3 (USItype a, USItype b)
a >>= 1;
return a;
}
+#endif
+#ifdef XSTORMY16_POPCOUNTHI2
/* Returns the number of set bits in X.
- FIXME: The return type really should be unsigned,
+ FIXME: The return type really should be "unsigned int"
but this is not how the builtin is prototyped. */
int
__popcounthi2 (UHWtype x)
@@ -219,9 +235,11 @@ __popcounthi2 (UHWtype x)
return ret;
}
+#endif
+#ifdef XSTORMY16_PARITYHI2
/* Returns the number of set bits in X, modulo 2.
- FIXME: The return type really should be unsigned,
+ FIXME: The return type really should be "unsigned int"
but this is not how the builtin is prototyped. */
int
@@ -232,32 +250,72 @@ __parityhi2 (UHWtype x)
x &= 0xf;
return (0x6996 >> x) & 1;
}
+#endif
+#ifdef XSTORMY16_CLZHI2
/* Returns the number of leading zero bits in X.
- FIXME: The return type really should be unsigned,
+ FIXME: The return type really should be "unsigned int"
but this is not how the builtin is prototyped. */
int
__clzhi2 (UHWtype x)
{
- if (x > 0xff)
- return 8 - __clz_tab[x >> 8];
- return 16 - __clz_tab[x];
+ return __stormy16_count_leading_zeros (x);
}
+#endif
+#ifdef XSTORMY16_CTZHI2
/* Returns the number of trailing zero bits in X.
- FIXME: The return type really should be unsigned,
- but this is not how the builtin is prototyped. */
+ FIXME: The return type really should be "signed int" since
+ ctz(0) returns -1, but this is not how the builtin is prototyped. */
int
__ctzhi2 (UHWtype x)
{
/* This is cunning. It converts X into a number with only the one bit
- set, the bit was the least significant bit in X. From this we can
- use the __clz_tab[] array to compute the number of trailing bits. */
+ set, the bit that was the least significant bit in X. From this we
+ can use the count_leading_zeros to compute the number of trailing
+ bits. */
x &= - x;
- if (x > 0xff)
- return __clz_tab[x >> 8] + 7;
- return __clz_tab[x] - 1;
+ return 15 - __stormy16_count_leading_zeros (x);
+}
+#endif
+
+#ifdef XSTORMY16_FFSHI2
+/* Returns one plus the index of the least significant 1-bit of X,
+ or if X is zero, returns zero. FIXME: The return type really
+ should be "unsigned int" but this is not how the builtin is
+ prototyped. */
+
+int
+__ffshi2 (UHWtype u)
+{
+ UHWtype count;
+
+ if (u == 0)
+ return 0;
+
+ return 16 - __stormy16_count_leading_zeros (u & - u);
+}
+#endif
+
+#ifdef XSTORMY16_COUNT_LEADING_ZEROS
+#undef unsigned
+/* Count the number of zero-bits from the most significant bit to the
+ first nonzero bit in VALUE. Returns 16 for VALUE == 0. Implemented
+ as a simple for loop in order to save space by removing the need for
+ the __clz_tab array. */
+
+unsigned int
+__stormy16_count_leading_zeros (unsigned int value)
+{
+ unsigned int i;
+ unsigned int c;
+
+ for (c = 0, i = 1 << 15; i; i >>= 1, c++)
+ if (i & value)
+ break;
+ return c;
}
+#endif /* XSTORMY16_COUNT_LEADING_ZEROS */
diff --git a/gcc/config/stormy16/t-stormy16 b/gcc/config/stormy16/t-stormy16
index 4e32c31..b103f88 100644
--- a/gcc/config/stormy16/t-stormy16
+++ b/gcc/config/stormy16/t-stormy16
@@ -21,7 +21,21 @@
# SImode routines
LIB2FUNCS_EXTRA = \
- $(srcdir)/config/stormy16/stormy16-lib2.c
+ $(srcdir)/config/stormy16/stormy16-lib2-udivmodsi4.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-divsi3.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-modsi3.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-udivsi3.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-umodsi3.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-ashlsi3.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-ashrsi3.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-lshrsi3.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-popcounthi2.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-parityhi2.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-clzhi2.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-ctzhi2.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-ffshi2.c \
+ $(srcdir)/config/stormy16/stormy16-lib2-count-leading-zeros.c
+
# floating point emulation libraries