1
/* This file is part of the Vc library.
3
Copyright (C) 2011-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_SSE_DEBUG_H
21
#define VC_SSE_DEBUG_H
38
DebugStream(const char *, const char *, int) {}
39
template<typename T> inline DebugStream &operator<<(const T &) { return *this; }
45
template<typename T, typename V> static void printVector(V _x)
47
enum { Size = sizeof(V) / sizeof(T) };
48
union { V v; T m[Size]; } x = { _x };
49
std::cerr << '[' << std::setprecision(24) << x.m[0];
50
for (int i = 1; i < Size; ++i) {
51
std::cerr << ", " << std::setprecision(24) << x.m[i];
56
DebugStream(const char *func, const char *file, int line)
58
std::cerr << "\033[1;40;33mDEBUG: " << file << ':' << line << ' ' << func << ' ';
61
template<typename T> DebugStream &operator<<(const T &x) { std::cerr << x; return *this; }
63
DebugStream &operator<<(__m128 x) {
64
printVector<float, __m128>(x);
67
DebugStream &operator<<(__m128d x) {
68
printVector<double, __m128d>(x);
71
DebugStream &operator<<(__m128i x) {
72
printVector<unsigned int, __m128i>(x);
78
std::cerr << "\033[0m" << std::endl;
83
#define VC_DEBUG ::Vc::SSE::DebugStream(__PRETTY_FUNCTION__, __FILE__, __LINE__)
88
#endif // VC_SSE_DEBUG_H