ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
supportfunctions.cpp
Go to the documentation of this file.
1 /*{{{
2  Copyright (C) 2013 Matthias Kretz <kretz@kde.org>
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 }}}*/
18 
19 #include "unittest.h"
20 
22 {
24 }
25 
27 {
28  using Vc::CpuId;
35  COMPARE(Vc::isImplementationSupported(Vc::AVXImpl ), CpuId::hasOsxsave() && CpuId::hasAvx());
37 }
38 
40 {
41  // when building with a recent and fully featured compiler the following should pass
42  // but - old GCC versions have to fall back to Scalar, even though SSE is supported by the CPU
43  // - ICC/MSVC can't use XOP/FMA4
44  //COMPARE(Vc::bestImplementationSupported(), VC_IMPL);
45 }
46 
48 {
49  using Vc::CpuId;
50  unsigned int extra = Vc::extraInstructionsSupported();
51  COMPARE(!(extra & Vc::Float16cInstructions), !CpuId::hasF16c());
52  COMPARE(!(extra & Vc::XopInstructions), !CpuId::hasXop());
53  COMPARE(!(extra & Vc::Fma4Instructions), !CpuId::hasFma4());
54  COMPARE(!(extra & Vc::PopcntInstructions), !CpuId::hasPopcnt());
55  COMPARE(!(extra & Vc::Sse4aInstructions), !CpuId::hasSse4a());
56 }
57 
58 int main(int argc, char **argv)
59 {
60  initTest(argc, argv);
61 
66 
67  return 0;
68 }
Support for XOP instructions.
Definition: global.h:413
x86 SSE + SSE2 + SSE3 + SSSE3 + SSE4.1 + SSE4.2
Definition: global.h:389
void initTest(int argc, char **argv)
Definition: unittest.h:169
int main(int argc, char **argv)
void testExtraInstructions()
x86 SSE + SSE2
Definition: global.h:381
Support for FMA4 instructions.
Definition: global.h:411
void testCompiledImplementation()
#define COMPARE(a, b)
Definition: unittest.h:509
VC_TARGET_NO_SIMD bool isImplementationSupported(Vc::Implementation impl)
Tests whether the given implementation is supported by the system the code is executing on...
Definition: support.cpp:55
x86 SSE + SSE2 + SSE3 + SSSE3 + SSE4.1
Definition: global.h:387
Support for float16 conversions in hardware.
Definition: global.h:409
x86 SSE + SSE2 + SSE3
Definition: global.h:383
void testBestImplementation()
#define VERIFY(cond)
Definition: unittest.h:515
void testIsSupported()
Support for SSE4a instructions.
Definition: global.h:417
VC_TARGET_NO_SIMD unsigned int extraInstructionsSupported()
Determines the extra instructions supported by the current CPU.
Definition: support.cpp:99
x86 AVX
Definition: global.h:391
This class is available for x86 / AMD64 systems to read and interpret information about the CPU's cap...
Definition: cpuid.h:42
x86 SSE + SSE2 + SSE3 + SSSE3
Definition: global.h:385
x86 AVX + AVX2
Definition: global.h:393
Support for the population count instruction.
Definition: global.h:415
static VC_TARGET_NO_SIMD bool currentImplementationSupported()
Tests that the CPU and Operating System support the vector unit which was compiled for...
Definition: support.h:138
#define runTest(name)
Definition: unittest.h:42