31#ifndef BZ_TVEVALUATE_H
32#define BZ_TVEVALUATE_H
35#include <blitz/update.h>
37#include <blitz/meta/vecassign.h>
44template<
bool unroll,
int N_length>
55 template<
typename T,
typename T_expr,
typename T_update>
58 const T_expr& expr, T_update) {
64 if (!expr.shapeCheck(dest.
shape()))
66 if (assertFailMode ==
false)
68 cerr <<
"[Blitz++] Shape check failed: Module " << __FILE__
69 <<
" line " << __LINE__ << endl
73 expr.prettyPrint(str, format);
79 BZPRECHECK(expr.shapeCheck(dest.
shape()),
80 "Shape check failed." << endl <<
"Expression:");
82 BZPRECONDITION(expr.isUnitStride(0));
83 BZPRECONDITION(T_expr::rank_<=1);
84 BZPRECONDITION(T_expr::numIndexPlaceholders==0);
97 template<
typename T_numtype,
typename T_expr,
typename T_update>
100#ifdef BZ_USE_ALIGNMENT_PRAGMAS
102#pragma vector aligned
104 for (
int i=0; i < N_length; ++i)
105 T_update::update(data[i], expr.fastRead(i));
112 template<
typename T_numtype,
typename T_expr,
typename T_update>
115#ifdef BZ_USE_ALIGNMENT_PRAGMAS
117#pragma vector unaligned
119 for (
int i=0; i < N_length; ++i)
120 T_update::update(data[i], expr.fastRead(i));
125template<
int N_length>
131 template<
typename T,
typename T_expr,
typename T_update>
134 const T_expr& expr, T_update) {
135 _bz_evaluate(dest, expr, T_update());
142 template<
typename T_numtype,
typename T_expr,
typename T_update>
145#ifdef BZ_USE_ALIGNMENT_PRAGMAS
149 _bz_meta_vecAssign<N_length, 0>::fastAssign(data, expr, T_update());
156 template<
typename T_numtype,
typename T_expr,
typename T_update>
161 _bz_meta_vecAssign<N_length, 0>::fastAssign(data, expr, T_update());
169template<
typename P_numtype,
int N_length>
170template<
typename T_expr,
typename T_update>
175 const bool mixed_expr =
176 (T_expr::numArrayOperands>0) ||
177 (T_expr::numTMOperands>0) ||
178 (T_expr::numIndexPlaceholders>0);
The TinyVector class is a one-dimensional, fixed length vector that implements the blitz expression t...
Definition tinyvec2.h:73
const TinyVector< int, rank_ > shape() const
Definition tinyvec2.h:270
void _tv_evaluate(const T_expr &expr, T_update)
T_numtype *restrict data()
Definition tinyvec2.h:258
#define true
Definition compiler.h:101
Definition array-impl.h:66
static _bz_forceinline void evaluate_unaligned(T_numtype *data, const T_expr &expr, T_update)
This version of the evaluation function is used when vectorizing expressions that we know can't be al...
Definition tvevaluate.h:158
static _bz_forceinline void evaluate_aligned(T_numtype *data, const T_expr &expr, T_update)
This version of the evaluation function assumes that the TinyVectors have appropriate alignment (as w...
Definition tvevaluate.h:144
static _bz_forceinline void select_evaluation(TinyVector< T, N_length > &dest, const T_expr &expr, T_update)
The false version of select_evaluation is picked for expressions that contain operands other than Tin...
Definition tvevaluate.h:133
The _tv_evaluator class has a bool template argument that is used to select code paths at compile tim...
Definition tvevaluate.h:45
static _bz_forceinline void evaluate_unaligned(T_numtype *data, const T_expr &expr, T_update)
This version of the evaluation function is used when vectorizing expressions that we know can't be al...
Definition tvevaluate.h:114
static _bz_forceinline void evaluate_aligned(T_numtype *data, const T_expr &expr, T_update)
This version of the evaluation function assumes that the TinyVectors have appropriate alignment (as w...
Definition tvevaluate.h:99
static _bz_forceinline void select_evaluation(TinyVector< T, N_length > &dest, const T_expr &expr, T_update)
The select_evaluation function redirects expressions that do not contains solely TinyVector operands ...
Definition tvevaluate.h:57
#define _bz_forceinline
Definition tuning.h:79
#define BZ_TV_EVALUATE_UNROLL_LENGTH
Definition tuning.h:64