[ARM] Implement __ARM_FEATURE_COPROC coprocessor intrinsic feature macro
authorThomas Preud'homme <thopre01@gcc.gnu.org>
Tue, 20 Jun 2017 09:25:08 +0000 (09:25 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Tue, 20 Jun 2017 09:25:08 +0000 (09:25 +0000)
2017-06-20  Prakhar Bahuguna  <prakhar.bahuguna@arm.com>

    gcc/
    * config/arm/arm-c.c (arm_cpu_builtins): New block to define
    __ARM_FEATURE_COPROC according to support.

    gcc/testsuite/
    * gcc.target/arm/acle/cdp.c: Add feature macro bitmap test.
    * gcc.target/arm/acle/cdp2.c: Likewise.
    * gcc.target/arm/acle/ldc.c: Likewise.
    * gcc.target/arm/acle/ldc2.c: Likewise.
    * gcc.target/arm/acle/ldc2l.c: Likewise.
    * gcc.target/arm/acle/ldcl.c: Likewise.
    * gcc.target/arm/acle/mcr.c: Likewise.
    * gcc.target/arm/acle/mcr2.c: Likewise.
    * gcc.target/arm/acle/mcrr.c: Likewise.
    * gcc.target/arm/acle/mcrr2.c: Likewise.
    * gcc.target/arm/acle/mrc.c: Likewise.
    * gcc.target/arm/acle/mrc2.c: Likewise.
    * gcc.target/arm/acle/mrrc.c: Likewise.
    * gcc.target/arm/acle/mrrc2.c: Likewise.
    * gcc.target/arm/acle/stc.c: Likewise.
    * gcc.target/arm/acle/stc2.c: Likewise.
    * gcc.target/arm/acle/stc2l.c: Likewise.
    * gcc.target/arm/acle/stcl.c: Likewise.

From-SVN: r249399

21 files changed:
gcc/ChangeLog
gcc/config/arm/arm-c.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/acle/cdp.c
gcc/testsuite/gcc.target/arm/acle/cdp2.c
gcc/testsuite/gcc.target/arm/acle/ldc.c
gcc/testsuite/gcc.target/arm/acle/ldc2.c
gcc/testsuite/gcc.target/arm/acle/ldc2l.c
gcc/testsuite/gcc.target/arm/acle/ldcl.c
gcc/testsuite/gcc.target/arm/acle/mcr.c
gcc/testsuite/gcc.target/arm/acle/mcr2.c
gcc/testsuite/gcc.target/arm/acle/mcrr.c
gcc/testsuite/gcc.target/arm/acle/mcrr2.c
gcc/testsuite/gcc.target/arm/acle/mrc.c
gcc/testsuite/gcc.target/arm/acle/mrc2.c
gcc/testsuite/gcc.target/arm/acle/mrrc.c
gcc/testsuite/gcc.target/arm/acle/mrrc2.c
gcc/testsuite/gcc.target/arm/acle/stc.c
gcc/testsuite/gcc.target/arm/acle/stc2.c
gcc/testsuite/gcc.target/arm/acle/stc2l.c
gcc/testsuite/gcc.target/arm/acle/stcl.c

index d46daf3d93e5bf1de1acc8bddfeeaba0befc0efe..10434ed8b51e9ce8e7b1650ec2a5bf6b8142b904 100644 (file)
@@ -1,4 +1,9 @@
-2017-07-20  Jakub Jelinek  <jakub@redhat.com>
+2017-06-20  Prakhar Bahuguna  <prakhar.bahuguna@arm.com>
+
+       * config/arm/arm-c.c (arm_cpu_builtins): New block to define
+       __ARM_FEATURE_COPROC according to support.
+
+2017-06-20  Jakub Jelinek  <jakub@redhat.com>
 
        * tree-chkp.c (chkp_get_hard_register_var_fake_base_address):
        Rewritten to avoid overflow for > 32-bit pointers.
index 3abe7d1f1f578063d82ba3b43036459eed2d7d3d..a3daa3220a2bc4220dffdb7ca08ca9419bdac425 100644 (file)
@@ -200,6 +200,22 @@ arm_cpu_builtins (struct cpp_reader* pfile)
   def_or_undef_macro (pfile, "__ARM_FEATURE_IDIV", TARGET_IDIV);
 
   def_or_undef_macro (pfile, "__ARM_ASM_SYNTAX_UNIFIED__", inline_asm_unified);
+
+  if (TARGET_32BIT && arm_arch4 && !(arm_arch8 && arm_arch_notm))
+    {
+      int coproc_level = 0x1;
+
+      if (arm_arch5)
+       coproc_level |= 0x2;
+      if (arm_arch5e)
+       coproc_level |= 0x4;
+      if (arm_arch6)
+       coproc_level |= 0x8;
+
+      builtin_define_with_int_value ("__ARM_FEATURE_COPROC", coproc_level);
+    }
+  else
+      cpp_undef (pfile, "__ARM_FEATURE_COPROC");
 }
 
 void
index 330a1085416d25fb116095566184edccf029bc3b..dccdaf4815a2b1a67b9a96871b755c9d020e449a 100644 (file)
@@ -1,3 +1,24 @@
+2017-06-20  Prakhar Bahuguna  <prakhar.bahuguna@arm.com>
+
+       * gcc.target/arm/acle/cdp.c: Add feature macro bitmap test.
+       * gcc.target/arm/acle/cdp2.c: Likewise.
+       * gcc.target/arm/acle/ldc.c: Likewise.
+       * gcc.target/arm/acle/ldc2.c: Likewise.
+       * gcc.target/arm/acle/ldc2l.c: Likewise.
+       * gcc.target/arm/acle/ldcl.c: Likewise.
+       * gcc.target/arm/acle/mcr.c: Likewise.
+       * gcc.target/arm/acle/mcr2.c: Likewise.
+       * gcc.target/arm/acle/mcrr.c: Likewise.
+       * gcc.target/arm/acle/mcrr2.c: Likewise.
+       * gcc.target/arm/acle/mrc.c: Likewise.
+       * gcc.target/arm/acle/mrc2.c: Likewise.
+       * gcc.target/arm/acle/mrrc.c: Likewise.
+       * gcc.target/arm/acle/mrrc2.c: Likewise.
+       * gcc.target/arm/acle/stc.c: Likewise.
+       * gcc.target/arm/acle/stc2.c: Likewise.
+       * gcc.target/arm/acle/stc2l.c: Likewise.
+       * gcc.target/arm/acle/stcl.c: Likewise.
+
 2017-06-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/81121
index 28b218e7cfcdb7d6ce1381feb4c6dea3ff08a620..cebd8c4024ea1930f490f63e5267a33bac59a3a8 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x1) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 void test_cdp (void)
 {
index 00bcd502b563cfe6df1e5d4c2e53f8034063d47e..945d435d2fb99962ff47d921d9cb3633cb75bb79 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x2) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 void test_cdp2 (void)
 {
index f45f25d8c973e6aff715fcf17fbd9d2fc1ac2edf..cd57343208fc5b17e5391d11d126d20e224d6566 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x1) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 extern void * p;
 
index 433bf8a12043c3876e8c961d86b64365faa4b30f..d7691e30d763d1e921817fd586b47888e1b5c78f 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x2) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 extern void * p;
 
index 88c8aa447656d64c0890101005708675c8f02b38..9ee63afa05501c6d2412df679d50b202aef4529b 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x2) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 extern void * p;
 
index 72a97f1d7b7d1a1aea99af638240ad50b708e137..a6bfd9011dc2c714ad7f30378f95c2c4ec74ffe7 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x1) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 extern void * p;
 
index 93f977a2bdb03ece206cf36b4d67f47811dd0073..7095dcbc3ad13efd6a15a4a0cc3ea8ece4d910a3 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x1) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 void test_mcr (uint32_t a)
 {
index 5b60d10ff255a0a72dc93fcc13056b0d424ffec7..2a4b0ce45593c3d88635a9f796f15ae115108d40 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x2) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 void test_mcr2 (uint32_t a)
 {
index dcc223c713d8aabb1d51c1d3bb3a7ed817a4be30..bcfbe1a4855e95a878d91a8e45a197d96eb8fea8 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc3_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x4) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 void test_mcrr (uint64_t a)
 {
index 10f2014d4474c0d78862894023dd8672a80a9189..afd07e67f215e2bbb0e65eb9fdb64c5b865bbda7 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc4_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x8) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 void test_mcrr2 (uint64_t a)
 {
index 34ca6a1638c5667b3ef529ebcf448caecc6e3492..809b6c9c2652806053786a8104df188f5f1f59bf 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x1) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 uint32_t test_mrc (void)
 {
index 3b72a402224dec5544349c9e4d79c9a8aa5a1f8c..4c06ea39b37ab529241ec1a99032471a0fac3de1 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x2) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 uint32_t test_mrc2 (void)
 {
index 28c3b8ea6b53f7e8cf95d86d4d0eda367fca2041..802de083d5cef277b1c3b7e674754efcfc02e91d 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc3_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x4) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 uint64_t test_mrrc (void)
 {
index 5b7aab06222e07bf37a46edb02b189ed5b796388..adf39563e293b917d9c5defc289448c45e731f05 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc4_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x8) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 uint64_t test_mrrc2 (void)
 {
index 7c6e04fe0fe5cd63a259566c34d976657ae03509..2714f65787e0571117c4ace41bdc1376d3a2e1a0 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x1) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 extern void * p;
 
index 1578f7b113676c9d5692c7e5b48b910f091ca29c..0a84652e0f00c1691309b2fb108f29ced30f87d0 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x2) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 extern void * p;
 
index 7adbd60d48ac3f5a0f77dce98a3d3ba931ec58e3..2453d04ad72b10e51fec55f8d302d48f0b9c3c0d 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x2) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 extern void * p;
 
index 2fd5edd02d7e83efdcfaa2203ef1be9f612e414e..affdaa27982947bafefad4dc57bd838c03aa3b64 100644 (file)
@@ -5,6 +5,9 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
+#if (__ARM_FEATURE_COPROC & 0x1) == 0
+  #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
+#endif
 
 extern void * p;