Peter Robinson 93e9bf
Author: Mark Salter <msalter@redhat.com>
Peter Robinson 93e9bf
Marcin Juszkiewicz 6a1747
Index: ATLAS/CONFIG/include/atlconf.h
Marcin Juszkiewicz 6a1747
===================================================================
Marcin Juszkiewicz 6a1747
--- ATLAS.orig/CONFIG/include/atlconf.h
Marcin Juszkiewicz 6a1747
+++ ATLAS/CONFIG/include/atlconf.h
Marcin Juszkiewicz 6a1747
@@ -16,9 +16,9 @@ enum OSTYPE {OSOther=0, OSLinux, OSSunOS
Peter Robinson 93e9bf
                        ((OS_) == OSWin64) )
Peter Robinson 93e9bf
 
Peter Robinson 93e9bf
 enum ARCHFAM {AFOther=0, AFPPC, AFSPARC, AFALPHA, AFX86, AFIA64, AFMIPS,
Peter Robinson 93e9bf
-              AFARM, AFS390};
Peter Robinson 93e9bf
+              AFARM, AFS390, AFAARCH64};
Peter Robinson 93e9bf
 
Marcin Juszkiewicz 6a1747
-#define NMACH 52
Marcin Juszkiewicz 6a1747
+#define NMACH 53
Peter Robinson 93e9bf
 static char *machnam[NMACH] =
Peter Robinson 93e9bf
    {"UNKNOWN", "POWER3", "POWER4", "POWER5", "PPCG4", "PPCG5",
Marcin Juszkiewicz 6a1747
     "POWER6", "POWER7", "POWERe6500", "IBMz9", "IBMz10", "IBMz196",
Marcin Juszkiewicz 6a1747
@@ -29,7 +29,7 @@ static char *machnam[NMACH] =
Marcin Juszkiewicz 6a1747
     "Efficeon", "K7", "HAMMER", "AMD64K10h", "AMDLLANO", "AMDDOZER","AMDDRIVER",
Marcin Juszkiewicz 6a1747
     "UNKNOWNx86", "IA64Itan", "IA64Itan2",
Marcin Juszkiewicz 6a1747
     "USI", "USII", "USIII", "USIV", "UST1", "UST2", "UnknownUS",
Peter Robinson 93e9bf
-    "MIPSR1xK", "MIPSICE9", "ARMv7"};
Peter Robinson 93e9bf
+    "MIPSR1xK", "MIPSICE9", "ARMv7", "AARCH64"};
Peter Robinson 93e9bf
 enum MACHTYPE {MACHOther, IbmPwr3, IbmPwr4, IbmPwr5, PPCG4, PPCG5,
Marcin Juszkiewicz 6a1747
                IbmPwr6, IbmPwr7, Pwre6500,
Peter Robinson 93e9bf
                IbmZ9, IbmZ10, IbmZ196,  /* s390(x) in Linux */
Marcin Juszkiewicz 6a1747
@@ -42,7 +42,8 @@ enum MACHTYPE {MACHOther, IbmPwr3, IbmPw
Marcin Juszkiewicz 6a1747
                SunUSI, SunUSII, SunUSIII, SunUSIV, SunUST1, SunUST2, SunUSX,
Peter Robinson 93e9bf
                MIPSR1xK, /* includes R10K, R12K, R14K, R16K */
Peter Robinson 93e9bf
                MIPSICE9,  /* SiCortex ICE9 -- like MIPS5K */
Peter Robinson 93e9bf
-               ARMv7      /* includes Cortex A8, A9 */
Peter Robinson 93e9bf
+               ARMv7,     /* includes Cortex A8, A9 */
Peter Robinson 93e9bf
+               AARCH64
Peter Robinson 93e9bf
                };
Peter Robinson 93e9bf
 #define MachIsX86(mach_) \
Peter Robinson 93e9bf
    ( (mach_) >= x86x87 && (mach_) <= x86X )
Marcin Juszkiewicz 6a1747
@@ -63,6 +64,8 @@ enum MACHTYPE {MACHOther, IbmPwr3, IbmPw
Peter Robinson 93e9bf
    ( (mach_) == ARMv7 )
Peter Robinson 93e9bf
 #define MachIsS390(mach_) \
Peter Robinson 93e9bf
    ( (mach_) >= IbmZ9 && (mach_) <= IbmZ196 )
Peter Robinson 93e9bf
+#define MachIsAARCH64(mach_) \
Peter Robinson 93e9bf
+   ( (mach_) == AARCH64 )
Peter Robinson 93e9bf
 
Peter Robinson 93e9bf
 
Peter Robinson 93e9bf
 static char *f2c_namestr[5] = {"UNKNOWN","Add_", "Add__", "NoChange", "UpCase"};
Marcin Juszkiewicz 6a1747
@@ -84,13 +87,13 @@ enum ISAEXT
Peter Robinson 93e9bf
    {ISA_None=0, ISA_VSX, ISA_AV, ISA_AVXMAC, ISA_AVXFMA4, ISA_AVX,
Peter Robinson 93e9bf
     ISA_SSE3, ISA_SSE2, ISA_SSE1, ISA_3DNow, ISA_NEON};
Peter Robinson 93e9bf
 
Peter Robinson 93e9bf
-#define NASMD 9
Peter Robinson 93e9bf
+#define NASMD 10
Peter Robinson 93e9bf
 enum ASMDIA
Peter Robinson 93e9bf
    {ASM_None=0, gas_x86_32, gas_x86_64, gas_sparc, gas_ppc, gas_parisc,
Peter Robinson 93e9bf
-    gas_mips, gas_arm, gas_s390};
Peter Robinson 93e9bf
+    gas_mips, gas_arm, gas_s390, gas_aarch64};
Peter Robinson 93e9bf
 static char *ASMNAM[NASMD] =
Peter Robinson 93e9bf
    {"",     "GAS_x8632", "GAS_x8664", "GAS_SPARC", "GAS_PPC", "GAS_PARISC",
Peter Robinson 93e9bf
-    "GAS_MIPS", "GAS_ARM", "GAS_S390"};
Peter Robinson 93e9bf
+    "GAS_MIPS", "GAS_ARM", "GAS_S390", "GAS_AARCH64"};
Peter Robinson 93e9bf
 
Peter Robinson 93e9bf
 /*
Peter Robinson 93e9bf
  * Used for archinfo probes (can pack in bitfield)
Marcin Juszkiewicz 6a1747
Index: ATLAS/CONFIG/src/Makefile
Marcin Juszkiewicz 6a1747
===================================================================
Marcin Juszkiewicz 6a1747
--- ATLAS.orig/CONFIG/src/Makefile
Marcin Juszkiewicz 6a1747
+++ ATLAS/CONFIG/src/Makefile
Peter Robinson 93e9bf
@@ -260,6 +260,11 @@ IRun_BINDP :
Peter Robinson 93e9bf
                 redir=config0.out
Peter Robinson 93e9bf
 	- cat config0.out
Peter Robinson 93e9bf
 
Peter Robinson 93e9bf
+IRun_GAS_AARCH64 :
Peter Robinson 93e9bf
+	$(CC) $(CCFLAGS) -o xprobe_gas_aarch64 $(SRCdir)/backend/probe_this_asm.c $(SRCdir)/backend/probe_gas_aarch64.S
Peter Robinson 93e9bf
+	$(MAKE) $(atlrun) atldir=$(mydir) exe=xprobe_gas_aarch64 args="$(args)" \
Peter Robinson 93e9bf
+                redir=config0.out
Peter Robinson 93e9bf
+	- cat config0.out
Peter Robinson 93e9bf
 IRun_GAS_S390 :
Peter Robinson 93e9bf
 	$(CC) $(CCFLAGS) -o xprobe_gas_s390 $(SRCdir)/backend/probe_this_asm.c $(SRCdir)/backend/probe_gas_s390.S
Peter Robinson 93e9bf
 	$(MAKE) $(atlrun) atldir=$(mydir) exe=xprobe_gas_s390 args="$(args)" \
Marcin Juszkiewicz 6a1747
Index: ATLAS/CONFIG/src/SpewMakeInc.c
Marcin Juszkiewicz 6a1747
===================================================================
Marcin Juszkiewicz 6a1747
--- ATLAS.orig/CONFIG/src/SpewMakeInc.c
Marcin Juszkiewicz 6a1747
+++ ATLAS/CONFIG/src/SpewMakeInc.c
Marcin Juszkiewicz 6a1747
@@ -391,6 +391,8 @@ char *GetPtrbitsFlag(enum OSTYPE OS, enu
Peter Robinson 93e9bf
 
Peter Robinson 93e9bf
    if (MachIsIA64(arch))
Peter Robinson 93e9bf
       return(sp);
Peter Robinson 93e9bf
+   if (MachIsAARCH64(arch))
Peter Robinson 93e9bf
+      return(sp);
Peter Robinson 93e9bf
    if (MachIsMIPS(arch))
Peter Robinson 93e9bf
       return((ptrbits == 64) ? "-mabi=64" : "-mabi=n32");
Peter Robinson 93e9bf
    if (MachIsS390(arch))
Marcin Juszkiewicz 6a1747
Index: ATLAS/CONFIG/src/atlcomp.txt
Marcin Juszkiewicz 6a1747
===================================================================
Marcin Juszkiewicz 6a1747
--- ATLAS.orig/CONFIG/src/atlcomp.txt
Marcin Juszkiewicz 6a1747
+++ ATLAS/CONFIG/src/atlcomp.txt
Marcin Juszkiewicz 6a1747
@@ -267,6 +267,17 @@ MACH=ARMv7 OS=ALL LVL=1000 COMPS=dmc,dkc
Peter Robinson 93e9bf
 MACH=ARMv7 OS=ALL LVL=1000 COMPS=f77
Peter Robinson 93e9bf
    'gfortran' '-mcpu=cortex-a8 -mfpu=vfpv3 -mfloat-abi=softfp -O'
Peter Robinson 93e9bf
 #
Peter Robinson 93e9bf
+# AArch64 defaults
Peter Robinson 93e9bf
+#
Peter Robinson 93e9bf
+MACH=AARCH64 OS=ALL LVL=1000 COMPS=xcc
Peter Robinson 93e9bf
+   'gcc' '-O2'
Peter Robinson 93e9bf
+MACH=AARCH64 OS=ALL LVL=1000 COMPS=smc,skc,gcc,icc
Peter Robinson 93e9bf
+   'gcc' '-O2'
Peter Robinson 93e9bf
+MACH=AARCH64 OS=ALL LVL=1000 COMPS=dmc,dkc
Peter Robinson 93e9bf
+   'gcc' '-O2'
Peter Robinson 93e9bf
+MACH=AARCH64 OS=ALL LVL=1000 COMPS=f77
Peter Robinson 93e9bf
+   'gfortran' '-O'
Peter Robinson 93e9bf
+#
Peter Robinson 93e9bf
 # Generic defaults
Peter Robinson 93e9bf
 #
Peter Robinson 93e9bf
 MACH=ALL OS=ALL LVL=5 COMPS=icc,smc,dmc,skc,dkc,xcc,gcc
Marcin Juszkiewicz 6a1747
Index: ATLAS/CONFIG/src/atlconf_misc.c
Marcin Juszkiewicz 6a1747
===================================================================
Marcin Juszkiewicz 6a1747
--- ATLAS.orig/CONFIG/src/atlconf_misc.c
Marcin Juszkiewicz 6a1747
+++ ATLAS/CONFIG/src/atlconf_misc.c
Marcin Juszkiewicz 6a1747
@@ -563,6 +563,7 @@ enum ARCHFAM ProbeArchFam(char *targ)
Peter Robinson 93e9bf
       else if (strstr(res, "ia64")) fam = AFIA64;
Peter Robinson 93e9bf
       else if (strstr(res, "mips")) fam = AFMIPS;
Peter Robinson 93e9bf
       else if (strstr(res, "arm")) fam = AFARM;
Peter Robinson 93e9bf
+      else if (strstr(res, "aarch64")) fam = AFAARCH64;
Peter Robinson 93e9bf
       else if (strstr(res, "s390")) fam = AFS390;
Peter Robinson 93e9bf
       else if ( strstr(res, "i686") || strstr(res, "i586") ||
Peter Robinson 93e9bf
                 strstr(res, "i486") || strstr(res, "i386") ||
Marcin Juszkiewicz 6a1747
@@ -588,6 +589,7 @@ enum ARCHFAM ProbeArchFam(char *targ)
Peter Robinson 93e9bf
                    strstr(res, "x86_64") ) fam = AFX86;
Peter Robinson 93e9bf
          else if (strstr(res, "mips")) fam = AFMIPS;
Peter Robinson 93e9bf
          else if (strstr(res, "arm")) fam = AFARM;
Peter Robinson 93e9bf
+         else if (strstr(res, "aarch64")) fam = AFAARCH64;
Peter Robinson 93e9bf
          else if (strstr(res, "s390")) fam = AFS390;
Peter Robinson 93e9bf
          free(res);
Peter Robinson 93e9bf
       }
Marcin Juszkiewicz 6a1747
Index: ATLAS/CONFIG/src/backend/Make.ext
Marcin Juszkiewicz 6a1747
===================================================================
Marcin Juszkiewicz 6a1747
--- ATLAS.orig/CONFIG/src/backend/Make.ext
Marcin Juszkiewicz 6a1747
+++ ATLAS/CONFIG/src/backend/Make.ext
Peter Robinson 93e9bf
@@ -57,6 +57,8 @@ probe_gas_arm.S : $(basf)
Peter Robinson 93e9bf
 	$(extC) -b $(basf) -o probe_gas_arm.S rout=probe_gas_arm.S
Peter Robinson 93e9bf
 probe_gas_s390.S : $(basf)
Peter Robinson 93e9bf
 	$(extC) -b $(basf) -o probe_gas_s390.S rout=probe_gas_s390.S
Peter Robinson 93e9bf
+probe_gas_aarch64.S : $(basf)
Peter Robinson 93e9bf
+	$(extC) -b $(basf) -o probe_gas_aarch64.S rout=probe_gas_aarch64.S
Peter Robinson 93e9bf
 probe_AVXMAC.S : $(basf)
Peter Robinson 93e9bf
 	$(extC) -b $(basf) -o probe_AVXMAC.S rout=probe_AVXMAC.S
Peter Robinson 93e9bf
 probe_AVXFMA4.S : $(basf)
Marcin Juszkiewicz 6a1747
Index: ATLAS/CONFIG/src/backend/archinfo_linux.c
Marcin Juszkiewicz 6a1747
===================================================================
Marcin Juszkiewicz 6a1747
--- ATLAS.orig/CONFIG/src/backend/archinfo_linux.c
Marcin Juszkiewicz 6a1747
+++ ATLAS/CONFIG/src/backend/archinfo_linux.c
Marcin Juszkiewicz 6a1747
@@ -267,6 +267,14 @@ enum MACHTYPE ProbeArch()
Peter Robinson 93e9bf
          free(res);
Peter Robinson 93e9bf
       }
Peter Robinson 93e9bf
       break;
Peter Robinson 93e9bf
+   case AFAARCH64:
Peter Robinson 93e9bf
+      res = atlsys_1L(NULL, "fgrep 'Processor' /proc/cpuinfo", 0, 0);
Peter Robinson 93e9bf
+      if (res)
Peter Robinson 93e9bf
+      {
Peter Robinson 93e9bf
+         if (strstr(res, "AArch64")) mach = AARCH64;
Peter Robinson 93e9bf
+         free(res);
Peter Robinson 93e9bf
+      }
Peter Robinson 93e9bf
+      break;
Peter Robinson 93e9bf
    default:
Peter Robinson 93e9bf
 #if 0
Peter Robinson 93e9bf
       if (!CmndOneLine(NULL, "fgrep 'cpu family' /proc/cpuinfo", res))
Marcin Juszkiewicz 6a1747
Index: ATLAS/CONFIG/src/backend/probe_gas_aarch64.S
Marcin Juszkiewicz 6a1747
===================================================================
Peter Robinson 93e9bf
--- /dev/null
Marcin Juszkiewicz 6a1747
+++ ATLAS/CONFIG/src/backend/probe_gas_aarch64.S
Peter Robinson 93e9bf
@@ -0,0 +1,14 @@
Peter Robinson 93e9bf
+#define ATL_GAS_AARCH64
Peter Robinson 93e9bf
+#include "atlas_asm.h"
Peter Robinson 93e9bf
+#
Peter Robinson 93e9bf
+# Linux AArch64 assembler for:
Peter Robinson 93e9bf
+# int asm_probe(int i)
Peter Robinson 93e9bf
+# RETURNS: i*3
Peter Robinson 93e9bf
+#
Peter Robinson 93e9bf
+.text
Peter Robinson 93e9bf
+.globl  ATL_asmdecor(asm_probe)
Peter Robinson 93e9bf
+.type   ATL_asmdecor(asm_probe), %function
Peter Robinson 93e9bf
+ATL_asmdecor(asm_probe):
Peter Robinson 93e9bf
+        add     w0, w0, w0, LSL #1
Peter Robinson 93e9bf
+        ret
Peter Robinson 93e9bf
+.size ATL_asmdecor(asm_probe),.-ATL_asmdecor(asm_probe)
Marcin Juszkiewicz 6a1747
Index: ATLAS/CONFIG/src/probe_comp.c
Marcin Juszkiewicz 6a1747
===================================================================
Marcin Juszkiewicz 6a1747
--- ATLAS.orig/CONFIG/src/probe_comp.c
Marcin Juszkiewicz 6a1747
+++ ATLAS/CONFIG/src/probe_comp.c
Marcin Juszkiewicz 6a1747
@@ -582,7 +582,7 @@ char *GetPtrbitsFlag(enum OSTYPE OS, enu
Peter Robinson 93e9bf
    char *sp = "";
Peter Robinson 93e9bf
    int i, j, k;
Peter Robinson 93e9bf
 
Peter Robinson 93e9bf
-   if (MachIsIA64(arch))
Peter Robinson 93e9bf
+   if (MachIsIA64(arch) || MachIsAARCH64(arch))
Peter Robinson 93e9bf
       return(sp);
Peter Robinson 93e9bf
    if (MachIsMIPS(arch))
Peter Robinson 93e9bf
       return((ptrbits == 64) ? "-mabi=64" : "-mabi=n32");
Marcin Juszkiewicz 6a1747
Index: ATLAS/include/atlas_genparse.h
Marcin Juszkiewicz 6a1747
===================================================================
Marcin Juszkiewicz 6a1747
--- ATLAS.orig/include/atlas_genparse.h
Marcin Juszkiewicz 6a1747
+++ ATLAS/include/atlas_genparse.h
Peter Robinson 93e9bf
@@ -6,13 +6,13 @@
Peter Robinson 93e9bf
 #include <assert.h>
Peter Robinson 93e9bf
 #include <string.h>
Peter Robinson 93e9bf
 #include <ctype.h>
Peter Robinson 93e9bf
-#define NASMD 9
Peter Robinson 93e9bf
+#define NASMD 10
Peter Robinson 93e9bf
 enum ASMDIA
Peter Robinson 93e9bf
    {ASM_None=0, gas_x86_32, gas_x86_64, gas_sparc, gas_ppc, gas_parisc,
Peter Robinson 93e9bf
-    gas_mips, gas_arm, gas_s390};
Peter Robinson 93e9bf
+    gas_mips, gas_arm, gas_s390, gas_aarch64};
Peter Robinson 93e9bf
 static char *ASMNAM[NASMD] =
Peter Robinson 93e9bf
    {"",     "GAS_x8632", "GAS_x8664", "GAS_SPARC", "GAS_PPC", "GAS_PARISC",
Peter Robinson 93e9bf
-    "GAS_MIPS", "GAS_ARM", "GAS_S390"};
Peter Robinson 93e9bf
+    "GAS_MIPS", "GAS_ARM", "GAS_S390", "GAS_AARCH64"};
Peter Robinson 93e9bf
 /*
Peter Robinson 93e9bf
  * Basic data structure for forming queues with some minimal info
Peter Robinson 93e9bf
  */