[aarch64,libstdc++] Use __ARM_BIG_ENDIAN instead of __AARCH64EB__ in opt_random.h

Message ID 5A3A3B45.8000306@foss.arm.com
State New
Headers show
  • [aarch64,libstdc++] Use __ARM_BIG_ENDIAN instead of __AARCH64EB__ in opt_random.h
Related show

Commit Message

Kyrill Tkachov Dec. 20, 2017, 10:28 a.m.
Hi all,

As has been spotted at 
we check the __AARCH64EB__ macro for aarch64 big-endian
detection in config/cpu/aarch64/opt/ext/opt_random.h.
That works just fine with GCC but the standardised ACLE[1] macro
for that purpose is __ARM_BIG_ENDIAN so there is a possibility
that non-GCC compilers that include this header are not aware
of this predefine.

So this patch changes the use of __AARCH64EB__ to
the more portable __ARM_BIG_ENDIAN.

Tested on aarch64-none-elf and aarch64_be-none-elf.

Preapproved by Jeff at 

Committed to trunk.


[1] https://static.docs.arm.com/ihi0053/c/IHI0053C_acle_2_0.pdf

2017-12-20  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/cpu/aarch64/opt/ext/opt_random.h (__VEXT): Check
     __ARM_BIG_ENDIAN instead of __AARCH64EB__.


commit acf0abfe3d166df053ca81840fbe29f4eac72b38
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Tue Dec 19 18:45:01 2017 +0000

    [aarch64][libstdc++] Use __ARM_BIG_ENDIAN instead of __AARCH64EB__ in opt_random.h

diff --git a/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h b/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h
index 330050f..7c82480 100644
--- a/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h
+++ b/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h
@@ -34,7 +34,7 @@ 
 #ifdef __ARM_NEON
-#ifdef __AARCH64EB__
+#ifdef __ARM_BIG_ENDIAN
 # define __VEXT(_A,_B,_C) __builtin_shuffle (_A, _B, (__Uint8x16_t) \
     {16-_C, 17-_C, 18-_C, 19-_C, 20-_C, 21-_C, 22-_C, 23-_C, \
      24-_C, 25-_C, 26-_C, 27-_C, 28-_C, 29-_C, 30-_C, 31-_C})