On Tue, May 22, 2018 at 03:21:30PM -0600, Jeff Law wrote:
> On 05/21/2018 03:46 PM, Segher Boessenkool wrote:
> > This patch creates "be" and "le" selectors, which can be used by all
> > architectures, similar to ilp32 and lp64.
>
> I think this is fine.  "be" "le" are used all over the place in gcc and
> the kernel to denote big/little endian.

Thanks.  This is what I checked in (to trunk):


2017-05-23  Segher Boessenkool  <seg...@kernel.crashing.org>

        * doc/sourcebuild.texi (Endianness): New subsubsection.

gcc/testsuite/
        * lib/target-supports.exp (check_effective_target_be): New.
        (check_effective_target_le): New.


diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index dfb0578..596007d 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1313,6 +1313,16 @@ By convention, keywords ending in @code{_nocache} can 
also include options
 specified for the particular test in an earlier @code{dg-options} or
 @code{dg-add-options} directive.
 
+@subsubsection Endianness
+
+@table @code
+@item be
+Target uses big-endian memory order for multi-byte and multi-word data.
+
+@item le
+Target uses little-endian memory order for multi-byte and multi-word data.
+@end table
+
 @subsubsection Data type sizes
 
 @table @code
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index aa1296e6..0a53d7b 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2523,6 +2523,22 @@ proc check_effective_target_next_runtime { } {
     }]
 }
 
+# Return 1 if we're generating code for big-endian memory order.
+
+proc check_effective_target_be { } {
+    return [check_no_compiler_messages be object {
+       int dummy[__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ? 1 : -1];
+    }]
+}
+
+# Return 1 if we're generating code for little-endian memory order.
+
+proc check_effective_target_le { } {
+    return [check_no_compiler_messages le object {
+       int dummy[__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ? 1 : -1];
+    }]
+}
+
 # Return 1 if we're generating 32-bit code using default options, 0
 # otherwise.
 
-- 
1.8.3.1

Reply via email to