From 91e04056f974892dc1aebd9397e415ea682815fe Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Thu, 12 May 2016 19:24:10 +0100 Subject: [PATCH] fix of the empty SIMD --- lib/simd/Grid_empty.h | 50 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/lib/simd/Grid_empty.h b/lib/simd/Grid_empty.h index 5ab75de7..46082130 100644 --- a/lib/simd/Grid_empty.h +++ b/lib/simd/Grid_empty.h @@ -377,7 +377,55 @@ namespace Optimization { template < typename vtype > void permute(vtype &a, vtype b, int perm) { - }; + }; + + struct Rotate{ + + static inline u128f rotate(u128f in,int n){ + u128f out; + switch(n){ + case 0: + out.f[0] = in.f[0]; + out.f[1] = in.f[1]; + out.f[2] = in.f[2]; + out.f[3] = in.f[3]; + break; + case 1: + out.f[0] = in.f[1]; + out.f[1] = in.f[2]; + out.f[2] = in.f[3]; + out.f[3] = in.f[0]; + break; + case 2: + out.f[0] = in.f[2]; + out.f[1] = in.f[3]; + out.f[2] = in.f[0]; + out.f[3] = in.f[1]; + break; + case 3: + out.f[0] = in.f[3]; + out.f[1] = in.f[0]; + out.f[2] = in.f[1]; + out.f[3] = in.f[2]; + break; + default: assert(0); + } + } + static inline u128d rotate(u128d in,int n){ + u128d out; + switch(n){ + case 0: + out.f[0] = in.f[0]; + out.f[1] = in.f[1]; + break; + case 1: + out.f[0] = in.f[1]; + out.f[1] = in.f[0]; + break; + default: assert(0); + } + } + }; //Complex float Reduce template<>