[testsuite/ARM] Fix coprocessor intrinsic test failures on ARMv8-A
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Wed, 13 Sep 2017 10:27:00 +0000 (10:27 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Wed, 13 Sep 2017 10:27:00 +0000 (10:27 +0000)
Coprocessor intrinsic tests in gcc.target/arm/acle test whether
__ARM_FEATURE_COPROC has the right bit defined before calling the
intrinsic. This allows to test both the correct setting of that macro
and the availability and correct working of the intrinsic. However the
__ARM_FEATURE_COPROC macro is no longer defined for ARMv8-A since
r249399.

This patch changes the testcases to skip that test for ARMv8-A and
ARMv8-R targets.  It also fixes some irregularity in the coprocessor
effective targets:
- add ldcl and stcl to the list of instructions listed as guarded by
  arm_coproc1_ok
- enable tests guarded by arm_coproc2_ok, arm_coproc3_ok and
  arm_coproc4_ok for Thumb-2 capable targets but disable for Thumb-1
  targets.

2017-09-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/testsuite/
    * gcc.target/arm/acle/cdp.c: Skip __ARM_FEATURE_COPROC check for
    ARMv8-A and ARMv8-R.
    * 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.
    * lib/target-supports.exp:
    (check_effective_target_arm_coproc1_ok_nocache): Mention ldcl
    and stcl in the comment.
    (check_effective_target_arm_coproc2_ok_nocache): Allow Thumb-2 targets
    and disable Thumb-1 targets.
    (check_effective_target_arm_coproc3_ok_nocache): Likewise.
    (check_effective_target_arm_coproc4_ok_nocache): Likewise.

Acked-by: Kyrill Tkachov <kyrylo.tkachov@foss.arm.com>
From-SVN: r252074

20 files changed:
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
gcc/testsuite/lib/target-supports.exp

index c7d26d6..bb2bcbe 100644 (file)
@@ -1,3 +1,32 @@
+2017-09-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * gcc.target/arm/acle/cdp.c: Skip __ARM_FEATURE_COPROC check for
+       ARMv8-A and ARMv8-R.
+       * 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.
+       * lib/target-supports.exp:
+       (check_effective_target_arm_coproc1_ok_nocache): Mention ldcl
+       and stcl in the comment.
+       (check_effective_target_arm_coproc2_ok_nocache): Allow Thumb-2 targets
+       and disable Thumb-1 targets.
+       (check_effective_target_arm_coproc3_ok_nocache): Likewise.
+       (check_effective_target_arm_coproc4_ok_nocache): Likewise.
+
 2017-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/47226
index cebd8c4..cfa922a 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x1) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x1) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 945d435..b18076c 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x2) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x2) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index cd57343..10c879f 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x1) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x1) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index d7691e3..d561ada 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x2) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x2) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 9ee63af..2c2a381 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x2) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x2) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index a6bfd90..acbe5a3 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x1) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x1) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 7095dcb..fb8e3c2 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x1) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x1) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 2a4b0ce..b83d9d7 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x2) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x2) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index bcfbe1a..468dd96 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc3_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x4) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x4) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index afd07e6..1173ad0 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc4_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x8) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x8) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 809b6c9..b09634f 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x1) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x1) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 4c06ea3..7dd691f 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x2) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x2) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 802de08..c004660 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc3_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x4) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x4) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index adf3956..b5d56da 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc4_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x8) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x8) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 2714f65..6155bd0 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x1) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x1) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 0a84652..57598d9 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x2) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x2) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 2453d04..0bca8df 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc2_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x2) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x2) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index affdaa2..be6270f 100644 (file)
@@ -5,7 +5,8 @@
 /* { dg-require-effective-target arm_coproc1_ok } */
 
 #include "arm_acle.h"
-#if (__ARM_FEATURE_COPROC & 0x1) == 0
+#if (__ARM_ARCH < 8 || !defined (__ARM_ARCH_ISA_ARM)) \
+    && (__ARM_FEATURE_COPROC & 0x1) == 0
   #error "__ARM_FEATURE_COPROC does not have correct feature bits set"
 #endif
 
index 3ddc92e..2733c62 100644 (file)
@@ -8504,8 +8504,8 @@ proc check_effective_target_rdrand { } {
     } "-mrdrnd" ]
 }
 
-# Return 1 if the target supports coprocessor instructions: cdp, ldc, stc, mcr and
-# mrc.
+# Return 1 if the target supports coprocessor instructions: cdp, ldc, ldcl,
+# stc, stcl, mcr and mrc.
 proc check_effective_target_arm_coproc1_ok_nocache { } {
     if { ![istarget arm*-*-*] } {
        return 0
@@ -8530,7 +8530,7 @@ proc check_effective_target_arm_coproc2_ok_nocache { } {
        return 0
     }
     return [check_no_compiler_messages_nocache arm_coproc2_ok assembly {
-       #if __ARM_ARCH < 5
+       #if (__thumb__ && !__thumb2__) || __ARM_ARCH < 5
        #error FOO
        #endif
     }]
@@ -8549,7 +8549,8 @@ proc check_effective_target_arm_coproc3_ok_nocache { } {
        return 0
     }
     return [check_no_compiler_messages_nocache arm_coproc3_ok assembly {
-       #if __ARM_ARCH < 6 && !defined (__ARM_ARCH_5TE__)
+       #if (__thumb__ && !__thumb2__) \
+           || (__ARM_ARCH < 6 && !defined (__ARM_ARCH_5TE__))
        #error FOO
        #endif
     }]
@@ -8568,7 +8569,7 @@ proc check_effective_target_arm_coproc4_ok_nocache { } {
        return 0
     }
     return [check_no_compiler_messages_nocache arm_coproc4_ok assembly {
-       #if __ARM_ARCH < 6
+       #if (__thumb__ && !__thumb2__) || __ARM_ARCH < 6
        #error FOO
        #endif
     }]