Home | History | Annotate | Download | only in Preprocessor
      1 // RUN: %clang -target armv8a-none-linux-gnu -x c -E -dM %s -o - | FileCheck %s
      2 // CHECK: __ARMEL__ 1
      3 // CHECK: __ARM_ARCH 8
      4 // CHECK: __ARM_ARCH_8A__ 1
      5 // CHECK: __ARM_FEATURE_CRC32 1
      6 
      7 // RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V7 %s
      8 // CHECK-V7: __ARMEL__ 1
      9 // CHECK-V7: __ARM_ARCH 7
     10 // CHECK-V7: __ARM_ARCH_7A__ 1
     11 // CHECK-V7-NOT: __ARM_FEATURE_CRC32
     12 
     13 // RUN: %clang -target armv8a -mfloat-abi=hard -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF %s
     14 // CHECK-V8-BAREHF: __ARMEL__ 1
     15 // CHECK-V8-BAREHF: __ARM_ARCH 8
     16 // CHECK-V8-BAREHF: __ARM_ARCH_8A__ 1
     17 // CHECK-V8-BAREHF: __ARM_FEATURE_CRC32 1
     18 // CHECK-V8-BAREHF: __ARM_NEON__ 1
     19 // CHECK-V8-BAREHF: __VFP_FP__ 1
     20 
     21 // RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-FP %s
     22 // CHECK-V8-BAREHF-FP-NOT: __ARM_NEON__ 1
     23 // CHECK-V8-BAREHF-FP: __VFP_FP__ 1
     24 
     25 // RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=neon-fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-NEON-FP %s
     26 // RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-NEON-FP %s
     27 // CHECK-V8-BAREHF-NEON-FP: __ARM_NEON__ 1
     28 // CHECK-V8-BAREHF-NEON-FP: __VFP_FP__ 1
     29 
     30 // RUN: %clang -target armv8a -mnocrc -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-NOCRC %s
     31 // CHECK-V8-NOCRC-NOT: __ARM_FEATURE_CRC32 1
     32 
     33 // Check that -mhwdiv works properly for armv8/thumbv8 (enabled by default).
     34 
     35 // RUN: %clang -target armv8 -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8 %s
     36 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
     37 
     38 // RUN: %clang -target armv8 -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8 %s
     39 // THUMBV8:#define __ARM_ARCH_EXT_IDIV__ 1
     40 
     41 // RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8-EABI %s
     42 // ARMV8-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
     43 
     44 // RUN: %clang -target armv8-eabi -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8-EABI %s
     45 // THUMBV8-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
     46 
     47 // RUN: %clang -target armv8 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=NONEHWDIV-ARMV8 %s
     48 // NONEHWDIV-ARMV8-NOT:#define __ARM_ARCH_EXT_IDIV__
     49 
     50 // RUN: %clang -target armv8 -mthumb -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=NONEHWDIV-THUMBV8 %s
     51 // NONEHWDIV-THUMBV8-NOT:#define __ARM_ARCH_EXT_IDIV__
     52 
     53 // RUN: %clang -target armv8 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBHWDIV-ARMV8 %s
     54 // THUMBHWDIV-ARMV8-NOT:#define __ARM_ARCH_EXT_IDIV__
     55 
     56 // RUN: %clang -target armv8 -mthumb -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-THUMBV8 %s
     57 // ARMHWDIV-THUMBV8-NOT:#define __ARM_ARCH_EXT_IDIV__
     58 
     59 // RUN: %clang -target armv8a -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8A %s
     60 // ARMV8A:#define __ARM_ARCH_EXT_IDIV__ 1
     61 
     62 // RUN: %clang -target armv8a -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8A %s
     63 // THUMBV8A:#define __ARM_ARCH_EXT_IDIV__ 1
     64 
     65 // RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8A-EABI %s
     66 // ARMV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
     67 
     68 // RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8A-EABI %s
     69 // THUMBV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
     70 
     71 // RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-DEFS %s
     72 // CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
     73 // CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
     74 
     75 // RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTWCHAR %s
     76 // CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
     77 
     78 // RUN: %clang -target arm-none-linux-gnu -fshort-enums -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTENUMS %s
     79 // CHECK-SHORTENUMS:#define __ARM_SIZEOF_MINIMAL_ENUM 1
     80 
     81 // Test that -mhwdiv has the right effect for a target CPU which has hwdiv enabled by default.
     82 // RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-ARM %s
     83 // DEFAULTHWDIV-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
     84 
     85 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-THUMB %s
     86 // DEFAULTHWDIV-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
     87 
     88 // RUN: %clang -target armv7 -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-ARM %s
     89 // ARMHWDIV-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
     90 
     91 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBHWDIV-THUMB %s
     92 // THUMBHWDIV-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
     93 
     94 // RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-THUMBHWDIV-ARM %s
     95 // DEFAULTHWDIV-THUMBHWDIV-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
     96 
     97 // RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-ARMHWDIV-THUMB %s
     98 // DEFAULTHWDIV-ARMHWDIV-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
     99 
    100 // RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-NONEHWDIV-ARM %s
    101 // DEFAULTHWDIV-NONEHWDIV-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
    102 
    103 // RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-NONEHWDIV-THUMB %s
    104 // DEFAULTHWDIV-NONEHWDIV-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
    105 
    106 
    107 // Check that -mfpu works properly for Cortex-A7 (enabled by default).
    108 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A7 %s
    109 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A7 %s
    110 // DEFAULTFPU-A7:#define __ARM_NEON__ 1
    111 // DEFAULTFPU-A7:#define __ARM_VFPV4__ 1
    112 
    113 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A7 %s
    114 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A7 %s
    115 // FPUNONE-A7-NOT:#define __ARM_NEON__ 1
    116 // FPUNONE-A7-NOT:#define __ARM_VFPV4__ 1
    117 
    118 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A7 %s
    119 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A7 %s
    120 // NONEON-A7-NOT:#define __ARM_NEON__ 1
    121 // NONEON-A7:#define __ARM_VFPV4__ 1
    122 
    123 // Check that -mfpu works properly for Cortex-A5 (enabled by default).
    124 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A5 %s
    125 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A5 %s
    126 // DEFAULTFPU-A5:#define __ARM_NEON__ 1
    127 // DEFAULTFPU-A5:#define __ARM_VFPV4__ 1
    128 
    129 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A5 %s
    130 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A5 %s
    131 // FPUNONE-A5-NOT:#define __ARM_NEON__ 1
    132 // FPUNONE-A5-NOT:#define __ARM_VFPV4__ 1
    133 
    134 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -mfpu=vfp3-d16 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A5 %s
    135 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -mfpu=vfp3-d16 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A5 %s
    136 // NONEON-A5-NOT:#define __ARM_NEON__ 1
    137 // NONEON-A5:#define __ARM_VFPV4__ 1
    138 
    139 // FIXME: add check for further predefines
    140 // Test whether predefines are as expected when targeting cortex-a5.
    141 // RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5-ARM %s
    142 // A5-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
    143 
    144 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5-THUMB %s
    145 // A5-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
    146 
    147 // RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5 %s
    148 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5 %s
    149 // A5:#define __ARM_ARCH 7
    150 // A5:#define __ARM_ARCH_7A__ 1
    151 // A5:#define __ARM_ARCH_PROFILE 'A'
    152 
    153 // Test whether predefines are as expected when targeting cortex-a7.
    154 // RUN: %clang -target armv7 -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=A7 %s
    155 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=A7 %s
    156 // A7:#define __ARM_ARCH 7
    157 // A7:#define __ARM_ARCH_7A__ 1
    158 // A7:#define __ARM_ARCH_EXT_IDIV__ 1
    159 // A7:#define __ARM_ARCH_PROFILE 'A'
    160 
    161 // Test whether predefines are as expected when targeting cortex-a8.
    162 // RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck --check-prefix=A8-ARM %s
    163 // A8-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
    164 
    165 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck --check-prefix=A8-THUMB %s
    166 // A8-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
    167 
    168 // Test whether predefines are as expected when targeting cortex-a9.
    169 // RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck --check-prefix=A9-ARM %s
    170 // A9-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
    171 
    172 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck --check-prefix=A9-THUMB %s
    173 // A9-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
    174 
    175 
    176 // Check that -mfpu works properly for Cortex-A12 (enabled by default).
    177 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A12 %s
    178 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A12 %s
    179 // DEFAULTFPU-A12:#define __ARM_NEON__ 1
    180 // DEFAULTFPU-A12:#define __ARM_VFPV4__ 1
    181 
    182 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a12 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A12 %s
    183 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a12 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A12 %s
    184 // FPUNONE-A12-NOT:#define __ARM_NEON__ 1
    185 // FPUNONE-A12-NOT:#define __ARM_VFPV4__ 1
    186 
    187 // Test whether predefines are as expected when targeting cortex-a12.
    188 // RUN: %clang -target armv7 -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck --check-prefix=A12 %s
    189 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck --check-prefix=A12 %s
    190 // A12:#define __ARM_ARCH 7
    191 // A12:#define __ARM_ARCH_7A__ 1
    192 // A12:#define __ARM_ARCH_EXT_IDIV__ 1
    193 // A12:#define __ARM_ARCH_PROFILE 'A'
    194 
    195 // Test whether predefines are as expected when targeting cortex-a15.
    196 // RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=A15-ARM %s
    197 // A15-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
    198 
    199 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=A15-THUMB %s
    200 // A15-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
    201 
    202 // Test whether predefines are as expected when targeting swift.
    203 // RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck --check-prefix=SWIFT-ARM %s
    204 // SWIFT-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
    205 
    206 // RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck --check-prefix=SWIFT-THUMB %s
    207 // SWIFT-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
    208 
    209 // Test whether predefines are as expected when targeting cortex-a53.
    210 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck --check-prefix=A53-ARM %s
    211 // A53-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
    212 
    213 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck --check-prefix=A53-THUMB %s
    214 // A53-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
    215 
    216 // Test whether predefines are as expected when targeting cortex-r5.
    217 // RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck --check-prefix=R5-ARM %s
    218 // R5-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
    219 
    220 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck --check-prefix=R5-THUMB %s
    221 // R5-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
    222 
    223 // Test whether predefines are as expected when targeting cortex-m0.
    224 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck --check-prefix=M0-THUMB %s
    225 // M0-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
    226 
    227 // Test whether predefines are as expected when targeting cortex-m3.
    228 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m3 -x c -E -dM %s -o - | FileCheck --check-prefix=M3-THUMB %s
    229 // M3-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
    230 
    231 // Test whether predefines are as expected when targeting cortex-m4.
    232 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck --check-prefix=M4-THUMB %s
    233 // M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
    234 
    235 // Test whether predefines are as expected when targeting krait.
    236 // RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck --check-prefix=KRAIT-ARM %s
    237 // KRAIT-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
    238 // KRAIT-ARM:#define  __ARM_VFPV4__ 1
    239 
    240 // RUN: %clang -target armv7 -mthumb -mcpu=krait -x c -E -dM %s -o - | FileCheck --check-prefix=KRAIT-THUMB %s
    241 // KRAIT-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
    242 // KRAIT-THUMB:#define  __ARM_VFPV4__ 1
    243 
    244