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