Home | History | Annotate | Download | only in libc
      1 /*
      2  * Copyright (c) 2014 ARM Ltd
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  * 1. Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  * 2. Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in the
     12  *    documentation and/or other materials provided with the distribution.
     13  * 3. The name of the company may not be used to endorse or promote
     14  *    products derived from this software without specific prior written
     15  *    permission.
     16  *
     17  * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
     18  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20  * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
     22  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     24  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     25  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27  */
     28 
     29 #ifndef __ARM_ARCH
     30 
     31 /* ACLE standardises a set of pre-defines that describe the ARM architecture.
     32    These were mostly implemented in GCC around GCC-4.8; older versions
     33    have no, or only partial support.  To provide a level of backwards
     34    compatibility we try to work out what the definitions should be, given
     35    the older pre-defines that GCC did produce.  This isn't complete, but
     36    it should be enough for use by routines that depend on this header.  */
     37 
     38 /* No need to handle ARMv8, GCC had ACLE support before that.  */
     39 
     40 # ifdef __ARM_ARCH_7__
     41 /* The common subset of ARMv7 in all profiles.  */
     42 #  define __ARM_ARCH 7
     43 #  define __ARM_ARCH_ISA_THUMB 2
     44 #  define __ARM_FEATURE_CLZ
     45 #  define __ARM_FEATURE_LDREX 7
     46 #  define __ARM_FEATURE_UNALIGNED
     47 # endif
     48 
     49 # if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__)
     50 #  define __ARM_ARCH 7
     51 #  define __ARM_ARCH_ISA_THUMB 2
     52 #  define __ARM_ARCH_ISA_ARM
     53 #  define __ARM_FEATURE_CLZ
     54 #  define __ARM_FEATURE_SIMD32
     55 #  define __ARM_FEATURE_DSP
     56 #  define __ARM_FEATURE_QBIT
     57 #  define __ARM_FEATURE_SAT
     58 #  define __ARM_FEATURE_LDREX 15
     59 #  define __ARM_FEATURE_UNALIGNED
     60 #  ifdef __ARM_ARCH_7A__
     61 #   define __ARM_ARCH_PROFILE 'A'
     62 #  else
     63 #   define __ARM_ARCH_PROFILE 'R'
     64 #  endif
     65 # endif
     66 
     67 # ifdef __ARM_ARCH_7EM__
     68 #  define __ARM_ARCH 7
     69 #  define __ARM_ARCH_ISA_THUMB 2
     70 #  define __ARM_FEATURE_CLZ
     71 #  define __ARM_FEATURE_SIMD32
     72 #  define __ARM_FEATURE_DSP
     73 #  define __ARM_FEATURE_QBIT
     74 #  define __ARM_FEATURE_SAT
     75 #  define __ARM_FEATURE_LDREX 7
     76 #  define __ARM_FEATURE_UNALIGNED
     77 #  define __ARM_ARCH_PROFILE 'M'
     78 # endif
     79 
     80 # ifdef __ARM_ARCH_7M__
     81 #  define __ARM_ARCH 7
     82 #  define __ARM_ARCH_ISA_THUMB 2
     83 #  define __ARM_FEATURE_CLZ
     84 #  define __ARM_FEATURE_QBIT
     85 #  define __ARM_FEATURE_SAT
     86 #  define __ARM_FEATURE_LDREX 7
     87 #  define __ARM_FEATURE_UNALIGNED
     88 #  define __ARM_ARCH_PROFILE 'M'
     89 # endif
     90 
     91 # ifdef __ARM_ARCH_6T2__
     92 #  define __ARM_ARCH 6
     93 #  define __ARM_ARCH_ISA_THUMB 2
     94 #  define __ARM_ARCH_ISA_ARM
     95 #  define __ARM_FEATURE_CLZ
     96 #  define __ARM_FEATURE_SIMD32
     97 #  define __ARM_FEATURE_DSP
     98 #  define __ARM_FEATURE_QBIT
     99 #  define __ARM_FEATURE_SAT
    100 #  define __ARM_FEATURE_LDREX 4
    101 #  define __ARM_FEATURE_UNALIGNED
    102 # endif
    103 
    104 # ifdef __ARM_ARCH_6M__
    105 #  define __ARM_ARCH 6
    106 #  define __ARM_ARCH_ISA_THUMB 1
    107 #  define __ARM_ARCH_PROFILE 'M'
    108 # endif
    109 
    110 # if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) \
    111   || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) \
    112   || defined (__ARM_ARCH_6ZK__)
    113 #  define __ARM_ARCH 6
    114 #  define __ARM_ARCH_ISA_THUMB 1
    115 #  define __ARM_ARCH_ISA_ARM
    116 #  define __ARM_FEATURE_CLZ
    117 #  define __ARM_FEATURE_SIMD32
    118 #  define __ARM_FEATURE_DSP
    119 #  define __ARM_FEATURE_QBIT
    120 #  define __ARM_FEATURE_SAT
    121 #  define __ARM_FEATURE_UNALIGNED
    122 #  ifndef __thumb__
    123 #   if defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
    124 #    define __ARM_FEATURE_LDREX 15
    125 #   else
    126 #    define __ARM_FEATURE_LDREX 4
    127 #   endif
    128 #  endif
    129 # endif
    130 
    131 # if defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5E__)
    132 #  define __ARM_ARCH 5
    133 #  define __ARM_ARCH_ISA_ARM
    134 #  ifdef __ARM_ARCH_5TE__
    135 #   define __ARM_ARCH_ISA_THUMB 1
    136 #  endif
    137 #  define __ARM_FEATURE_CLZ
    138 #  define __ARM_FEATURE_DSP
    139 # endif
    140 
    141 # if defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5__)
    142 #  define __ARM_ARCH 5
    143 #  define __ARM_ARCH_ISA_ARM
    144 #  ifdef __ARM_ARCH_5TE__
    145 #   define __ARM_ARCH_ISA_THUMB 1
    146 #  endif
    147 #  define __ARM_FEATURE_CLZ
    148 # endif
    149 
    150 # ifdef __ARM_ARCH_4T__
    151 #  define __ARM_ARCH 4
    152 #  define __ARM_ARCH_ISA_ARM
    153 #  define __ARM_ARCH_ISA_THUMB 1
    154 # endif
    155 
    156 # ifdef __ARM_ARCH_4__
    157 #  define __ARM_ARCH 4
    158 #  define __ARM_ARCH_ISA_ARM
    159 # endif
    160 
    161 # if defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__)
    162 #  define __ARM_ARCH 3
    163 #  define __ARM_ARCH_ISA_ARM
    164 # endif
    165 
    166 # ifdef __ARM_ARCH_2__
    167 #  define __ARM_ARCH 2
    168 #  define __ARM_ARCH_ISA_ARM
    169 # endif
    170 
    171 # ifdef __ARMEB__
    172 #  define __ARM_BIG_ENDIAN
    173 # endif
    174 
    175 /* If we still don't know what the target architecture is, then we're
    176    probably not using GCC.  */
    177 # ifndef __ARM_ARCH
    178 #  error Unable to determine architecture version.
    179 # endif
    180 
    181 #endif /* __ARM_ARCH  */
    182 
    183