Changeset 1364eb99 in rtems


Ignore:
Timestamp:
Jun 12, 2012, 10:57:35 PM (8 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
15621db1, 50fc8f6
Parents:
fd153c73
git-author:
Joel Sherrill <joel.sherrill@…> (06/12/12 22:57:35)
git-committer:
Joel Sherrill <joel.sherrill@…> (06/12/12 22:58:01)
Message:

v850 - byte swap instructions not available on all multilibs

Location:
cpukit/score/cpu/v850/rtems/score
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/v850/rtems/score/cpu.h

    rfd153c73 r1364eb99  
    11551155)
    11561156{
    1157   unsigned int v, swapped;
    1158 
    1159   v = value;
    1160   __asm__ __volatile__ ("bsw %0, %1" : "=r" (v), "=&r" (swapped) );
     1157  unsigned int swapped;
     1158
     1159  #if (V850_HAS_BYTE_SWAP_INSTRUCTION == 1)
     1160    unsigned int v;
     1161
     1162    v = value;
     1163    __asm__ __volatile__ ("bsw %0, %1" : "=r" (v), "=&r" (swapped) );
     1164  #else
     1165    uint32_t byte1, byte2, byte3, byte4;
     1166
     1167    byte4 = (value >> 24) & 0xff;
     1168    byte3 = (value >> 16) & 0xff;
     1169    byte2 = (value >> 8)  & 0xff;
     1170    byte1 =  value        & 0xff;
     1171
     1172    swapped = (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4;
     1173  #endif
    11611174  return swapped;
    11621175}
     
    11751188static inline uint16_t CPU_swap_u16( uint16_t value )
    11761189{
    1177   unsigned int v, swapped;
    1178 
    1179   v = value;
    1180   __asm__ __volatile__ ("bsh %0, %1" : "=r" (v), "=&r" (swapped) );
     1190  unsigned int swapped;
     1191
     1192  #if (V850_HAS_BYTE_SWAP_INSTRUCTION == 1)
     1193    unsigned int v;
     1194
     1195    v = value;
     1196    __asm__ __volatile__ ("bsh %0, %1" : "=r" (v), "=&r" (swapped) );
     1197  #else
     1198    swapped = ((value & 0xff) << 8) | ((value >> 8) & 0xff);
     1199  #endif
    11811200  return swapped;
    11821201}
  • cpukit/score/cpu/v850/rtems/score/v850.h

    rfd153c73 r1364eb99  
    4141#define CPU_MODEL_NAME  "rtems_multilib"
    4242#define V850_HAS_FPU 0
     43#define V850_HAS_BYTE_SWAP_INSTRUCTION 0
    4344
    4445#elif defined(__v850e2v3__)
    4546#define CPU_MODEL_NAME  "v850e2v3"
    4647#define V850_HAS_FPU 1
     48#define V850_HAS_BYTE_SWAP_INSTRUCTION 1
    4749
    4850#elif defined(__v850e2__)
    4951#define CPU_MODEL_NAME  "v850e2"
    5052#define V850_HAS_FPU 0
     53#define V850_HAS_BYTE_SWAP_INSTRUCTION 1
    5154
    5255#elif defined(__v850es__)
    5356#define CPU_MODEL_NAME  "v850es"
    5457#define V850_HAS_FPU 0
     58#define V850_HAS_BYTE_SWAP_INSTRUCTION 1
    5559
    5660#elif defined(__v850e1__)
    5761#define CPU_MODEL_NAME  "v850e1"
    5862#define V850_HAS_FPU 0
     63#define V850_HAS_BYTE_SWAP_INSTRUCTION 1
    5964
    6065#elif defined(__v850e__)
    6166#define CPU_MODEL_NAME  "v850e"
    6267#define V850_HAS_FPU 0
     68#define V850_HAS_BYTE_SWAP_INSTRUCTION 1
    6369
    6470#else
    6571#define CPU_MODEL_NAME  "v850"
    66 #define V850_HAS_FPU     0
     72#define V850_HAS_FPU 0
     73#define V850_HAS_BYTE_SWAP_INSTRUCTION 0
    6774
    6875#endif
Note: See TracChangeset for help on using the changeset viewer.