arm-target-features.c 18 KB

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