1
/* This file is part of the Vc library.
3
Copyright (C) 2009-2012 Matthias Kretz <kretz@kde.org>
5
Vc is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as
7
published by the Free Software Foundation, either version 3 of
8
the License, or (at your option) any later version.
10
Vc is distributed in the hope that it will be useful, but
11
WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU Lesser General Public License for more details.
15
You should have received a copy of the GNU Lesser General Public
16
License along with Vc. If not, see <http://www.gnu.org/licenses/>.
20
#ifndef VC_COMMON_TRIGONOMETRIC_H
21
#define VC_COMMON_TRIGONOMETRIC_H
23
#ifndef VC__USE_NAMESPACE
24
#error "Do not include Vc/common/trigonometric.h outside of Vc itself"
32
using Vc::VC__USE_NAMESPACE::Vector;
37
template<Vc::Implementation Impl> struct MapImpl { enum Dummy { Value = Impl }; };
38
template<> struct MapImpl<Vc::SSE42Impl> { enum Dummy { Value = MapImpl<Vc::SSE41Impl>::Value }; };
39
typedef ImplementationT<MapImpl<VC_IMPL>::Value
40
#if defined(VC_IMPL_XOP) && defined(VC_IMPL_FMA4)
42
+ Vc::Fma4Instructions
44
> TrigonometricImplementation;
45
} // namespace Internal
47
template<typename Impl> struct Trigonometric
49
template<typename T> static Vector<T> sin(const Vector<T> &_x);
50
template<typename T> static Vector<T> cos(const Vector<T> &_x);
51
template<typename T> static void sincos(const Vector<T> &_x, Vector<T> *_sin, Vector<T> *_cos);
52
template<typename T> static Vector<T> asin (const Vector<T> &_x);
53
template<typename T> static Vector<T> atan (const Vector<T> &_x);
54
template<typename T> static Vector<T> atan2(const Vector<T> &y, const Vector<T> &x);
56
namespace VC__USE_NAMESPACE
57
#undef VC__USE_NAMESPACE
59
template<typename T> static Vc_ALWAYS_INLINE Vc_PURE Vector<T> sin(const Vector<T> &_x) {
60
return Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::sin(_x);
62
template<typename T> static Vc_ALWAYS_INLINE Vc_PURE Vector<T> cos(const Vector<T> &_x) {
63
return Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::cos(_x);
65
template<typename T> static Vc_ALWAYS_INLINE void sincos(const Vector<T> &_x, Vector<T> *_sin, Vector<T> *_cos) {
66
Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::sincos(_x, _sin, _cos);
68
template<typename T> static Vc_ALWAYS_INLINE Vc_PURE Vector<T> asin (const Vector<T> &_x) {
69
return Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::asin(_x);
71
template<typename T> static Vc_ALWAYS_INLINE Vc_PURE Vector<T> atan (const Vector<T> &_x) {
72
return Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::atan(_x);
74
template<typename T> static Vc_ALWAYS_INLINE Vc_PURE Vector<T> atan2(const Vector<T> &y, const Vector<T> &x) {
75
return Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::atan2(y, x);
77
} // namespace VC__USE_NAMESPACE
80
#include "undomacros.h"
81
#endif // VC_COMMON_TRIGONOMETRIC_H