From: Matthew Fortune <matthew.fort...@imgtec.com>

The compressed MIPS ISAs (microMIPS and MIPS16) require the LSB of
an address to indicate which ISA to execute.  The non-conformant
patterns used in these tests cannot set the ISA mode bit and may
attempt to directly call the variable which triggers an error from
the assembler about calling a different ISA mode.

gcc/testsuite/
        * gcc.c-torture/compile/20020129-1.c: Skip for MIPS16/microMIPS.
        * gcc.c-torture/compile/pr37433-1.c: Likewise.
        * gcc.c-torture/compile/pr37433.c: Likewise.
        * lib/target-supports.exp
        (check_effective_target_mips_compressed): New function.

Cherry-picked 97f2d5c6403c0cb8b65e059349ec18ffc9505bfd
from https://github.com/MIPS/gcc

Signed-off-by: Matthew Fortune <matthew.fort...@imgtec.com>
Signed-off-by: Faraz Shahbazker <fshahbaz...@wavecomp.com>
Signed-off-by: Aleksandar Rakic <aleksandar.ra...@htecgroup.com>
---
 gcc/testsuite/gcc.c-torture/compile/20020129-1.c |  5 +++++
 gcc/testsuite/gcc.c-torture/compile/pr37433-1.c  |  5 +++++
 gcc/testsuite/gcc.c-torture/compile/pr37433.c    |  5 +++++
 gcc/testsuite/lib/target-supports.exp            | 10 ++++++++++
 4 files changed, 25 insertions(+)

diff --git a/gcc/testsuite/gcc.c-torture/compile/20020129-1.c 
b/gcc/testsuite/gcc.c-torture/compile/20020129-1.c
index c14ac07655e..d06bcb0976d 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20020129-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20020129-1.c
@@ -2,6 +2,11 @@
 
 /* { dg-require-effective-target indirect_calls } */
 
+/* MIPS compressed ISAs require the LSB of an address to indicate which
+   ISA mode to use.  This test cannot do that and raises an assembler
+   warning (binutils 2.29 onwards) of a branch to a different ISA.  */
+/* { dg-skip-if "" { mips_compressed } } */
+
 typedef struct
 {
   long long a[10];
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c 
b/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c
index 48a57b637d7..5948b3d740a 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c
@@ -1,5 +1,10 @@
 /* { dg-require-effective-target indirect_calls } */
 
+/* MIPS compressed ISAs require the LSB of an address to indicate which
+   ISA mode to use.  This test cannot do that and raises an assembler
+   warning (binutils 2.29 onwards) of a branch to a different ISA.  */
+/* { dg-skip-if "" { mips_compressed } } */
+
 void regex_subst(void)
 {
   const void *subst = "";
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37433.c 
b/gcc/testsuite/gcc.c-torture/compile/pr37433.c
index 95d168afa2f..69e622132af 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr37433.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37433.c
@@ -1,5 +1,10 @@
 /* { dg-require-effective-target indirect_calls } */
 
+
+/* MIPS compressed ISAs require the LSB of an address to indicate which
+   ISA mode to use.  This test cannot do that and raises an assembler
+   warning (binutils 2.29 onwards) of a branch to a different ISA.  */
+/* { dg-skip-if "" { mips_compressed } } */
 int regex_subst(void)
 {
   const void *subst = "";
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index fd58682cae3..4f005c5a7d2 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1514,6 +1514,16 @@ proc check_effective_target_mips64 { } {
     }]
 }
 
+# Return true if the target is using a compressed MIPS ISA.
+
+proc check_effective_target_mips_compressed { } {
+    return [check_no_compiler_messages mips_compressed assembly {
+       #if !defined (__mips_micromips) && !defined (__mips16)
+       #error !__mips_micromips && !__mips16
+       #endif
+    }]
+}
+
 # Return true if the target is a MIPS target that does not produce
 # MIPS16 code.
 
-- 
2.34.1

Reply via email to