Re: [PATCH] [1/10] AArch64 Port

2012-10-23 Thread Jeff Law

On 10/23/2012 03:42 AM, Marcus Shawcroft wrote:


This patch contains the adjustments to top level gcc configury required
to enable the AArch64 port.

Proposed ChangeLog:

  * config.gcc: Add AArch64.
  * configure.ac: Add AArch64 TLS support detection.
  * configure: Regenerate.

OK.
Jeff



[PATCH] [1/10] AArch64 Port

2012-10-23 Thread Marcus Shawcroft


This patch contains the adjustments to top level gcc configury required 
to enable the AArch64 port.


Proposed ChangeLog:

 * config.gcc: Add AArch64.
 * configure.ac: Add AArch64 TLS support detection.
 * configure: Regenerate.
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 
ed7474ad68c4ae7234072d508b697a9a2218d18d..75ca21756ebca80479d69c38ff8d3c4142d822f3
 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -310,6 +310,13 @@ m32c*-*-*)
tmake_file=m32c/t-m32c
target_has_targetm_common=no
 ;;
+aarch64*-*-*)
+   cpu_type=aarch64
+   need_64bit_hwint=yes
+   extra_headers="arm_neon.h"
+   extra_objs="aarch64-builtins.o"
+   target_has_targetm_common=yes
+   ;;
 alpha*-*-*)
cpu_type=alpha
need_64bit_hwint=yes
@@ -796,6 +803,27 @@ case ${target} in
 esac
 
 case ${target} in
+aarch64*-*-elf)
+   tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h"
+   tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-elf-raw.h"
+   tmake_file="${tmake_file} aarch64/t-aarch64"
+   use_gcc_stdint=wrap
+   case $target in
+   aarch64_be-*)
+   tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+   ;;
+   esac
+   ;;
+aarch64*-*-linux*)
+   tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
+   tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-linux.h"
+   tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-linux"
+   case $target in
+   aarch64_be-*)
+   tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+   ;;
+   esac
+   ;;
 alpha*-*-linux*)
tm_file="elfos.h ${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h 
glibc-stdint.h"
extra_options="${extra_options} alpha/elf.opt"
@@ -2995,6 +3023,92 @@ fi
 
 supported_defaults=
 case "${target}" in
+   aarch64*-*-*)
+   supported_defaults="cpu arch"
+   for which in cpu arch; do
+
+   eval "val=\$with_$which"
+   base_val=`echo $val | sed -e 's/\+.*//'`
+   ext_val=`echo $val | sed -e 's/[a-z0-9\-]\+//'`
+
+   if [ $which = arch ]; then
+ def=aarch64-arches.def
+ pattern=AARCH64_ARCH
+   else
+ def=aarch64-cores.def
+ pattern=AARCH64_CORE
+   fi
+
+   ext_mask=AARCH64_CPU_DEFAULT_FLAGS
+
+   # Find the base CPU or ARCH id in aarch64-cores.def or
+   # aarch64-arches.def
+   if [ x"$base_val" = x ] \
+   || grep "^$pattern(\"$base_val\"," \
+   ${srcdir}/config/aarch64/$def \
+   > /dev/null; then
+
+ if [ $which = arch ]; then
+   base_id=`grep "^$pattern(\"$base_val\"," \
+ ${srcdir}/config/aarch64/$def | \
+ sed -e 's/^[^,]*,[]*//' | \
+ sed -e 's/,.*$//'`
+ else
+   base_id=`grep "^$pattern(\"$base_val\"," \
+ ${srcdir}/config/aarch64/$def | \
+ sed -e 's/^[^,]*,[]*//' | \
+ sed -e 's/,.*$//'`
+ fi
+
+ while [ x"$ext_val" != x ]
+ do
+   ext_val=`echo $ext_val | sed -e 's/\+//'`
+   ext=`echo $ext_val | sed -e 's/\+.*//'`
+   base_ext=`echo $ext | sed -e 's/^no//'`
+
+   if [ x"$base_ext" = x ] \
+   || grep 
"^AARCH64_OPT_EXTENSION(\"$base_ext\"," \
+   
${srcdir}/config/aarch64/aarch64-option-extensions.def \
+   > /dev/null; then
+
+ ext_on=`grep 
"^AARCH64_OPT_EXTENSION(\"$base_ext\"," \
+   
${srcdir}/config/aarch64/aarch64-option-extensions.def | \
+   sed -e 's/^[^,]*,[  ]*//' | \
+   sed -e 's/,.*$//'`
+ ext_off=`grep 
"^AARCH64_OPT_EXTENSION(\"$base_ext\"," \
+   
${srcdir}/config/aarch64/aarch64-option-extensions.def | \
+   sed -e 's/^[^,]*,[  ]*[^,]*,[   
]*//' | \
+   sed -e 's/,.*$//' | \
+   sed -e 's/).*$//'`
+
+ if [ $ext = $base_ext ]; then
+