caf825
diff --git a/CONFIG/include/atlconf.h b/CONFIG/include/atlconf.h
caf825
index cdceda3..e6d71d3 100644
caf825
--- a/CONFIG/include/atlconf.h
caf825
+++ b/CONFIG/include/atlconf.h
caf825
@@ -16,9 +16,9 @@ enum OSTYPE {OSOther=0, OSLinux, OSSunOS, OSSunOS4, OSOSF1, OSIRIX, OSAIX,
caf825
                        ((OS_) == OSWin64) )
caf825
 
caf825
 enum ARCHFAM {AFOther=0, AFPPC, AFSPARC, AFALPHA, AFX86, AFIA64, AFMIPS,
caf825
-              AFARM, AFS390};
caf825
+              AFARM, AFS390, AFAARCH64};
caf825
 
caf825
-#define NMACH 47
caf825
+#define NMACH 48
caf825
 static char *machnam[NMACH] =
caf825
    {"UNKNOWN", "POWER3", "POWER4", "POWER5", "PPCG4", "PPCG5",
caf825
     "POWER6", "POWER7", "IBMz9", "IBMz10", "IBMz196",
caf825
@@ -28,7 +28,7 @@ static char *machnam[NMACH] =
caf825
     "Efficeon", "K7", "HAMMER", "AMD64K10h", "AMDDOZER", "UNKNOWNx86",
caf825
     "IA64Itan", "IA64Itan2",
caf825
     "USI", "USII", "USIII", "USIV", "UST2", "UnknownUS",
caf825
-    "MIPSR1xK", "MIPSICE9", "ARMv7"};
caf825
+    "MIPSR1xK", "MIPSICE9", "ARMv7", "AARCH64"};
caf825
 enum MACHTYPE {MACHOther, IbmPwr3, IbmPwr4, IbmPwr5, PPCG4, PPCG5,
caf825
                IbmPwr6, IbmPwr7,
caf825
                IbmZ9, IbmZ10, IbmZ196,  /* s390(x) in Linux */
caf825
@@ -41,7 +41,8 @@ enum MACHTYPE {MACHOther, IbmPwr3, IbmPwr4, IbmPwr5, PPCG4, PPCG5,
caf825
                SunUSI, SunUSII, SunUSIII, SunUSIV, SunUST2, SunUSX,
caf825
                MIPSR1xK, /* includes R10K, R12K, R14K, R16K */
caf825
                MIPSICE9,  /* SiCortex ICE9 -- like MIPS5K */
caf825
-               ARMv7      /* includes Cortex A8, A9 */
caf825
+               ARMv7,     /* includes Cortex A8, A9 */
caf825
+	       AARCH64
caf825
                };
caf825
 #define MachIsX86(mach_) \
caf825
    ( (mach_) >= x86x87 && (mach_) <= x86X )
caf825
@@ -62,6 +63,8 @@ enum MACHTYPE {MACHOther, IbmPwr3, IbmPwr4, IbmPwr5, PPCG4, PPCG5,
caf825
    ( (mach_) == ARMv7 )
caf825
 #define MachIsS390(mach_) \
caf825
    ( (mach_) >= IbmZ9 && (mach_) <= IbmZ196 )
caf825
+#define MachIsAARCH64(mach_) \
caf825
+   ( (mach_) == AARCH64 )
caf825
 
caf825
 
caf825
 static char *f2c_namestr[5] = {"UNKNOWN","Add_", "Add__", "NoChange", "UpCase"};
caf825
@@ -83,13 +86,13 @@ enum ISAEXT
caf825
    {ISA_None=0, ISA_VSX, ISA_AV, ISA_AVXMAC, ISA_AVXFMA4, ISA_AVX,
caf825
     ISA_SSE3, ISA_SSE2, ISA_SSE1, ISA_3DNow, ISA_NEON};
caf825
 
caf825
-#define NASMD 9
caf825
+#define NASMD 10
caf825
 enum ASMDIA
caf825
    {ASM_None=0, gas_x86_32, gas_x86_64, gas_sparc, gas_ppc, gas_parisc,
caf825
-    gas_mips, gas_arm, gas_s390};
caf825
+    gas_mips, gas_arm, gas_s390, gas_aarch64};
caf825
 static char *ASMNAM[NASMD] =
caf825
    {"",     "GAS_x8632", "GAS_x8664", "GAS_SPARC", "GAS_PPC", "GAS_PARISC",
caf825
-    "GAS_MIPS", "GAS_ARM", "GAS_S390"};
caf825
+    "GAS_MIPS", "GAS_ARM", "GAS_S390", "GAS_AARCH64"};
caf825
 
caf825
 /*
caf825
  * Used for archinfo probes (can pack in bitfield)
caf825
diff --git a/CONFIG/src/Makefile b/CONFIG/src/Makefile
caf825
index 8eb38f7..afad1bc 100644
caf825
--- a/CONFIG/src/Makefile
caf825
+++ b/CONFIG/src/Makefile
caf825
@@ -260,6 +260,11 @@ IRun_BINDP :
caf825
                 redir=config0.out
caf825
 	- cat config0.out
caf825
 
caf825
+IRun_GAS_AARCH64 :
caf825
+	$(CC) $(CCFLAGS) -o xprobe_gas_aarch64 $(SRCdir)/backend/probe_this_asm.c $(SRCdir)/backend/probe_gas_aarch64.S
caf825
+	$(MAKE) $(atlrun) atldir=$(mydir) exe=xprobe_gas_aarch64 args="$(args)" \
caf825
+                redir=config0.out
caf825
+	- cat config0.out
caf825
 IRun_GAS_S390 :
caf825
 	$(CC) $(CCFLAGS) -o xprobe_gas_s390 $(SRCdir)/backend/probe_this_asm.c $(SRCdir)/backend/probe_gas_s390.S
caf825
 	$(MAKE) $(atlrun) atldir=$(mydir) exe=xprobe_gas_s390 args="$(args)" \
caf825
diff --git a/CONFIG/src/SpewMakeInc.c b/CONFIG/src/SpewMakeInc.c
caf825
index 65d68a1..f5eb467 100644
caf825
--- a/CONFIG/src/SpewMakeInc.c
caf825
+++ b/CONFIG/src/SpewMakeInc.c
caf825
@@ -391,6 +391,8 @@ char *GetPtrbitsFlag(enum OSTYPE OS, enum MACHTYPE arch, int ptrbits,
caf825
 
caf825
    if (MachIsIA64(arch))
caf825
       return(sp);
caf825
+   if (MachIsAARCH64(arch))
caf825
+      return(sp);
caf825
    if (MachIsMIPS(arch))
caf825
       return((ptrbits == 64) ? "-mabi=64" : "-mabi=n32");
caf825
    if (MachIsS390(arch))
caf825
diff --git a/CONFIG/src/atlcomp.txt b/CONFIG/src/atlcomp.txt
caf825
index 5bf32d9..5e0c538 100644
caf825
--- a/CONFIG/src/atlcomp.txt
caf825
+++ b/CONFIG/src/atlcomp.txt
caf825
@@ -263,6 +263,17 @@ MACH=ARMv7 OS=ALL LVL=1000 COMPS=dmc,dkc
caf825
 MACH=ARMv7 OS=ALL LVL=1000 COMPS=f77
caf825
    'gfortran' '-mcpu=cortex-a8 -mfpu=vfpv3 -mfloat-abi=softfp -O'
caf825
 #
caf825
+# AArch64 defaults
caf825
+#
caf825
+MACH=AARCH64 OS=ALL LVL=1000 COMPS=xcc
caf825
+   'gcc' '-O2'
caf825
+MACH=AARCH64 OS=ALL LVL=1000 COMPS=smc,skc,gcc,icc
caf825
+   'gcc' '-O2'
caf825
+MACH=AARCH64 OS=ALL LVL=1000 COMPS=dmc,dkc
caf825
+   'gcc' '-O2'
caf825
+MACH=AARCH64 OS=ALL LVL=1000 COMPS=f77
caf825
+   'gfortran' '-O'
caf825
+#
caf825
 # Generic defaults
caf825
 #
caf825
 MACH=ALL OS=ALL LVL=5 COMPS=icc,smc,dmc,skc,dkc,xcc,gcc
caf825
diff --git a/CONFIG/src/atlconf_misc.c b/CONFIG/src/atlconf_misc.c
caf825
index b669e8e..f7af4a8 100644
caf825
--- a/CONFIG/src/atlconf_misc.c
caf825
+++ b/CONFIG/src/atlconf_misc.c
caf825
@@ -481,6 +481,7 @@ enum ARCHFAM ProbeArchFam(char *targ)
caf825
       else if (strstr(res, "ia64")) fam = AFIA64;
caf825
       else if (strstr(res, "mips")) fam = AFMIPS;
caf825
       else if (strstr(res, "arm")) fam = AFARM;
caf825
+      else if (strstr(res, "aarch64")) fam = AFAARCH64;
caf825
       else if (strstr(res, "s390")) fam = AFS390;
caf825
       else if ( strstr(res, "i686") || strstr(res, "i586") ||
caf825
                 strstr(res, "i486") || strstr(res, "i386") ||
caf825
@@ -506,6 +507,7 @@ enum ARCHFAM ProbeArchFam(char *targ)
caf825
                    strstr(res, "x86_64") ) fam = AFX86;
caf825
          else if (strstr(res, "mips")) fam = AFMIPS;
caf825
          else if (strstr(res, "arm")) fam = AFARM;
caf825
+	 else if (strstr(res, "aarch64")) fam = AFAARCH64;
caf825
          else if (strstr(res, "s390")) fam = AFS390;
caf825
          free(res);
caf825
       }
caf825
diff --git a/CONFIG/src/backend/Make.ext b/CONFIG/src/backend/Make.ext
caf825
index 9f236f6..918a053 100644
caf825
--- a/CONFIG/src/backend/Make.ext
caf825
+++ b/CONFIG/src/backend/Make.ext
caf825
@@ -57,6 +57,8 @@ probe_gas_arm.S : $(basf)
caf825
 	$(extC) -b $(basf) -o probe_gas_arm.S rout=probe_gas_arm.S
caf825
 probe_gas_s390.S : $(basf)
caf825
 	$(extC) -b $(basf) -o probe_gas_s390.S rout=probe_gas_s390.S
caf825
+probe_gas_aarch64.S : $(basf)
caf825
+	$(extC) -b $(basf) -o probe_gas_aarch64.S rout=probe_gas_aarch64.S
caf825
 probe_AVXMAC.S : $(basf)
caf825
 	$(extC) -b $(basf) -o probe_AVXMAC.S rout=probe_AVXMAC.S
caf825
 probe_AVXFMA4.S : $(basf)
caf825
diff --git a/CONFIG/src/backend/archinfo_linux.c b/CONFIG/src/backend/archinfo_linux.c
caf825
index d3d3fd8..4c419a3 100644
caf825
--- a/CONFIG/src/backend/archinfo_linux.c
caf825
+++ b/CONFIG/src/backend/archinfo_linux.c
caf825
@@ -248,6 +248,14 @@ enum MACHTYPE ProbeArch()
caf825
          free(res);
caf825
       }
caf825
       break;
caf825
+   case AFAARCH64:
caf825
+      res = atlsys_1L(NULL, "fgrep 'Processor' /proc/cpuinfo", 0, 0);
caf825
+      if (res)
caf825
+      {
caf825
+         if (strstr(res, "AArch64")) mach = AARCH64;
caf825
+         free(res);
caf825
+      }
caf825
+      break;
caf825
    default:
caf825
 #if 0
caf825
       if (!CmndOneLine(NULL, "fgrep 'cpu family' /proc/cpuinfo", res))
caf825
diff --git a/CONFIG/src/backend/probe_gas_aarch64.S b/CONFIG/src/backend/probe_gas_aarch64.S
caf825
new file mode 100644
caf825
index 0000000..d4c3d68
caf825
--- /dev/null
caf825
+++ b/CONFIG/src/backend/probe_gas_aarch64.S
caf825
@@ -0,0 +1,14 @@
caf825
+#define ATL_GAS_AARCH64
caf825
+#include "atlas_asm.h"
caf825
+#
caf825
+# Linux AArch64 assembler for:
caf825
+# int asm_probe(int i)
caf825
+# RETURNS: i*3
caf825
+#
caf825
+.text
caf825
+.globl  ATL_asmdecor(asm_probe)
caf825
+.type   ATL_asmdecor(asm_probe), %function
caf825
+ATL_asmdecor(asm_probe):
caf825
+        add     w0, w0, w0, LSL #1
caf825
+        ret
caf825
+.size ATL_asmdecor(asm_probe),.-ATL_asmdecor(asm_probe)
caf825
diff --git a/CONFIG/src/probe_comp.c b/CONFIG/src/probe_comp.c
caf825
index 48f518d..3d5aa3b 100644
caf825
--- a/CONFIG/src/probe_comp.c
caf825
+++ b/CONFIG/src/probe_comp.c
caf825
@@ -578,7 +578,7 @@ char *GetPtrbitsFlag(enum OSTYPE OS, enum MACHTYPE arch, int ptrbits,
caf825
    char *sp = "";
caf825
    int i, j, k;
caf825
 
caf825
-   if (MachIsIA64(arch))
caf825
+   if (MachIsIA64(arch) || MachIsAARCH64(arch))
caf825
       return(sp);
caf825
    if (MachIsMIPS(arch))
caf825
       return((ptrbits == 64) ? "-mabi=64" : "-mabi=n32");
caf825
diff --git a/include/atlas_genparse.h b/include/atlas_genparse.h
caf825
index 1955687..909a38e 100644
caf825
--- a/include/atlas_genparse.h
caf825
+++ b/include/atlas_genparse.h
caf825
@@ -6,13 +6,13 @@
caf825
 #include <assert.h>
caf825
 #include <string.h>
caf825
 #include <ctype.h>
caf825
-#define NASMD 9
caf825
+#define NASMD 10
caf825
 enum ASMDIA
caf825
    {ASM_None=0, gas_x86_32, gas_x86_64, gas_sparc, gas_ppc, gas_parisc,
caf825
-    gas_mips, gas_arm, gas_s390};
caf825
+    gas_mips, gas_arm, gas_s390, gas_aarch64};
caf825
 static char *ASMNAM[NASMD] =
caf825
    {"",     "GAS_x8632", "GAS_x8664", "GAS_SPARC", "GAS_PPC", "GAS_PARISC",
caf825
-    "GAS_MIPS", "GAS_ARM", "GAS_S390"};
caf825
+    "GAS_MIPS", "GAS_ARM", "GAS_S390", "GAS_AARCH64"};
caf825
 /*
caf825
  * Basic data structure for forming queues with some minimal info
caf825
  */