|
|
c34203 |
From dce732e9fe47b44d1a985d10a0eb97aac6afa28e Mon Sep 17 00:00:00 2001
|
|
|
c34203 |
From: Andreas Arnez <arnez@linux.ibm.com>
|
|
|
c34203 |
Date: Wed, 25 Mar 2020 20:11:19 +0100
|
|
|
c34203 |
Subject: [PATCH 6/8] Add IBM z14 support
|
|
|
c34203 |
|
|
|
c34203 |
Add general support for IBM z14. Also detect and handle the vector
|
|
|
c34203 |
enhancements facility 1, which specifically adds single-precision FP
|
|
|
c34203 |
arithmetic for vectors.
|
|
|
c34203 |
---
|
|
|
c34203 |
CONFIG/include/atlconf.h | 14 ++++----
|
|
|
c34203 |
CONFIG/src/Makefile | 6 ++++
|
|
|
c34203 |
CONFIG/src/atlcomp.txt | 4 +++
|
|
|
c34203 |
CONFIG/src/backend/Make.ext | 4 ++-
|
|
|
c34203 |
CONFIG/src/backend/archinfo_linux.c | 3 +-
|
|
|
c34203 |
CONFIG/src/backend/probe_vxz2.c | 12 +++++++
|
|
|
c34203 |
CONFIG/src/probe_comp.c | 3 +-
|
|
|
c34203 |
include/atlas_prefetch.h | 3 +-
|
|
|
c34203 |
include/atlas_simd.h | 53 +++++++++++++++++++++++++++++
|
|
|
c34203 |
9 files changed, 91 insertions(+), 11 deletions(-)
|
|
|
c34203 |
create mode 100644 CONFIG/src/backend/probe_vxz2.c
|
|
|
c34203 |
|
|
|
c34203 |
diff --git a/CONFIG/include/atlconf.h b/CONFIG/include/atlconf.h
|
|
|
c34203 |
index e51d56d..3828fdb 100644
|
|
|
c34203 |
--- a/CONFIG/include/atlconf.h
|
|
|
c34203 |
+++ b/CONFIG/include/atlconf.h
|
|
|
c34203 |
@@ -25,11 +25,11 @@ enum ARCHFAM {AFOther=0, AFPPC, AFSPARC, AFALPHA, AFX86, AFIA64, AFMIPS,
|
|
|
c34203 |
* Corei3EP: v3 Haswell, E5-26XX
|
|
|
c34203 |
* Corei4: skylake
|
|
|
c34203 |
*/
|
|
|
c34203 |
-#define NMACH 62
|
|
|
c34203 |
+#define NMACH 63
|
|
|
c34203 |
static char *machnam[NMACH] =
|
|
|
c34203 |
{"UNKNOWN", "PPCG4", "PPCG5", "POWER3", "POWER4", "POWER5",
|
|
|
c34203 |
"POWER6", "POWER7", "POWER8", "POWERe6500",
|
|
|
c34203 |
- "IBMz9", "IBMz10", "IBMz196", "IBMz12", "IBMz13",
|
|
|
c34203 |
+ "IBMz9", "IBMz10", "IBMz196", "IBMz12", "IBMz13", "IBMz14",
|
|
|
c34203 |
"x86x87", "x86SSE1", "x86SSE2", "x86SSE3",
|
|
|
c34203 |
"P5", "P5MMX", "PPRO", "PII", "PIII", "PM", "CoreSolo",
|
|
|
c34203 |
"CoreDuo", "Core2Solo", "Core2", "Corei1", "Corei2", "Corei3",
|
|
|
c34203 |
@@ -42,7 +42,7 @@ static char *machnam[NMACH] =
|
|
|
c34203 |
"ARM64xgene1", "ARM64a53", "ARM64a57"};
|
|
|
c34203 |
enum MACHTYPE {MACHOther, PPCG4, PPCG5, IbmPwr3, IbmPwr4, IbmPwr5,
|
|
|
c34203 |
IbmPwr6, IbmPwr7, IbmPwr8, Pwre6500,
|
|
|
c34203 |
- IbmZ9, IbmZ10, IbmZ196, IbmZ12, IbmZ13, /* s390(x) in Linux */
|
|
|
c34203 |
+ IbmZ9, IbmZ10, IbmZ196, IbmZ12, IbmZ13, IbmZ14, /* s390(x) */
|
|
|
c34203 |
x86x87, x86SSE1, x86SSE2, x86SSE3, /* generic targets */
|
|
|
c34203 |
IntP5, IntP5MMX, IntPPRO, IntPII, IntPIII, IntPM, IntCoreS,
|
|
|
c34203 |
IntCoreDuo, IntCore2Solo, IntCore2, IntCorei1, IntCorei2,
|
|
|
c34203 |
@@ -82,7 +82,7 @@ enum MACHTYPE {MACHOther, PPCG4, PPCG5, IbmPwr3, IbmPwr4, IbmPwr5,
|
|
|
c34203 |
#define MachIsARM64(mach_) \
|
|
|
c34203 |
( (mach_) >= ARM64xg && || (mach_) <= ARM64a57)
|
|
|
c34203 |
#define MachIsS390(mach_) \
|
|
|
c34203 |
- ( (mach_) >= IbmZ9 && (mach_) <= IbmZ13 )
|
|
|
c34203 |
+ ( (mach_) >= IbmZ9 && (mach_) <= IbmZ14 )
|
|
|
c34203 |
|
|
|
c34203 |
|
|
|
c34203 |
static char *f2c_namestr[5] = {"UNKNOWN","Add_", "Add__", "NoChange", "UpCase"};
|
|
|
c34203 |
@@ -96,13 +96,13 @@ enum F2CNAME {f2c_NamErr=0, f2c_Add_, f2c_Add__, f2c_NoChange, f2c_UpCase};
|
|
|
c34203 |
enum F2CINT {f2c_IntErr=0, FintCint, FintClong, FintClonglong, FintCshort};
|
|
|
c34203 |
enum F2CSTRING {f2c_StrErr=0, fstrSun, fstrCray, fstrStructVal, fstrStructPtr};
|
|
|
c34203 |
|
|
|
c34203 |
-#define NISA 15
|
|
|
c34203 |
+#define NISA 16
|
|
|
c34203 |
static char *ISAXNAM[NISA] =
|
|
|
c34203 |
- {"", "VSX", "VXZ", "AltiVec",
|
|
|
c34203 |
+ {"", "VSX", "VXZ2", "VXZ", "AltiVec",
|
|
|
c34203 |
"AVXMAC", "AVXFMA4", "AVX", "SSE3", "SSE2", "SSE1", "3DNow",
|
|
|
c34203 |
"FPV3D2MACNEON", "FPV3D16MACNEON", "FPV3D32MAC", "FPV3D16MAC"};
|
|
|
c34203 |
enum ISAEXT
|
|
|
c34203 |
- {ISA_None=0, ISA_VSX, ISA_VXZ, ISA_AV,
|
|
|
c34203 |
+ {ISA_None=0, ISA_VSX, ISA_VXZ2, ISA_VXZ, ISA_AV,
|
|
|
c34203 |
ISA_AVXMAC, ISA_AVXFMA4, ISA_AVX, ISA_SSE3, ISA_SSE2, ISA_SSE1, ISA_3DNow,
|
|
|
c34203 |
ISA_NEON, ISA_NEON16, ISA_VFP3D32MAC, ISA_VFP3D16MAC};
|
|
|
c34203 |
|
|
|
c34203 |
diff --git a/CONFIG/src/Makefile b/CONFIG/src/Makefile
|
|
|
c34203 |
index 212b9d7..782a4cf 100644
|
|
|
c34203 |
--- a/CONFIG/src/Makefile
|
|
|
c34203 |
+++ b/CONFIG/src/Makefile
|
|
|
c34203 |
@@ -158,6 +158,12 @@ IRun_NEON :
|
|
|
c34203 |
$(MAKE) $(atlrun) atldir=$(mydir) exe=xprobe_neon args="$(args)" \
|
|
|
c34203 |
redir=config0.out
|
|
|
c34203 |
- cat config0.out
|
|
|
c34203 |
+IRun_VXZ2 :
|
|
|
c34203 |
+ $(CC) $(CCFLAGS) -march=native -mvx -mzvector -o xprobe_vxz2 \
|
|
|
c34203 |
+ $(SRCdir)/backend/probe_svec.c $(SRCdir)/backend/probe_vxz2.c
|
|
|
c34203 |
+ $(MAKE) $(atlrun) atldir=$(mydir) exe=xprobe_vxz2 args="$(args)" \
|
|
|
c34203 |
+ redir=config0.out
|
|
|
c34203 |
+ - cat config0.out
|
|
|
c34203 |
IRun_VXZ :
|
|
|
c34203 |
$(CC) $(CCFLAGS) -march=native -mvx -mzvector -o xprobe_vxz \
|
|
|
c34203 |
$(SRCdir)/backend/probe_dvec.c $(SRCdir)/backend/probe_vxz.c
|
|
|
c34203 |
diff --git a/CONFIG/src/atlcomp.txt b/CONFIG/src/atlcomp.txt
|
|
|
c34203 |
index 2ac71cf..2cfacc2 100644
|
|
|
c34203 |
--- a/CONFIG/src/atlcomp.txt
|
|
|
c34203 |
+++ b/CONFIG/src/atlcomp.txt
|
|
|
c34203 |
@@ -250,6 +250,10 @@ MACH=IBMz13 OS=ALL LVL=1000 COMPS=smc,dmc,skc,dkc,icc,xcc,gcc
|
|
|
c34203 |
'gcc' '-march=z13 -mtune=z13 -O2'
|
|
|
c34203 |
MACH=IBMz13 OS=ALL LVL=1000 COMPS=f77
|
|
|
c34203 |
'gfortran' '-march=z13 -mtune=z13 -O2'
|
|
|
c34203 |
+MACH=IBMz14 OS=ALL LVL=1000 COMPS=smc,dmc,skc,dkc,icc,xcc,gcc
|
|
|
c34203 |
+ 'gcc' '-march=z14 -mtune=z14 -O2'
|
|
|
c34203 |
+MACH=IBMz14 OS=ALL LVL=1000 COMPS=f77
|
|
|
c34203 |
+ 'gfortran' '-march=z14 -mtune=z14 -O2'
|
|
|
c34203 |
#
|
|
|
c34203 |
# Windows defaults ; need to make SSE/SSE2 arch dep.
|
|
|
c34203 |
#
|
|
|
c34203 |
diff --git a/CONFIG/src/backend/Make.ext b/CONFIG/src/backend/Make.ext
|
|
|
c34203 |
index 4743353..794babf 100644
|
|
|
c34203 |
--- a/CONFIG/src/backend/Make.ext
|
|
|
c34203 |
+++ b/CONFIG/src/backend/Make.ext
|
|
|
c34203 |
@@ -39,7 +39,7 @@ files = archinfo_aix.c archinfo_freebsd.c archinfo_irix.c archinfo_linux.c \
|
|
|
c34203 |
probe_gas_mips.S probe_gas_parisc.S probe_gas_ppc.S probe_gas_s390.S \
|
|
|
c34203 |
probe_gas_sparc.S probe_gas_wow64.S probe_gas_x8632.S \
|
|
|
c34203 |
probe_gas_x8664.S probe_smac.c probe_svec.c probe_this_asm.c \
|
|
|
c34203 |
- probe_vxz.c
|
|
|
c34203 |
+ probe_vxz2.c probe_vxz.c
|
|
|
c34203 |
|
|
|
c34203 |
all : $(files)
|
|
|
c34203 |
|
|
|
c34203 |
@@ -107,6 +107,8 @@ flibchkF.f : $(basf)
|
|
|
c34203 |
$(extF) -b $(basf) -o flibchkF.f rout=flibchkF.f
|
|
|
c34203 |
probe_arm32_FPABI.c : $(basf)
|
|
|
c34203 |
$(extC) -b $(basf) -o probe_arm32_FPABI.c rout=probe_arm32_FPABI
|
|
|
c34203 |
+probe_vxz2.c : $(basf)
|
|
|
c34203 |
+ $(extC) -b $(basf) -o probe_vxz2.c rout=probe_vxz2
|
|
|
c34203 |
probe_vxz.c : $(basf)
|
|
|
c34203 |
$(extC) -b $(basf) -o probe_vxz.c rout=probe_vxz
|
|
|
c34203 |
probe_aff_SETAFFNP.c : $(basf)
|
|
|
c34203 |
diff --git a/CONFIG/src/backend/archinfo_linux.c b/CONFIG/src/backend/archinfo_linux.c
|
|
|
c34203 |
index cdcee92..ed6f476 100644
|
|
|
c34203 |
--- a/CONFIG/src/backend/archinfo_linux.c
|
|
|
c34203 |
+++ b/CONFIG/src/backend/archinfo_linux.c
|
|
|
c34203 |
@@ -336,7 +336,8 @@ enum MACHTYPE ProbeArch()
|
|
|
c34203 |
else if (strstr(res, "2817") || strstr(res, "2818")) mach = IbmZ196;
|
|
|
c34203 |
else if (strstr(res, "2827") || strstr(res, "2828")) mach = IbmZ12;
|
|
|
c34203 |
else if (strstr(res, "2964") || strstr(res, "2965")) mach = IbmZ13;
|
|
|
c34203 |
- else mach = IbmZ13; /* looks risky to me, but IBM folks did it */
|
|
|
c34203 |
+ else if (strstr(res, "3906") || strstr(res, "3907")) mach = IbmZ14;
|
|
|
c34203 |
+ else mach = IbmZ14; /* looks risky to me, but IBM folks did it */
|
|
|
c34203 |
free(res);
|
|
|
c34203 |
}
|
|
|
c34203 |
break;
|
|
|
c34203 |
diff --git a/CONFIG/src/backend/probe_vxz2.c b/CONFIG/src/backend/probe_vxz2.c
|
|
|
c34203 |
new file mode 100644
|
|
|
c34203 |
index 0000000..a69d92d
|
|
|
c34203 |
--- /dev/null
|
|
|
c34203 |
+++ b/CONFIG/src/backend/probe_vxz2.c
|
|
|
c34203 |
@@ -0,0 +1,12 @@
|
|
|
c34203 |
+#include <vecintrin.h>
|
|
|
c34203 |
+void do_vsum(float *z, float *x, float *y) // RETURNS: z = x + y
|
|
|
c34203 |
+{
|
|
|
c34203 |
+ vector float vx, vy;
|
|
|
c34203 |
+ vx = (vector float) {x[0], x[1], x[2], x[3]};
|
|
|
c34203 |
+ vy = (vector float) {y[0], y[1], y[2], y[3]};
|
|
|
c34203 |
+ vy += vx;
|
|
|
c34203 |
+ z[0] = vy[0];
|
|
|
c34203 |
+ z[1] = vy[1];
|
|
|
c34203 |
+ z[2] = vy[2];
|
|
|
c34203 |
+ z[3] = vy[3];
|
|
|
c34203 |
+}
|
|
|
c34203 |
diff --git a/CONFIG/src/probe_comp.c b/CONFIG/src/probe_comp.c
|
|
|
c34203 |
index 1652e24..857ea82 100644
|
|
|
c34203 |
--- a/CONFIG/src/probe_comp.c
|
|
|
c34203 |
+++ b/CONFIG/src/probe_comp.c
|
|
|
c34203 |
@@ -452,7 +452,7 @@ COMPNODE **GetDefaultComps(enum OSTYPE OS, enum MACHTYPE arch, int verb,
|
|
|
c34203 |
vp = "-mavx2 -mfma";
|
|
|
c34203 |
else if (vecexts & (1<
|
|
|
c34203 |
vp = "-mvsx";
|
|
|
c34203 |
- else if (vecexts & (1<
|
|
|
c34203 |
+ else if ((vecexts & (1<
|
|
|
c34203 |
vp = "-mvx -mzvector";
|
|
|
c34203 |
else if (vecexts & (1<
|
|
|
c34203 |
vp = "-maltivec";
|
|
|
c34203 |
@@ -1207,6 +1207,7 @@ void GetBestGccVers(enum OSTYPE OS, enum MACHTYPE arch,
|
|
|
c34203 |
{
|
|
|
c34203 |
case IbmZ12:
|
|
|
c34203 |
case IbmZ13:
|
|
|
c34203 |
+ case IbmZ14:
|
|
|
c34203 |
case IntCorei3:
|
|
|
c34203 |
case IntCorei4:
|
|
|
c34203 |
case IntCorei2:
|
|
|
c34203 |
diff --git a/include/atlas_prefetch.h b/include/atlas_prefetch.h
|
|
|
c34203 |
index e7988a7..fa426ac 100644
|
|
|
c34203 |
--- a/include/atlas_prefetch.h
|
|
|
c34203 |
+++ b/include/atlas_prefetch.h
|
|
|
c34203 |
@@ -155,7 +155,8 @@
|
|
|
c34203 |
#define ATL_L1LS 32
|
|
|
c34203 |
#define ATL_L2LS 64
|
|
|
c34203 |
#elif defined(ATL_ARCH_IBMz196) || defined(ATL_ARCH_IBMz10) || \
|
|
|
c34203 |
- defined(ATL_ARCH_IBMzEC12) || defined(ATL_ARCH_IBMz13)
|
|
|
c34203 |
+ defined(ATL_ARCH_IBMzEC12) || defined(ATL_ARCH_IBMz13) || \
|
|
|
c34203 |
+ defined(ATL_ARCH_IbmZ14)
|
|
|
c34203 |
#define ATL_pfl1R(mem) __builtin_prefetch(mem, 0, 3)
|
|
|
c34203 |
#define ATL_pfl1W(mem) __builtin_prefetch(mem, 1, 3)
|
|
|
c34203 |
#define ATL_GOT_L1PREFETCH
|
|
|
c34203 |
diff --git a/include/atlas_simd.h b/include/atlas_simd.h
|
|
|
c34203 |
index f171933..eb75577 100644
|
|
|
c34203 |
--- a/include/atlas_simd.h
|
|
|
c34203 |
+++ b/include/atlas_simd.h
|
|
|
c34203 |
@@ -68,6 +68,11 @@
|
|
|
c34203 |
((defined(DREAL) || defined(DCPLX)) && ATL_VLEN != 2)
|
|
|
c34203 |
#define ATL_FRCGNUVEC
|
|
|
c34203 |
#endif
|
|
|
c34203 |
+ #elif defined(ATL_VXZ2)
|
|
|
c34203 |
+ #if ((defined(SREAL) || defined(SCPLX)) && ATL_VLEN != 4) || \
|
|
|
c34203 |
+ ((defined(DREAL) || defined(DCPLX)) && ATL_VLEN != 2)
|
|
|
c34203 |
+ #define ATL_FRCGNUVEC
|
|
|
c34203 |
+ #endif
|
|
|
c34203 |
#elif defined(ATL_VXZ)
|
|
|
c34203 |
#if ATL_VLEN != 2
|
|
|
c34203 |
#define ATL_FRCGNUVEC
|
|
|
c34203 |
@@ -113,6 +118,12 @@
|
|
|
c34203 |
#else
|
|
|
c34203 |
#define ATL_VLEN 2
|
|
|
c34203 |
#endif
|
|
|
c34203 |
+ #elif defined(ATL_VXZ2)
|
|
|
c34203 |
+ #if defined(SREAL) || defined(SCPLX)
|
|
|
c34203 |
+ #define ATL_VLEN 4
|
|
|
c34203 |
+ #else
|
|
|
c34203 |
+ #define ATL_VLEN 2
|
|
|
c34203 |
+ #endif
|
|
|
c34203 |
#elif defined(ATL_VXZ)
|
|
|
c34203 |
#define ATL_VLEN 2
|
|
|
c34203 |
#elif defined(ATL_NEON)
|
|
|
c34203 |
@@ -376,6 +387,48 @@
|
|
|
c34203 |
#define ATL_vsplat0(d_, s_) d_ = vec_splat(s_, 0)
|
|
|
c34203 |
#define ATL_vsplat1(d_, s_) d_ = vec_splat(s_, 1)
|
|
|
c34203 |
#endif
|
|
|
c34203 |
+#elif defined(ATL_VXZ2)
|
|
|
c34203 |
+ #include <vecintrin.h>
|
|
|
c34203 |
+
|
|
|
c34203 |
+ #define ATL_VPERMI(s_, t_, i_) \
|
|
|
c34203 |
+ ((ATL_VTYPE) vec_permi((vector double) s_, (vector double) t_, i_))
|
|
|
c34203 |
+
|
|
|
c34203 |
+ #if defined(SREAL) || defined(SCPLX)
|
|
|
c34203 |
+ #define ATL_VTYPE vector float
|
|
|
c34203 |
+ #if ATL_VLEN != 4
|
|
|
c34203 |
+ #error "VSXZ2 supports only VLEN = 4 for floats!"
|
|
|
c34203 |
+ #endif
|
|
|
c34203 |
+ #define ATL_vvrsum4(s0_, s1_, s2_, s3_) \
|
|
|
c34203 |
+ { ATL_VTYPE t0_, t1_; \
|
|
|
c34203 |
+ t0_ = vec_mergeh(s0_, s1_) + vec_mergel(s0_, s1_); \
|
|
|
c34203 |
+ t1_ = vec_mergeh(s2_, s3_) + vec_mergel(s2_, s3_); \
|
|
|
c34203 |
+ s0_ = ATL_VPERMI(t0_, t1_, 0) + ATL_VPERMI(t0_, t1_, 3); \
|
|
|
c34203 |
+ }
|
|
|
c34203 |
+ #define ATL_vsplat2(d_, s_) d_ = vec_splat(s_, 2)
|
|
|
c34203 |
+ #define ATL_vsplat3(d_, s_) d_ = vec_splat(s_, 3)
|
|
|
c34203 |
+ #else /* double precision */
|
|
|
c34203 |
+ #define ATL_VTYPE vector double
|
|
|
c34203 |
+ #if ATL_VLEN != 2
|
|
|
c34203 |
+ #error "VSXZ2 supports only VLEN = 2 for doubles!"
|
|
|
c34203 |
+ #endif
|
|
|
c34203 |
+ #define ATL_vvrsum1(s0_) \
|
|
|
c34203 |
+ { s0_ = vec_mergeh(s0_, s0_) + vec_mergel(s0_, s0_); }
|
|
|
c34203 |
+ #define ATL_vvrsum2(s0_, s1_) \
|
|
|
c34203 |
+ { s0_ = vec_mergeh(s0_, s1_) + vec_mergel(s0_, s1_); }
|
|
|
c34203 |
+ #endif
|
|
|
c34203 |
+ #define ATL_vld(v_, p_) v_ = *(ATL_VTYPE *)(p_)
|
|
|
c34203 |
+ #define ATL_vst(p_, v_) *(ATL_VTYPE *)(p_) = v_
|
|
|
c34203 |
+ #define ATL_vzero(v_) v_ = vec_splats((TYPE)0.0)
|
|
|
c34203 |
+ #define ATL_vcopy(d_, s_) d_ = s_
|
|
|
c34203 |
+ #define ATL_vbcast(v_, p_) v_ = vec_splats(*((TYPE*)(p_)))
|
|
|
c34203 |
+ #define ATL_vuld(v_, p_) v_ = vec_xl(0, (TYPE *)(p_))
|
|
|
c34203 |
+ #define ATL_vust(p_, v_) vec_xst(v_, 0, (TYPE *)(p_))
|
|
|
c34203 |
+ #define ATL_vadd(d_, s1_, s2_) d_ = s1_ + s2_
|
|
|
c34203 |
+ #define ATL_vsub(d_, s1_, s2_) d_ = s1_ - s2_
|
|
|
c34203 |
+ #define ATL_vmul(d_, s1_, s2_) d_ = s1_ * s2_
|
|
|
c34203 |
+ #define ATL_vmac(d_, s1_, s2_) d_ = __builtin_s390_vec_madd(s1_, s2_, d_)
|
|
|
c34203 |
+ #define ATL_vsplat0(d_, s_) d_ = vec_splat(s_, 0)
|
|
|
c34203 |
+ #define ATL_vsplat1(d_, s_) d_ = vec_splat(s_, 1)
|
|
|
c34203 |
#elif defined(ATL_VXZ)
|
|
|
c34203 |
#include <vecintrin.h>
|
|
|
c34203 |
|
|
|
c34203 |
--
|
|
|
c34203 |
2.23.0
|
|
|
c34203 |
|