aboutsummaryrefslogtreecommitdiffstats
path: root/core/fpu_ctrl.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-12-31 16:47:12 -0800
committerChris Robinson <[email protected]>2020-12-31 16:47:12 -0800
commit20ef8bf390541339f068676f9d14061fe2f5e115 (patch)
tree6cca7aa12e11a6b5918fa3748391cb336d8d00bb /core/fpu_ctrl.h
parent002c5062964a598f8cdf53e6b3ed4836629c5048 (diff)
Move cpu_caps and fpu_ctrl to core
Diffstat (limited to 'core/fpu_ctrl.h')
-rw-r--r--core/fpu_ctrl.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/core/fpu_ctrl.h b/core/fpu_ctrl.h
new file mode 100644
index 00000000..20bd2772
--- /dev/null
+++ b/core/fpu_ctrl.h
@@ -0,0 +1,25 @@
+#ifndef CORE_FPU_CTRL_H
+#define CORE_FPU_CTRL_H
+
+class FPUCtl {
+#if defined(HAVE_SSE_INTRINSICS) || (defined(__GNUC__) && defined(HAVE_SSE))
+ unsigned int sse_state{};
+#endif
+ bool in_mode{};
+
+public:
+ FPUCtl();
+ /* HACK: 32-bit targets for GCC seem to have a problem here with certain
+ * noexcept methods (which destructors are) causing an internal compiler
+ * error. No idea why it's these methods specifically, but this is needed
+ * to get it to compile.
+ */
+ ~FPUCtl() noexcept(false) { leave(); }
+
+ FPUCtl(const FPUCtl&) = delete;
+ FPUCtl& operator=(const FPUCtl&) = delete;
+
+ void leave();
+};
+
+#endif /* CORE_FPU_CTRL_H */