]>
Commit | Line | Data |
---|---|---|
f22341db | 1 | /* This file is part of the Vc library. |
2 | ||
3 | Copyright (C) 2009-2012 Matthias Kretz <kretz@kde.org> | |
4 | ||
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. | |
9 | ||
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. | |
14 | ||
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/>. | |
17 | ||
18 | */ | |
19 | ||
20 | #ifndef VC_COMMON_TRIGONOMETRIC_H | |
21 | #define VC_COMMON_TRIGONOMETRIC_H | |
22 | ||
c017a39f | 23 | #ifndef VC__USE_NAMESPACE |
24 | #error "Do not include Vc/common/trigonometric.h outside of Vc itself" | |
25 | #endif | |
f22341db | 26 | |
c017a39f | 27 | #include "macros.h" |
28 | namespace AliRoot { | |
f22341db | 29 | namespace Vc |
30 | { | |
c017a39f | 31 | namespace |
f22341db | 32 | { |
f22341db | 33 | using Vc::VC__USE_NAMESPACE::Vector; |
c017a39f | 34 | } // namespace |
f22341db | 35 | |
c017a39f | 36 | namespace Internal |
37 | { | |
38 | template<Vc::Implementation Impl> struct MapImpl { enum Dummy { Value = Impl }; }; | |
39 | template<> struct MapImpl<Vc::SSE42Impl> { enum Dummy { Value = MapImpl<Vc::SSE41Impl>::Value }; }; | |
40 | typedef ImplementationT<MapImpl<VC_IMPL>::Value | |
41 | #if defined(VC_IMPL_XOP) && defined(VC_IMPL_FMA4) | |
42 | + Vc::XopInstructions | |
43 | + Vc::Fma4Instructions | |
44 | #endif | |
45 | > TrigonometricImplementation; | |
46 | } // namespace Internal | |
f22341db | 47 | |
c017a39f | 48 | template<typename Impl> struct Trigonometric |
49 | { | |
50 | template<typename T> static Vector<T> sin(const Vector<T> &_x); | |
51 | template<typename T> static Vector<T> cos(const Vector<T> &_x); | |
52 | template<typename T> static void sincos(const Vector<T> &_x, Vector<T> *_sin, Vector<T> *_cos); | |
53 | template<typename T> static Vector<T> asin (const Vector<T> &_x); | |
54 | template<typename T> static Vector<T> atan (const Vector<T> &_x); | |
55 | template<typename T> static Vector<T> atan2(const Vector<T> &y, const Vector<T> &x); | |
56 | }; | |
57 | namespace VC__USE_NAMESPACE | |
58 | #undef VC__USE_NAMESPACE | |
59 | { | |
60 | template<typename T> static Vc_ALWAYS_INLINE Vc_PURE Vector<T> sin(const Vector<T> &_x) { | |
61 | return Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::sin(_x); | |
f22341db | 62 | } |
c017a39f | 63 | template<typename T> static Vc_ALWAYS_INLINE Vc_PURE Vector<T> cos(const Vector<T> &_x) { |
64 | return Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::cos(_x); | |
f22341db | 65 | } |
c017a39f | 66 | template<typename T> static Vc_ALWAYS_INLINE void sincos(const Vector<T> &_x, Vector<T> *_sin, Vector<T> *_cos) { |
67 | Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::sincos(_x, _sin, _cos); | |
f22341db | 68 | } |
c017a39f | 69 | template<typename T> static Vc_ALWAYS_INLINE Vc_PURE Vector<T> asin (const Vector<T> &_x) { |
70 | return Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::asin(_x); | |
f22341db | 71 | } |
c017a39f | 72 | template<typename T> static Vc_ALWAYS_INLINE Vc_PURE Vector<T> atan (const Vector<T> &_x) { |
73 | return Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::atan(_x); | |
f22341db | 74 | } |
c017a39f | 75 | template<typename T> static Vc_ALWAYS_INLINE Vc_PURE Vector<T> atan2(const Vector<T> &y, const Vector<T> &x) { |
76 | return Vc::Trigonometric<Vc::Internal::TrigonometricImplementation>::atan2(y, x); | |
f22341db | 77 | } |
f22341db | 78 | } // namespace VC__USE_NAMESPACE |
f22341db | 79 | } // namespace Vc |
c017a39f | 80 | } // namespace AliRoot |
f22341db | 81 | |
82 | #include "undomacros.h" | |
f22341db | 83 | #endif // VC_COMMON_TRIGONOMETRIC_H |