Ardour  9.0-pre0-582-g084a23a80d
fpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2015 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #pragma once
21 
22 #include "pbd/libpbd_visibility.h"
23 
24 namespace PBD {
25 
26 class LIBPBD_API FPU {
27  private:
28  enum Flags {
29  HasFlushToZero = 0x1,
30  HasDenormalsAreZero = 0x2,
31  HasSSE = 0x4,
32  HasSSE2 = 0x8,
33  HasAVX = 0x10,
34  HasNEON = 0x20,
35  HasFMA = 0x40,
36  HasAVX512F = 0x80,
37  };
38 
39  public:
40  ~FPU ();
41 
42  static FPU* instance();
43  static void destroy();
44 
45  bool has_flush_to_zero () const { return _flags & HasFlushToZero; }
46  bool has_denormals_are_zero () const { return _flags & HasDenormalsAreZero; }
47  bool has_sse () const { return _flags & HasSSE; }
48  bool has_sse2 () const { return _flags & HasSSE2; }
49  bool has_avx () const { return _flags & HasAVX; }
50  bool has_avx512f () const { return _flags & HasAVX512F; }
51  bool has_fma() const { return _flags & HasFMA; }
52  bool has_neon () const { return _flags & HasNEON; }
53 
54  private:
56 
57  static FPU* _instance;
58 
59  FPU ();
60 };
61 
62 }
63 
Definition: fpu.h:26
Flags _flags
Definition: fpu.h:55
static void destroy()
bool has_sse() const
Definition: fpu.h:47
bool has_avx() const
Definition: fpu.h:49
static FPU * instance()
bool has_fma() const
Definition: fpu.h:51
bool has_avx512f() const
Definition: fpu.h:50
bool has_sse2() const
Definition: fpu.h:48
bool has_denormals_are_zero() const
Definition: fpu.h:46
Flags
Definition: fpu.h:28
bool has_flush_to_zero() const
Definition: fpu.h:45
bool has_neon() const
Definition: fpu.h:52
static FPU * _instance
Definition: fpu.h:57
#define LIBPBD_API
Definition: axis_view.h:42