Index: cpukit/score/include/rtems/score/chainimpl.h
===================================================================
--- cpukit/score/include/rtems/score/chainimpl.h	(revision bceb9db600427bc758d846cb02e63567e16700b8)
+++ cpukit/score/include/rtems/score/chainimpl.h	(revision 0c286e3d7c176a4fb7faf6ba9f809996d599ca10)
@@ -831,6 +831,6 @@
  * @brief Chain node order.
  *
- * @param[in] left The left node.
- * @param[in] right The right node.
+ * @param[in] left The left hand side.
+ * @param[in] right The right hand side.
  *
  * @retval true According to the order the left node precedes the right node.
@@ -838,5 +838,5 @@
  */
 typedef bool ( *Chain_Node_order )(
-  const Chain_Node *left,
+  const void       *left,
   const Chain_Node *right
 );
@@ -849,18 +849,23 @@
  * after the inserted node are not moved.
  *
- * @param[in,out] chain The chain.
- * @param[in,out] to_insert The node to insert.
+ * @param[in] the_chain The chain.
+ * @param[in] to_insert The node to insert.
+ * @param[in] left The left hand side passed to the order relation.  It must
+ *   correspond to the node to insert.  The separate left hand side parameter
+ *   may help the compiler to generate better code if it is stored in a local
+ *   variable.
  * @param[in] order The order relation.
  */
 RTEMS_INLINE_ROUTINE void _Chain_Insert_ordered_unprotected(
-  Chain_Control *chain,
-  Chain_Node *to_insert,
-  Chain_Node_order order
-)
-{
-  const Chain_Node *tail = _Chain_Immutable_tail( chain );
-  Chain_Node *next = _Chain_First( chain );
-
-  while ( next != tail && !( *order )( to_insert, next ) ) {
+  Chain_Control    *the_chain,
+  Chain_Node       *to_insert,
+  const void       *left,
+  Chain_Node_order  order
+)
+{
+  const Chain_Node *tail = _Chain_Immutable_tail( the_chain );
+  Chain_Node *next = _Chain_First( the_chain );
+
+  while ( next != tail && !( *order )( left, next ) ) {
     next = _Chain_Next( next );
   }
Index: cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h
===================================================================
--- cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h	(revision bceb9db600427bc758d846cb02e63567e16700b8)
+++ cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h	(revision 0c286e3d7c176a4fb7faf6ba9f809996d599ca10)
@@ -89,8 +89,10 @@
 )
 {
-  Scheduler_priority_SMP_Context *self =
-    _Scheduler_priority_SMP_Get_self( context );
-  Scheduler_priority_SMP_Node *node =
-    _Scheduler_priority_SMP_Node_downcast( ready_to_scheduled );
+  Scheduler_priority_SMP_Context *self;
+  Scheduler_priority_SMP_Node    *node;
+  Priority_Control                priority;
+
+  self = _Scheduler_priority_SMP_Get_self( context );
+  node = _Scheduler_priority_SMP_Node_downcast( ready_to_scheduled );
 
   _Scheduler_priority_Ready_queue_extract(
@@ -99,7 +101,9 @@
     &self->Bit_map
   );
+  priority = node->Base.priority;
   _Chain_Insert_ordered_unprotected(
     &self->Base.Scheduled,
     &node->Base.Base.Node.Chain,
+    &priority,
     _Scheduler_SMP_Insert_priority_fifo_order
   );
Index: cpukit/score/include/rtems/score/schedulersimpleimpl.h
===================================================================
--- cpukit/score/include/rtems/score/schedulersimpleimpl.h	(revision bceb9db600427bc758d846cb02e63567e16700b8)
+++ cpukit/score/include/rtems/score/schedulersimpleimpl.h	(revision 0c286e3d7c176a4fb7faf6ba9f809996d599ca10)
@@ -40,35 +40,44 @@
 
 RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_lifo_order(
-  const Chain_Node *to_insert,
+  const void       *to_insert,
   const Chain_Node *next
 )
 {
-  const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
-  const Thread_Control *thread_next = (const Thread_Control *) next;
+  const Priority_Control *priority_to_insert;
+  const Thread_Control   *thread_next;
 
-  return _Thread_Get_priority( thread_to_insert )
-    <= _Thread_Get_priority( thread_next );
+  priority_to_insert = (const Priority_Control *) to_insert;
+  thread_next = (const Thread_Control *) next;
+
+  return *priority_to_insert <= _Thread_Get_priority( thread_next );
 }
 
 RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_fifo_order(
-  const Chain_Node *to_insert,
+  const void       *to_insert,
   const Chain_Node *next
 )
 {
-  const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
-  const Thread_Control *thread_next = (const Thread_Control *) next;
+  const Priority_Control *priority_to_insert;
+  const Thread_Control   *thread_next;
 
-  return _Thread_Get_priority( thread_to_insert )
-    < _Thread_Get_priority( thread_next );
+  priority_to_insert = (const Priority_Control *) to_insert;
+  thread_next = (const Thread_Control *) next;
+
+  return *priority_to_insert < _Thread_Get_priority( thread_next );
 }
 
 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_lifo(
-  Chain_Control *chain,
+  Chain_Control  *chain,
   Thread_Control *to_insert
 )
 {
+  Priority_Control priority_to_insert;
+
+  priority_to_insert = _Thread_Get_priority( to_insert );
+
   _Chain_Insert_ordered_unprotected(
     chain,
     &to_insert->Object.Node,
+    &priority_to_insert,
     _Scheduler_simple_Insert_priority_lifo_order
   );
@@ -76,11 +85,16 @@
 
 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo(
-  Chain_Control *chain,
+  Chain_Control  *chain,
   Thread_Control *to_insert
 )
 {
+  Priority_Control priority_to_insert;
+
+  priority_to_insert = _Thread_Get_priority( to_insert );
+
   _Chain_Insert_ordered_unprotected(
     chain,
     &to_insert->Object.Node,
+    &priority_to_insert,
     _Scheduler_simple_Insert_priority_fifo_order
   );
Index: cpukit/score/include/rtems/score/schedulersmpimpl.h
===================================================================
--- cpukit/score/include/rtems/score/schedulersmpimpl.h	(revision bceb9db600427bc758d846cb02e63567e16700b8)
+++ cpukit/score/include/rtems/score/schedulersmpimpl.h	(revision 0c286e3d7c176a4fb7faf6ba9f809996d599ca10)
@@ -353,27 +353,29 @@
 
 static inline bool _Scheduler_SMP_Insert_priority_lifo_order(
-  const Chain_Node *to_insert,
+  const void       *to_insert,
   const Chain_Node *next
 )
 {
-  const Scheduler_SMP_Node *node_to_insert =
-    (const Scheduler_SMP_Node *) to_insert;
-  const Scheduler_SMP_Node *node_next =
-    (const Scheduler_SMP_Node *) next;
-
-  return node_to_insert->priority <= node_next->priority;
+  const Priority_Control   *priority_to_insert;
+  const Scheduler_SMP_Node *node_next;
+
+  priority_to_insert = (const Priority_Control *) to_insert;
+  node_next = (const Scheduler_SMP_Node *) next;
+
+  return *priority_to_insert <= node_next->priority;
 }
 
 static inline bool _Scheduler_SMP_Insert_priority_fifo_order(
-  const Chain_Node *to_insert,
+  const void       *to_insert,
   const Chain_Node *next
 )
 {
-  const Scheduler_SMP_Node *node_to_insert =
-    (const Scheduler_SMP_Node *) to_insert;
-  const Scheduler_SMP_Node *node_next =
-    (const Scheduler_SMP_Node *) next;
-
-  return node_to_insert->priority < node_next->priority;
+  const Priority_Control   *priority_to_insert;
+  const Scheduler_SMP_Node *node_next;
+
+  priority_to_insert = (const Priority_Control *) to_insert;
+  node_next = (const Scheduler_SMP_Node *) next;
+
+  return *priority_to_insert < node_next->priority;
 }
 
@@ -720,10 +722,12 @@
 )
 {
-  bool            needs_help;
-  Scheduler_Node *lowest_scheduled;
+  bool              needs_help;
+  Scheduler_Node   *lowest_scheduled;
+  Priority_Control  node_priority;
 
   lowest_scheduled = ( *get_lowest_scheduled )( context, node );
-
-  if ( ( *order )( &node->Node.Chain, &lowest_scheduled->Node.Chain ) ) {
+  node_priority = _Scheduler_SMP_Node_priority( node );
+
+  if ( ( *order )( &node_priority, &lowest_scheduled->Node.Chain ) ) {
     _Scheduler_SMP_Enqueue_to_scheduled(
       context,
@@ -777,6 +781,8 @@
     Scheduler_Node                   *highest_ready;
     Scheduler_Try_to_schedule_action  action;
+    Priority_Control                  node_priority;
 
     highest_ready = ( *get_highest_ready )( context, node );
+    node_priority = _Scheduler_SMP_Node_priority( node );
 
     /*
@@ -786,5 +792,5 @@
     if (
       node->sticky_level > 0
-        && ( *order )( &node->Node.Chain, &highest_ready->Node.Chain )
+        && ( *order )( &node_priority, &highest_ready->Node.Chain )
     ) {
       ( *insert_scheduled )( context, node );
@@ -1166,9 +1172,14 @@
 )
 {
-  Scheduler_SMP_Context *self = _Scheduler_SMP_Get_self( context );
+  Scheduler_SMP_Context *self;
+  Priority_Control       priority_to_insert;
+
+  self = _Scheduler_SMP_Get_self( context );
+  priority_to_insert = _Scheduler_SMP_Node_priority( node_to_insert );
 
   _Chain_Insert_ordered_unprotected(
     &self->Scheduled,
     &node_to_insert->Node.Chain,
+    &priority_to_insert,
     _Scheduler_SMP_Insert_priority_lifo_order
   );
@@ -1180,9 +1191,14 @@
 )
 {
-  Scheduler_SMP_Context *self = _Scheduler_SMP_Get_self( context );
+  Scheduler_SMP_Context *self;
+  Priority_Control       priority_to_insert;
+
+  self = _Scheduler_SMP_Get_self( context );
+  priority_to_insert = _Scheduler_SMP_Node_priority( node_to_insert );
 
   _Chain_Insert_ordered_unprotected(
     &self->Scheduled,
     &node_to_insert->Node.Chain,
+    &priority_to_insert,
     _Scheduler_SMP_Insert_priority_fifo_order
   );
@@ -1215,5 +1231,9 @@
 
     if ( node_state == SCHEDULER_SMP_NODE_BLOCKED ) {
-      if ( ( *order )( &node->Node.Chain, &lowest_scheduled->Node.Chain ) ) {
+      Priority_Control node_priority;
+
+      node_priority = _Scheduler_SMP_Node_priority( node );
+
+      if ( ( *order )( &node_priority, &lowest_scheduled->Node.Chain ) ) {
         _Thread_Scheduler_cancel_need_for_help(
           thread,
Index: cpukit/score/src/coremsginsert.c
===================================================================
--- cpukit/score/src/coremsginsert.c	(revision bceb9db600427bc758d846cb02e63567e16700b8)
+++ cpukit/score/src/coremsginsert.c	(revision 0c286e3d7c176a4fb7faf6ba9f809996d599ca10)
@@ -23,15 +23,15 @@
 #if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY)
 static bool _CORE_message_queue_Order(
-  const Chain_Node *left,
+  const void       *left,
   const Chain_Node *right
 )
 {
-   const CORE_message_queue_Buffer_control *left_message;
+   const int                               *left_priority;
    const CORE_message_queue_Buffer_control *right_message;
 
-   left_message = (const CORE_message_queue_Buffer_control *) left;
+   left_priority = (const int *) left;
    right_message = (const CORE_message_queue_Buffer_control *) right;
 
-   return _CORE_message_queue_Get_message_priority( left_message ) <
+   return *left_priority <
      _CORE_message_queue_Get_message_priority( right_message );
 }
@@ -67,7 +67,11 @@
 #if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY)
   } else  if ( submit_type != CORE_MESSAGE_QUEUE_URGENT_REQUEST ) {
+    int priority;
+
+    priority = _CORE_message_queue_Get_message_priority( the_message );
     _Chain_Insert_ordered_unprotected(
       pending_messages,
       &the_message->Node,
+      &priority,
       _CORE_message_queue_Order
     );
Index: cpukit/score/src/schedulerpriorityaffinitysmp.c
===================================================================
--- cpukit/score/src/schedulerpriorityaffinitysmp.c	(revision bceb9db600427bc758d846cb02e63567e16700b8)
+++ cpukit/score/src/schedulerpriorityaffinitysmp.c	(revision 0c286e3d7c176a4fb7faf6ba9f809996d599ca10)
@@ -41,5 +41,5 @@
 
 static bool _Scheduler_priority_affinity_SMP_Insert_priority_lifo_order(
-  const Chain_Node *to_insert,
+  const void       *to_insert,
   const Chain_Node *next
 )
@@ -50,5 +50,5 @@
 
 static bool _Scheduler_priority_affinity_SMP_Insert_priority_fifo_order(
-  const Chain_Node *to_insert,
+  const void       *to_insert,
   const Chain_Node *next
 )
@@ -284,4 +284,6 @@
 
   while (1) {
+    Priority_Control lowest_scheduled_priority;
+
     if ( _Priority_bit_map_Is_empty( &self->Bit_map ) ) {
       /* Nothing to do */
@@ -311,7 +313,10 @@
       break;
 
+    lowest_scheduled_priority =
+      _Scheduler_SMP_Node_priority( lowest_scheduled );
+
     if (
       _Scheduler_SMP_Insert_priority_lifo_order(
-        &lowest_scheduled->Node.Chain,
+        &lowest_scheduled_priority,
         &highest_ready->Node.Chain
       )
Index: cpukit/score/src/schedulersimplesmp.c
===================================================================
--- cpukit/score/src/schedulersimplesmp.c	(revision bceb9db600427bc758d846cb02e63567e16700b8)
+++ cpukit/score/src/schedulersimplesmp.c	(revision 0c286e3d7c176a4fb7faf6ba9f809996d599ca10)
@@ -99,6 +99,9 @@
 )
 {
-  Scheduler_simple_SMP_Context *self =
-    _Scheduler_simple_SMP_Get_self( context );
+  Scheduler_simple_SMP_Context *self;
+  Priority_Control              priority_to_insert;
+
+  self = _Scheduler_simple_SMP_Get_self( context );
+  priority_to_insert = _Scheduler_SMP_Node_priority( scheduled_to_ready );
 
   _Chain_Extract_unprotected( &scheduled_to_ready->Node.Chain );
@@ -106,4 +109,5 @@
     &self->Ready,
     &scheduled_to_ready->Node.Chain,
+    &priority_to_insert,
     _Scheduler_SMP_Insert_priority_lifo_order
   );
@@ -115,6 +119,9 @@
 )
 {
-  Scheduler_simple_SMP_Context *self =
-    _Scheduler_simple_SMP_Get_self( context );
+  Scheduler_simple_SMP_Context *self;
+  Priority_Control              priority_to_insert;
+
+  self = _Scheduler_simple_SMP_Get_self( context );
+  priority_to_insert = _Scheduler_SMP_Node_priority( ready_to_scheduled );
 
   _Chain_Extract_unprotected( &ready_to_scheduled->Node.Chain );
@@ -122,4 +129,5 @@
     &self->Base.Scheduled,
     &ready_to_scheduled->Node.Chain,
+    &priority_to_insert,
     _Scheduler_SMP_Insert_priority_fifo_order
   );
@@ -131,10 +139,14 @@
 )
 {
-  Scheduler_simple_SMP_Context *self =
-    _Scheduler_simple_SMP_Get_self( context );
+  Scheduler_simple_SMP_Context *self;
+  Priority_Control              priority_to_insert;
+
+  self = _Scheduler_simple_SMP_Get_self( context );
+  priority_to_insert = _Scheduler_SMP_Node_priority( node_to_insert );
 
   _Chain_Insert_ordered_unprotected(
     &self->Ready,
     &node_to_insert->Node.Chain,
+    &priority_to_insert,
     _Scheduler_SMP_Insert_priority_lifo_order
   );
@@ -146,10 +158,14 @@
 )
 {
-  Scheduler_simple_SMP_Context *self =
-    _Scheduler_simple_SMP_Get_self( context );
+  Scheduler_simple_SMP_Context *self;
+  Priority_Control              priority_to_insert;
+
+  self = _Scheduler_simple_SMP_Get_self( context );
+  priority_to_insert = _Scheduler_SMP_Node_priority( node_to_insert );
 
   _Chain_Insert_ordered_unprotected(
     &self->Ready,
     &node_to_insert->Node.Chain,
+    &priority_to_insert,
     _Scheduler_SMP_Insert_priority_fifo_order
   );
Index: cpukit/score/src/schedulerstrongapa.c
===================================================================
--- cpukit/score/src/schedulerstrongapa.c	(revision bceb9db600427bc758d846cb02e63567e16700b8)
+++ cpukit/score/src/schedulerstrongapa.c	(revision 0c286e3d7c176a4fb7faf6ba9f809996d599ca10)
@@ -65,8 +65,10 @@
 )
 {
-  Scheduler_strong_APA_Context *self =
-    _Scheduler_strong_APA_Get_self( context );
-  Scheduler_strong_APA_Node *node =
-    _Scheduler_strong_APA_Node_downcast( ready_to_scheduled );
+  Scheduler_strong_APA_Context *self;
+  Scheduler_strong_APA_Node    *node;
+  Priority_Control              priority;
+
+  self = _Scheduler_strong_APA_Get_self( context );
+  node = _Scheduler_strong_APA_Node_downcast( ready_to_scheduled );
 
   _Scheduler_priority_Ready_queue_extract(
@@ -75,7 +77,9 @@
     &self->Bit_map
   );
+  priority = node->Base.priority;
   _Chain_Insert_ordered_unprotected(
     &self->Base.Scheduled,
     &node->Base.Base.Node.Chain,
+    &priority,
     _Scheduler_SMP_Insert_priority_fifo_order
   );
Index: testsuites/sptests/spchain/init.c
===================================================================
--- testsuites/sptests/spchain/init.c	(revision bceb9db600427bc758d846cb02e63567e16700b8)
+++ testsuites/sptests/spchain/init.c	(revision 0c286e3d7c176a4fb7faf6ba9f809996d599ca10)
@@ -427,7 +427,12 @@
 }
 
-static bool test_order( const Chain_Node *left, const Chain_Node *right )
-{
-  return left < right;
+static bool test_order( const void *left, const Chain_Node *right )
+{
+  return (uintptr_t) left < (uintptr_t) right;
+}
+
+static void insert_ordered( Chain_Control *chain, Chain_Node *node )
+{
+  _Chain_Insert_ordered_unprotected( chain, node, node, test_order );
 }
 
@@ -447,9 +452,9 @@
   }
 
-  _Chain_Insert_ordered_unprotected( &chain, &nodes[4], test_order );
-  _Chain_Insert_ordered_unprotected( &chain, &nodes[2], test_order );
-  _Chain_Insert_ordered_unprotected( &chain, &nodes[0], test_order );
-  _Chain_Insert_ordered_unprotected( &chain, &nodes[3], test_order );
-  _Chain_Insert_ordered_unprotected( &chain, &nodes[1], test_order );
+  insert_ordered( &chain, &nodes[4] );
+  insert_ordered( &chain, &nodes[2] );
+  insert_ordered( &chain, &nodes[0] );
+  insert_ordered( &chain, &nodes[3] );
+  insert_ordered( &chain, &nodes[1] );
 
   tail = _Chain_Immutable_tail( &chain );
