#define VC_SSE_MATH_H
#include "const.h"
+#include "macros.h"
+namespace AliRoot {
namespace Vc
{
namespace SSE
}
#ifdef VC_IMPL_SSE4_1
+ inline double_v trunc(double_v::AsArg v) { return _mm_round_pd(v.data(), 0x3); }
+ inline float_v trunc(float_v::AsArg v) { return _mm_round_ps(v.data(), 0x3); }
+ inline sfloat_v trunc(sfloat_v::AsArg v) { return M256::create(_mm_round_ps(v.data()[0], 0x3),
+ _mm_round_ps(v.data()[1], 0x3)); }
+
inline double_v floor(double_v::AsArg v) { return _mm_floor_pd(v.data()); }
inline float_v floor(float_v::AsArg v) { return _mm_floor_ps(v.data()); }
inline sfloat_v floor(sfloat_v::AsArg v) { return M256::create(_mm_floor_ps(v.data()[0]),
_mm_floor_ps(v.data()[1])); }
+
inline double_v ceil(double_v::AsArg v) { return _mm_ceil_pd(v.data()); }
inline float_v ceil(float_v::AsArg v) { return _mm_ceil_ps(v.data()); }
inline sfloat_v ceil(sfloat_v::AsArg v) { return M256::create(_mm_ceil_ps(v.data()[0]),
}
template<typename T>
- inline Vector<T> floor(Vector<T> _v) {
+ inline Vector<T> trunc(VC_ALIGNED_PARAMETER(Vector<T>) _v) {
+ typedef Vector<T> V;
+ typedef typename V::Mask M;
+
+ V v = _v;
+ V e = abs(v).exponent();
+ const M negativeExponent = e < 0;
+ e.setZero(negativeExponent);
+ //const M negativeInput = v < V::Zero();
+
+ floor_shift(v, e);
+
+ v.setZero(negativeExponent);
+ //v(negativeInput && _v != v) -= V::One();
+ return v;
+ }
+
+ template<typename T>
+ inline Vector<T> floor(VC_ALIGNED_PARAMETER(Vector<T>) _v) {
typedef Vector<T> V;
typedef typename V::Mask M;
}
template<typename T>
- inline Vector<T> ceil(Vector<T> _v) {
+ inline Vector<T> ceil(VC_ALIGNED_PARAMETER(Vector<T>) _v) {
typedef Vector<T> V;
typedef typename V::Mask M;
#endif
} // namespace SSE
} // namespace Vc
+} // namespace AliRoot
+
+#include "undomacros.h"
#define VC__USE_NAMESPACE SSE
#include "../common/trigonometric.h"