33fa5a
From ad278554860b0da7d5848262a7bf35e058266cb1 Mon Sep 17 00:00:00 2001
33fa5a
From: Andreas Arnez <arnez@linux.ibm.com>
33fa5a
Date: Wed, 12 Dec 2018 20:06:27 +0100
33fa5a
Subject: [PATCH 5/8] Optimizations for IBM z13
33fa5a
33fa5a
Perform some optimizations for IBM z13:
33fa5a
- Compile with -O2 instead of -O.
33fa5a
- Streamline vector loads/stores.
33fa5a
- Define the vvrsum2 macro.
33fa5a
33fa5a
Also, use the compile option -march=z13 instead of -march=native.
33fa5a
---
33fa5a
 CONFIG/src/atlcomp.txt |  8 +++-----
33fa5a
 include/atlas_simd.h   | 11 +++++------
33fa5a
 2 files changed, 8 insertions(+), 11 deletions(-)
33fa5a
33fa5a
diff --git a/CONFIG/src/atlcomp.txt b/CONFIG/src/atlcomp.txt
33fa5a
index aa31604..2ac71cf 100644
33fa5a
--- a/CONFIG/src/atlcomp.txt
33fa5a
+++ b/CONFIG/src/atlcomp.txt
33fa5a
@@ -246,12 +246,10 @@ MACH=IBMz9,IBMz10,IBMz196 OS=ALL LVL=500 COMPS=f77
33fa5a
    'gfortran' '-O3 -funroll-loops'
33fa5a
 MACH=IBMz9,IBMz10,IBMz196,IBMz12 OS=ALL LVL=500 COMPS=smc,dmc,skc,dkc,icc,xcc,gcc
33fa5a
    'gcc' '-O3 -funroll-loops'
33fa5a
-MACH=IBMz13 OS=ALL LVL=1000 COMPS=dmc,skc,dkc,icc,xcc,gcc
33fa5a
-   'gcc' '-march=native -O -mvx -mzvector'
33fa5a
-MACH=IBMz13 OS=ALL LVL=1000 COMPS=smc
33fa5a
-   'gcc' '-march=native -O -mvx -mzvector -fno-peephole -fno-peephole2'
33fa5a
+MACH=IBMz13 OS=ALL LVL=1000 COMPS=smc,dmc,skc,dkc,icc,xcc,gcc
33fa5a
+   'gcc' '-march=z13 -mtune=z13 -O2'
33fa5a
 MACH=IBMz13 OS=ALL LVL=1000 COMPS=f77
33fa5a
-   'gfortran' '-march=native -O -mvx -mzvector'
33fa5a
+   'gfortran' '-march=z13 -mtune=z13 -O2'
33fa5a
 #
33fa5a
 # Windows defaults ; need to make SSE/SSE2 arch dep.
33fa5a
 #
33fa5a
diff --git a/include/atlas_simd.h b/include/atlas_simd.h
33fa5a
index 68daf79..f171933 100644
33fa5a
--- a/include/atlas_simd.h
33fa5a
+++ b/include/atlas_simd.h
33fa5a
@@ -384,8 +384,8 @@
33fa5a
    #endif
33fa5a
    #define ATL_VTYPE vector double
33fa5a
    #if (defined(DREAL) || defined(DCPLX))
33fa5a
-      #define ATL_vld(v_, p_) {v_[0] = *(p_); v_[1] = (p_)[1]; }
33fa5a
-      #define ATL_vst(p_, v_)  {*(p_) = v_[0]; (p_)[1] = v_[1];}
33fa5a
+      #define ATL_vld(v_, p_) v_ = *(ATL_VTYPE *)(p_)
33fa5a
+      #define ATL_vst(p_, v_) *(ATL_VTYPE *)(p_) = v_
33fa5a
    #else
33fa5a
       #define ATL_vld(v_, p_) v_ = vec_ld2f(p_);
33fa5a
       #define ATL_vst(p_, v_) vec_st2f(v_, p_);
33fa5a
@@ -400,10 +400,9 @@
33fa5a
    #define ATL_vmul(d_, s1_, s2_) d_ =  s1_ * s2_
33fa5a
    #define ATL_vmac(d_, s1_, s2_) d_ = __builtin_s390_vec_madd(s1_, s2_, d_)
33fa5a
    #define ATL_vvrsum1(s0_) \
33fa5a
-   {  ATL_VTYPE t_;\
33fa5a
-      t_ = vec_splat(s0_, 1); \
33fa5a
-      s0_ += t_; \
33fa5a
-   }
33fa5a
+   {  s0_ = vec_mergeh(s0_, s0_) + vec_mergel(s0_, s0_); }
33fa5a
+   #define ATL_vvrsum2(s0_, s1_) \
33fa5a
+   {  s0_ = vec_mergeh(s0_, s1_) + vec_mergel(s0_, s1_); }
33fa5a
    #define ATL_vsplat0(d_, s_) d_ = vec_splat(s_, 0)
33fa5a
    #define ATL_vsplat1(d_, s_) d_ = vec_splat(s_, 1)
33fa5a
 #elif defined(ATL_NEON) && (defined(SREAL) || defined(SCPLX))
33fa5a
-- 
33fa5a
2.23.0
33fa5a