[rtems commit] score: Delete CPU_USE_GENERIC_BITFIELD_DATA

Sebastian Huber sebh at rtems.org
Thu Jun 9 08:49:38 UTC 2016


Module:    rtems
Branch:    master
Commit:    18e29faf9898a4011e042daaa75bc30a7b56ffdd
Changeset: http://git.rtems.org/rtems/commit/?id=18e29faf9898a4011e042daaa75bc30a7b56ffdd

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jun  8 10:10:40 2016 +0200

score: Delete CPU_USE_GENERIC_BITFIELD_DATA

Rename __log2table into _Bitfield_Leading_zeros since it acually returns
the count of leading zeros of an 8-bit integer.  The value for zero is a
bit odd.  Provide it unconditionally.

---

 cpukit/score/cpu/arm/rtems/score/cpu.h                 |  2 --
 cpukit/score/cpu/bfin/rtems/score/cpu.h                |  2 --
 cpukit/score/cpu/epiphany/rtems/score/cpu.h            |  2 --
 cpukit/score/cpu/i386/rtems/score/cpu.h                |  1 -
 cpukit/score/cpu/lm32/rtems/score/cpu.h                |  2 --
 cpukit/score/cpu/m32c/rtems/score/cpu.h                |  2 --
 cpukit/score/cpu/m68k/rtems/score/cpu.h                |  1 -
 cpukit/score/cpu/mips/rtems/score/cpu.h                |  2 --
 cpukit/score/cpu/moxie/rtems/score/cpu.h               |  2 --
 cpukit/score/cpu/nios2/rtems/score/cpu.h               |  2 --
 cpukit/score/cpu/nios2/rtems/score/nios2-count-zeros.h |  8 ++++----
 cpukit/score/cpu/no_cpu/rtems/score/cpu.h              | 10 ----------
 cpukit/score/cpu/or1k/rtems/score/cpu.h                |  2 --
 cpukit/score/cpu/powerpc/rtems/score/cpu.h             |  2 --
 cpukit/score/cpu/sh/rtems/score/cpu.h                  |  2 --
 cpukit/score/cpu/sparc/rtems/score/cpu.h               |  6 ------
 cpukit/score/cpu/sparc64/rtems/score/cpu.h             |  1 -
 cpukit/score/cpu/v850/rtems/score/cpu.h                |  2 --
 cpukit/score/include/rtems/score/prioritybitmapimpl.h  |  8 ++------
 cpukit/score/src/log2table.c                           |  4 +---
 20 files changed, 7 insertions(+), 56 deletions(-)

diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h
index 4380590..815cd95 100644
--- a/cpukit/score/cpu/arm/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/rtems/score/cpu.h
@@ -200,8 +200,6 @@
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
 #define CPU_MAXIMUM_PROCESSORS 32
diff --git a/cpukit/score/cpu/bfin/rtems/score/cpu.h b/cpukit/score/cpu/bfin/rtems/score/cpu.h
index 1bff479..19b1f03 100644
--- a/cpukit/score/cpu/bfin/rtems/score/cpu.h
+++ b/cpukit/score/cpu/bfin/rtems/score/cpu.h
@@ -851,8 +851,6 @@ void _CPU_Context_Initialize(
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 /* functions */
 
 /**
diff --git a/cpukit/score/cpu/epiphany/rtems/score/cpu.h b/cpukit/score/cpu/epiphany/rtems/score/cpu.h
index c59e54f..e1dae21 100644
--- a/cpukit/score/cpu/epiphany/rtems/score/cpu.h
+++ b/cpukit/score/cpu/epiphany/rtems/score/cpu.h
@@ -680,8 +680,6 @@ void _CPU_Context_Initialize(
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 typedef struct {
 /* There is no CPU specific per-CPU state */
 } CPU_Per_CPU_control;
diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h b/cpukit/score/cpu/i386/rtems/score/cpu.h
index 8f92b2e..3f0e336 100644
--- a/cpukit/score/cpu/i386/rtems/score/cpu.h
+++ b/cpukit/score/cpu/i386/rtems/score/cpu.h
@@ -549,7 +549,6 @@ extern void _CPU_Fatal_halt(uint32_t source, uint32_t error)
  */
 
 #define CPU_USE_GENERIC_BITFIELD_CODE FALSE
-#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
 
 #define _CPU_Bitfield_Find_first_bit( _value, _output ) \
   { \
diff --git a/cpukit/score/cpu/lm32/rtems/score/cpu.h b/cpukit/score/cpu/lm32/rtems/score/cpu.h
index 325a8a4..fe948ae 100644
--- a/cpukit/score/cpu/lm32/rtems/score/cpu.h
+++ b/cpukit/score/cpu/lm32/rtems/score/cpu.h
@@ -883,8 +883,6 @@ extern char _gp[];
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 /* functions */
 
 /**
diff --git a/cpukit/score/cpu/m32c/rtems/score/cpu.h b/cpukit/score/cpu/m32c/rtems/score/cpu.h
index f980abc..f56e9d7 100644
--- a/cpukit/score/cpu/m32c/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m32c/rtems/score/cpu.h
@@ -871,8 +871,6 @@ void _CPU_Context_Restart_self(
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 /* functions */
 
 /**
diff --git a/cpukit/score/cpu/m68k/rtems/score/cpu.h b/cpukit/score/cpu/m68k/rtems/score/cpu.h
index 470391a..a426647 100644
--- a/cpukit/score/cpu/m68k/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m68k/rtems/score/cpu.h
@@ -491,7 +491,6 @@ void *_CPU_Thread_Idle_body( uintptr_t ignored );
  */
 
 #define CPU_USE_GENERIC_BITFIELD_CODE FALSE
-#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
 
 #if ( M68K_HAS_BFFFO != 1 )
 /*
diff --git a/cpukit/score/cpu/mips/rtems/score/cpu.h b/cpukit/score/cpu/mips/rtems/score/cpu.h
index 6a0c36e..59150ac 100644
--- a/cpukit/score/cpu/mips/rtems/score/cpu.h
+++ b/cpukit/score/cpu/mips/rtems/score/cpu.h
@@ -884,8 +884,6 @@ extern void mips_break( int error );
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 /* functions */
 
 /*
diff --git a/cpukit/score/cpu/moxie/rtems/score/cpu.h b/cpukit/score/cpu/moxie/rtems/score/cpu.h
index 5ba8673..3211c3b 100644
--- a/cpukit/score/cpu/moxie/rtems/score/cpu.h
+++ b/cpukit/score/cpu/moxie/rtems/score/cpu.h
@@ -680,8 +680,6 @@ uint32_t   _CPU_ISR_Get_level( void );
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 /* functions */
 
 /*
diff --git a/cpukit/score/cpu/nios2/rtems/score/cpu.h b/cpukit/score/cpu/nios2/rtems/score/cpu.h
index 0dd7ed4..4c56de0 100644
--- a/cpukit/score/cpu/nios2/rtems/score/cpu.h
+++ b/cpukit/score/cpu/nios2/rtems/score/cpu.h
@@ -105,8 +105,6 @@ extern "C" {
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 #define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0
 
 #define CPU_PER_CPU_CONTROL_SIZE 0
diff --git a/cpukit/score/cpu/nios2/rtems/score/nios2-count-zeros.h b/cpukit/score/cpu/nios2/rtems/score/nios2-count-zeros.h
index 0ec259a..bf2390a 100644
--- a/cpukit/score/cpu/nios2/rtems/score/nios2-count-zeros.h
+++ b/cpukit/score/cpu/nios2/rtems/score/nios2-count-zeros.h
@@ -37,17 +37,17 @@ static inline unsigned _Nios2_Count_leading_zeros( uint32_t p )
 
   if ( p <= 0xffffu ) {
     if ( p < 0x100u ) {
-      bitIdx = __log2table[ p ] + 24u;
+      bitIdx = _Bitfield_Leading_zeros[ p ] + 24u;
     } else {
-      bitIdx = __log2table[ p >> 8u ] + 16u;
+      bitIdx = _Bitfield_Leading_zeros[ p >> 8u ] + 16u;
     }
   } else {
     p >>= 16u;
 
     if ( p < 0x100u ) {
-      bitIdx = __log2table[ p ] + 8u;
+      bitIdx = _Bitfield_Leading_zeros[ p ] + 8u;
     } else {
-      bitIdx = __log2table[ p >> 8u ];
+      bitIdx = _Bitfield_Leading_zeros[ p >> 8u ];
     }
   }
 
diff --git a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
index a56bc17..944f04a 100644
--- a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
+++ b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
@@ -1012,16 +1012,6 @@ uint32_t   _CPU_ISR_Get_level( void );
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
 /**
- * This definition is set to TRUE if the port uses the data tables provided
- * by the generic bitfield manipulation implementation.
- * This can occur when actually using the generic bitfield manipulation
- * implementation or when implementing the same algorithm in assembly
- * language for improved performance.  It is unlikely that a port will use
- * the data if it has a bitfield scan instruction.
- */
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
-/**
  * This routine sets @a _output to the bit number of the first bit
  * set in @a _value.  @a _value is of CPU dependent type
  * @a Priority_bit_map_Word.  This type may be either 16 or 32 bits
diff --git a/cpukit/score/cpu/or1k/rtems/score/cpu.h b/cpukit/score/cpu/or1k/rtems/score/cpu.h
index 919017b..c75d9d8 100644
--- a/cpukit/score/cpu/or1k/rtems/score/cpu.h
+++ b/cpukit/score/cpu/or1k/rtems/score/cpu.h
@@ -675,8 +675,6 @@ void _CPU_Context_Initialize(
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 typedef struct {
 /* There is no CPU specific per-CPU state */
 } CPU_Per_CPU_control;
diff --git a/cpukit/score/cpu/powerpc/rtems/score/cpu.h b/cpukit/score/cpu/powerpc/rtems/score/cpu.h
index 287f73d..beb5127 100644
--- a/cpukit/score/cpu/powerpc/rtems/score/cpu.h
+++ b/cpukit/score/cpu/powerpc/rtems/score/cpu.h
@@ -922,8 +922,6 @@ void _CPU_Context_Initialize(
 
 #define CPU_USE_GENERIC_BITFIELD_CODE FALSE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
-
 /*
  *  This routine sets _output to the bit number of the first bit
  *  set in _value.  _value is of CPU dependent type Priority_bit_map_Word.
diff --git a/cpukit/score/cpu/sh/rtems/score/cpu.h b/cpukit/score/cpu/sh/rtems/score/cpu.h
index 8a1cc7f..53c7eb5 100644
--- a/cpukit/score/cpu/sh/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sh/rtems/score/cpu.h
@@ -652,8 +652,6 @@ void _CPU_Context_Initialize(
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 /* functions */
 
 /*
diff --git a/cpukit/score/cpu/sparc/rtems/score/cpu.h b/cpukit/score/cpu/sparc/rtems/score/cpu.h
index 96b6ac5..ea90e36 100644
--- a/cpukit/score/cpu/sparc/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc/rtems/score/cpu.h
@@ -1113,12 +1113,6 @@ extern void _CPU_Fatal_halt(uint32_t source, uint32_t error)
    * CPU model does not have a scan instruction.
    */
   #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
-  /**
-   * The SPARC port uses the generic C algorithm for bitfield scan if the
-   * CPU model does not have a scan instruction.  Thus is needs the generic
-   * data table used by that algorithm.
-   */
-  #define CPU_USE_GENERIC_BITFIELD_DATA TRUE
 #else
   #error "scan instruction not currently supported by RTEMS!!"
 #endif
diff --git a/cpukit/score/cpu/sparc64/rtems/score/cpu.h b/cpukit/score/cpu/sparc64/rtems/score/cpu.h
index a669c54..d2fc81f 100644
--- a/cpukit/score/cpu/sparc64/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc64/rtems/score/cpu.h
@@ -891,7 +891,6 @@ void _CPU_Context_Initialize(
 
 #if ( SPARC_HAS_BITSCAN == 0 )
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
 #else
 #error "scan instruction not currently supported by RTEMS!!"
 #endif
diff --git a/cpukit/score/cpu/v850/rtems/score/cpu.h b/cpukit/score/cpu/v850/rtems/score/cpu.h
index ffbb510..de655c0 100644
--- a/cpukit/score/cpu/v850/rtems/score/cpu.h
+++ b/cpukit/score/cpu/v850/rtems/score/cpu.h
@@ -835,8 +835,6 @@ void _CPU_Context_Initialize(
 
 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE
 
-#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
-
 /* functions */
 
 /**
diff --git a/cpukit/score/include/rtems/score/prioritybitmapimpl.h b/cpukit/score/include/rtems/score/prioritybitmapimpl.h
index de90ef7..492dbd3 100644
--- a/cpukit/score/include/rtems/score/prioritybitmapimpl.h
+++ b/cpukit/score/include/rtems/score/prioritybitmapimpl.h
@@ -33,16 +33,12 @@ extern "C" {
  */
 /**@{**/
 
-#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE )
-
 /**
  *  This table is used by the generic bitfield routines to perform
  *  a highly optimized bit scan without the use of special CPU
  *  instructions.
  */
-extern const unsigned char __log2table[256];
-
-#endif
+extern const unsigned char _Bitfield_Leading_zeros[256];
 
 /**
  *  @brief Gets the @a _bit_number of the first bit set in the specified value.
@@ -70,7 +66,7 @@ extern const unsigned char __log2table[256];
 #define _Bitfield_Find_first_bit( _value, _bit_number ) \
   { \
     register uint32_t   __value = (uint32_t) (_value); \
-    register const unsigned char *__p = __log2table; \
+    register const unsigned char *__p = _Bitfield_Leading_zeros; \
     \
     if ( __value < 0x100 ) \
       (_bit_number) = (Priority_bit_map_Word)( __p[ __value ] + 8 );  \
diff --git a/cpukit/score/src/log2table.c b/cpukit/score/src/log2table.c
index f81f821..19a9c8a 100644
--- a/cpukit/score/src/log2table.c
+++ b/cpukit/score/src/log2table.c
@@ -21,8 +21,7 @@
 
 #include <rtems/score/prioritybitmapimpl.h>
 
-#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE )
-const unsigned char __log2table[256] = {
+const unsigned char _Bitfield_Leading_zeros[256] = {
     7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
     2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -40,4 +39,3 @@ const unsigned char __log2table[256] = {
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
-#endif



More information about the vc mailing list