This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix builtin-bitops on alphaev4

Here we failed to link because __ffsdi2 wasn't defined.  This is
because L_ffsdi2 actually defines __ffsti2 on 64-bit targets.

To solve this I added an L_ffssi2 member to libgcc.  On 32-bit
targets this won't be used, since we'll fall back to libc's ffs,
but I found this detail to tricky to get rid of what with the
myriad target macros in libgcc2.h.

Ideally we'd fall back on ffsl or ffsll if libc had it.  This
is also probably too much effort to be worthwhile.


        * libgcc2.h, libgcc2.c (__ffsSI2): New.
        (__ffsDI2): Rename from __ffsdi2.
        * (lib2funcs): Add _ffssi2.

Index: libgcc2.c
RCS file: /cvs/gcc/gcc/gcc/libgcc2.c,v
retrieving revision 1.162
diff -c -p -d -u -r1.162 libgcc2.c
--- libgcc2.c	5 Feb 2003 00:43:22 -0000	1.162
+++ libgcc2.c	5 Feb 2003 00:49:47 -0000
@@ -340,11 +340,27 @@ __ashrdi3 (DWtype u, word_type b)
+#ifdef L_ffssi2
+#undef int
+extern int __ffsSI2 (UWtype u);
+__ffsSI2 (UWtype u)
+  UWtype count;
+  if (u == 0)
+    return 0;
+  count_trailing_zeros (count, u);
+  return count + 1;
 #ifdef L_ffsdi2
 #undef int
-extern int __ffsdi2 (DWtype u);
+extern int __ffsDI2 (DWtype u);
-__ffsdi2 (DWtype u)
+__ffsDI2 (DWtype u)
   DWunion uu;
   UWtype word, count, add;
Index: libgcc2.h
RCS file: /cvs/gcc/gcc/gcc/libgcc2.h,v
retrieving revision 1.24
diff -c -p -d -u -r1.24 libgcc2.h
--- libgcc2.h	3 Feb 2003 22:42:20 -0000	1.24
+++ libgcc2.h	5 Feb 2003 00:49:47 -0000
@@ -182,7 +182,6 @@ typedef int word_type __attribute__ ((mo
 #define __lshrdi3	__NDW(lshr,3)
 #define __ashldi3	__NDW(ashl,3)
 #define __ashrdi3	__NDW(ashr,3)
-#define __ffsdi2	__NDW(ffs,2)
 #define __cmpdi2	__NDW(cmp,2)
 #define __ucmpdi2	__NDW(ucmp,2)
 #define __udivmoddi4	__NDW(udivmod,4)
@@ -202,6 +201,9 @@ typedef int word_type __attribute__ ((mo
 #define __fixunstfSI	__NW(fixunstf,)
 #define __fixunsdfSI	__NW(fixunsdf,)
 #define __fixunssfSI	__NW(fixunssf,)
+#define __ffsSI2	__NW(ffs,2)
+#define __ffsDI2	__NDW(ffs,2)
 extern DWtype __muldi3 (DWtype, DWtype);
 extern DWtype __divdi3 (DWtype, DWtype);
RCS file: /cvs/gcc/gcc/gcc/,v
retrieving revision 1.54
diff -c -p -d -u -r1.54
---	1 Feb 2003 18:59:46 -0000	1.54
+++	5 Feb 2003 00:49:47 -0000
@@ -44,14 +44,14 @@ echo 'force:'
 # Library members defined in libgcc2.c.
-lib2funcs='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 _clz
+lib2funcs='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
 	_cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi
 	_fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
 	_floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache
 	_trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 _addvdi3
 	_subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
-	_clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2
-	_popcountdi2 _paritysi2 _paritydi2'
+	_ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
+	_popcountsi2 _popcountdi2 _paritysi2 _paritydi2'
 # Disable SHLIB_LINK if shared libgcc not enabled.
 if [ "@enable_shared@" = "no" ]; then

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]