From 7004b4af6e52ce8985e45bf37bde813df4d509ff Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 3 Feb 2005 21:56:44 -0500 Subject: [PATCH] Drop the sparc assembly bitwise operations; it's less efficient than the GCC 3.4 compile code and triggers compiler warnings on sparc64. Thanks to Matthias Andree for his analysis and suggestions. (Addresses Debian Bug #232326) Remove support for the --enable-old-bitops configure option which was only for very old sparc systems. --- ChangeLog | 5 +++ configure | 20 --------- configure.in | 15 ------- lib/ext2fs/ChangeLog | 9 ++++ lib/ext2fs/bitops.c | 6 +-- lib/ext2fs/bitops.h | 118 --------------------------------------------------- 6 files changed, 17 insertions(+), 156 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56395d9..e273b34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-02-03 Theodore Ts'o + + * configure.in: Remove support for the (very old) sparc old-bitops + configure option. + 2005-01-19 Matthias Andree * configure.in: Clean up checks for dirent.d_reclen, ssize_t, diff --git a/configure b/configure index ec27ba4..bcee8ed 100644 --- a/configure +++ b/configure @@ -861,7 +861,6 @@ Optional Features: --enable-dynamic-e2fsck build e2fsck dynamically --enable-fsck build fsck wrapper program --enable-e2initrd-helper build e2initrd-helper program - --enable-old-bitops Use old (non-standard but native) bitmask operations --disable-nls do not use Native Language Support --disable-rpath do not hardcode runtime library paths @@ -3457,25 +3456,6 @@ fi; MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library -# Check whether --enable-old-bitops or --disable-old-bitops was given. -if test "${enable_old_bitops+set}" = set; then - enableval="$enable_old_bitops" - if test "$enableval" = "no" -then - echo "Using new (standard) bitmask operations" -else - cat >>confdefs.h <<\_ACEOF -#define EXT2_OLD_BITOPS 1 -_ACEOF - - echo "Using old (native) bitmask operations" - -fi - -else - echo "Using standard bitmask operations by default" - -fi; GETTEXT_PACKAGE=e2fsprogs PACKAGE=e2fsprogs VERSION="$E2FSPROGS_VERSION" diff --git a/configure.in b/configure.in index 1e5c55b..ae7d04c 100644 --- a/configure.in +++ b/configure.in @@ -486,21 +486,6 @@ dnl MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library AC_SUBST_FILE(MAKEFILE_LIBRARY) dnl -dnl -AC_ARG_ENABLE([old-bitops], -[ --enable-old-bitops Use old (non-standard but native) bitmask operations], -if test "$enableval" = "no" -then - echo "Using new (standard) bitmask operations" -else - AC_DEFINE(EXT2_OLD_BITOPS) - echo "Using old (native) bitmask operations" - -fi -, -echo "Using standard bitmask operations by default" -) -dnl dnl Add internationalization support, using gettext. dnl GETTEXT_PACKAGE=e2fsprogs diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index ce986aa..0b7e5da 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,12 @@ +2005-02-03 Theodore Ts'o + + * bitops.c: Make the generic functions more efficient. + + * bitops.h: Drop SPARC assembly code. It's less efficient than GCC + 3.4 compiled code and also triggers nasty compiler + warnings on sparc64. Thanks to Matthias Andree for his + analysis and suggestion. + 2005-01-27 Theodore Ts'o * res_gdt.c (ext2fs_create_resize_inode): Create the resize inode diff --git a/lib/ext2fs/bitops.c b/lib/ext2fs/bitops.c index 886eb5e..207c44d 100644 --- a/lib/ext2fs/bitops.c +++ b/lib/ext2fs/bitops.c @@ -37,7 +37,7 @@ int ext2fs_set_bit(int nr,void * addr) ADDR += nr >> 3; mask = 1 << (nr & 0x07); - retval = (mask & *ADDR) != 0; + retval = mask & *ADDR; *ADDR |= mask; return retval; } @@ -49,7 +49,7 @@ int ext2fs_clear_bit(int nr, void * addr) ADDR += nr >> 3; mask = 1 << (nr & 0x07); - retval = (mask & *ADDR) != 0; + retval = mask & *ADDR; *ADDR &= ~mask; return retval; } @@ -61,7 +61,7 @@ int ext2fs_test_bit(int nr, const void * addr) ADDR += nr >> 3; mask = 1 << (nr & 0x07); - return ((mask & *ADDR) != 0); + return (mask & *ADDR); } #endif /* !_EXT2_HAVE_ASM_BITOPS_ */ diff --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h index 6628d76..b223809 100644 --- a/lib/ext2fs/bitops.h +++ b/lib/ext2fs/bitops.h @@ -300,124 +300,6 @@ _INLINE_ int ext2fs_test_bit(int nr, const void * addr) #endif /* __mc68000__ */ -#ifdef __sparc__ - -#define _EXT2_HAVE_ASM_BITOPS_ - -#ifndef EXT2_OLD_BITOPS - -/* - * Do the bitops so that we are compatible with the standard i386 - * convention. - */ - -_INLINE_ int ext2fs_set_bit(int nr,void * addr) -{ -#if 1 - int mask; - unsigned char *ADDR = (unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - __asm__ __volatile__("ldub [%0], %%g6\n\t" - "or %%g6, %2, %%g5\n\t" - "stb %%g5, [%0]\n\t" - "and %%g6, %2, %0\n" - : "=&r" (ADDR) - : "0" (ADDR), "r" (mask) - : "g5", "g6"); - return (int) ADDR; -#else - int mask, retval; - unsigned char *ADDR = (unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - retval = (mask & *ADDR) != 0; - *ADDR |= mask; - return retval; -#endif -} - -_INLINE_ int ext2fs_clear_bit(int nr, void * addr) -{ -#if 1 - int mask; - unsigned char *ADDR = (unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - __asm__ __volatile__("ldub [%0], %%g6\n\t" - "andn %%g6, %2, %%g5\n\t" - "stb %%g5, [%0]\n\t" - "and %%g6, %2, %0\n" - : "=&r" (ADDR) - : "0" (ADDR), "r" (mask) - : "g5", "g6"); - return (int) ADDR; - -#else - int mask, retval; - unsigned char *ADDR = (unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - retval = (mask & *ADDR) != 0; - *ADDR &= ~mask; - return retval; -#endif -} - -_INLINE_ int ext2fs_test_bit(int nr, const void * addr) -{ - int mask; - const unsigned char *ADDR = (const unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - return ((mask & *ADDR) != 0); -} - -#else - -/* Do things the old, unplesant way. */ - -_INLINE_ int ext2fs_set_bit(int nr, void *addr) -{ - int mask, retval; - unsigned long *ADDR = (unsigned long *) addr; - - ADDR += nr >> 5; - mask = 1 << (nr & 31); - retval = ((mask & *ADDR) != 0); - *ADDR |= mask; - return retval; -} - -_INLINE_ int ext2fs_clear_bit(int nr, void *addr) -{ - int mask, retval; - unsigned long *ADDR = (unsigned long *) addr; - - ADDR += nr >> 5; - mask = 1 << (nr & 31); - retval = ((mask & *ADDR) != 0); - *ADDR &= ~mask; - return retval; -} - -_INLINE_ int ext2fs_test_bit(int nr, const void *addr) -{ - int mask; - const unsigned long *ADDR = (const unsigned long *) addr; - - ADDR += nr >> 5; - mask = 1 << (nr & 31); - return ((mask & *ADDR) != 0); -} -#endif - -#endif /* __sparc__ */ #if !defined(_EXT2_HAVE_ASM_SWAB_) && defined(EXT2FS_ENABLE_SWAPFS) -- 1.8.3.1