testsuite: Add -mbig-endian stdint.h requirement
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 8 Apr 2021 16:39:11 +0000 (17:39 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 8 Apr 2021 16:39:11 +0000 (17:39 +0100)
Some AArch64 tests force -mbig-endian and indirectly include stdint.h.
However, not all OSes support both endiannesses, leading to:

FAIL: gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c   -O0  (test for excess errors)
UNRESOLVED: gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c   -O1   check-function-bodies test_vget_high_bf16
UNRESOLVED: gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c   -O1   check-function-bodies test_vget_low_bf16

etc.  This patch adds an (admittedly special-purpose) target
selector for this.

gcc/
* doc/sourcebuild.texi (stdint_types_mbig_endian): Document.

gcc/testsuite/
* lib/target-supports.exp
(check_effective_target_stdint_types_mbig_endian): New proc.
* gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c: Require
stdint_types_mbig_endian.
* gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c: Likewise.
* gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c: Likewise.

gcc/doc/sourcebuild.texi
gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c
gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c
gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c
gcc/testsuite/lib/target-supports.exp

index 0104916..b000124 100644 (file)
@@ -2447,6 +2447,10 @@ Target has the basic signed and unsigned C types in @code{stdint.h}.
 This will be obsolete when GCC ensures a working @code{stdint.h} for
 all targets.
 
+@item stdint_types_mbig_endian
+Target accepts the option @option{-mbig-endian} and @code{stdint.h}
+can be included without error when @option{-mbig-endian} is passed.
+
 @item stpcpy
 Target provides @code{stpcpy} function.
 
index bd9bb11..cd27098 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target stdint_types_mbig_endian } */
 /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
 /* { dg-add-options arm_v8_2a_bf16_neon } */
 /* { dg-additional-options "-mbig-endian -save-temps" } */
index 58bdee5..ae0a953 100755 (executable)
@@ -1,4 +1,5 @@
 /* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target stdint_types_mbig_endian } */
 /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
 /* { dg-add-options arm_v8_2a_bf16_neon }  */
 /* { dg-additional-options "-mbig-endian --save-temps" } */
index 96bca23..61c7c51 100755 (executable)
@@ -1,4 +1,5 @@
 /* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target stdint_types_mbig_endian } */
 /* { dg-require-effective-target arm_v8_2a_i8mm_ok } */
 /* { dg-add-options arm_v8_2a_i8mm }  */
 /* { dg-additional-options "-mbig-endian -save-temps" } */
index 1230d19..ad32310 100644 (file)
@@ -8254,6 +8254,18 @@ proc check_effective_target_stdint_types { } {
     }]
 }
 
+# Like check_effective_target_stdint_types, but test what happens when
+# -mbig-endian is passed.  This test only makes sense on targets that
+# support -mbig-endian; it will fail elsewhere.
+
+proc check_effective_target_stdint_types_mbig_endian { } {
+    return [check_no_compiler_messages stdint_types_mbig_endian assembly {
+       #include <stdint.h>
+       int8_t a; int16_t b; int32_t c; int64_t d;
+       uint8_t e; uint16_t f; uint32_t g; uint64_t h;
+    } "-mbig-endian"]
+}
+
 # Return 1 if target has the basic signed and unsigned types in
 # <inttypes.h>, 0 otherwise.  This is for tests that GCC's notions of
 # these types agree with those in the header, as some systems have