Changeset 0c508af in rtems


Ignore:
Timestamp:
Apr 27, 1998, 6:18:13 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
96d56b3
Parents:
b0aba4c4
Message:

Added I386_HAS_BSWAP cpu model feature flag so swap u32 could take
advantage of this instruction.

Also up conditionals mapping cpu models to feature flags by having a
section which defaults all the i386 family feature flags to the most
common value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/cpu/i386/i386.h

    rb0aba4c4 r0c508af  
    3737 *    pentium
    3838 *
    39  *  Floating point is the only feature which currently varies.  Eventually
    40  *  the i486-plus level instruction for endian swapping should be added
    41  *  to this feature list.
     39 *  CPU Model Feature Flags:
     40 *
     41 *  I386_HAS_BSWAP:  Defined to "1" if the instruction for endian swapping
     42 *                   (bswap) should be used.  This instruction appears to
     43 *                   be present in all i486's and above.
     44 *
     45 *  I386_HAS_FPU:    Defined to "1" if the CPU has an FPU.
     46 *
    4247 */
    4348
     
    4550
    4651#define CPU_MODEL_NAME  "i386 with i387"
    47 #define I386_HAS_FPU 1
     52#define I386_HAS_BSWAP 0
    4853
    4954#elif defined(i386_nofp)
    5055
    5156#define CPU_MODEL_NAME  "i386 w/o i387"
    52 #define I386_HAS_FPU 0
     57#define I386_HAS_FPU   0
     58#define I386_HAS_BSWAP 0
    5359
    5460#elif defined(i486dx)
    5561
    5662#define CPU_MODEL_NAME  "i486dx"
    57 #define I386_HAS_FPU 1
    5863
    5964#elif defined(i486sx)
     
    6570
    6671#define CPU_MODEL_NAME  "Pentium"
     72
     73#else
     74
     75#error "Unsupported CPU Model"
     76
     77#endif
     78
     79/*
     80 *  Set default values for CPU model feature flags
     81 *
     82 *  NOTE: These settings are chosen to reflect most of the family members.
     83 */
     84
     85#ifndef I386_HAS_FPU
    6786#define I386_HAS_FPU 1
    68 
    69 #else
    70 
    71 #error "Unsupported CPU Model"
    72 
     87#endif
     88
     89#ifndef I386_HAS_BSWAP
     90#define I386_HAS_BSWAP 1
    7391#endif
    7492
     
    168186  unsigned long lout;
    169187
     188#if (I386_HAS_BSWAP == 0)
    170189  asm volatile( "rorw  $8,%%ax;"
    171190                "rorl  $16,%0;"
    172191                "rorw  $8,%%ax" : "=a" (lout) : "0" (value) );
    173 /* this should be better for i486dx and above */
    174 /*
     192#else
    175193    __asm__ volatile( "bswap %0" : "=r"  (lout) : "0"   (lin));
    176 */
     194#endif
    177195  return( lout );
    178196}
Note: See TracChangeset for help on using the changeset viewer.