|
@@ -60,7 +60,7 @@ private:
|
|
|
unsigned int mPrevState;
|
|
|
};
|
|
|
|
|
|
-#elif defined(JPH_CPU_ARM)
|
|
|
+#elif defined(JPH_CPU_ARM) && defined(JPH_USE_NEON)
|
|
|
|
|
|
/// Helper class that needs to be put on the stack to update the state of the floating point control word.
|
|
|
/// This state is kept per thread.
|
|
@@ -91,6 +91,37 @@ private:
|
|
|
uint64 mPrevState;
|
|
|
};
|
|
|
|
|
|
+#elif defined(JPH_CPU_ARM)
|
|
|
+
|
|
|
+/// Helper class that needs to be put on the stack to update the state of the floating point control word.
|
|
|
+/// This state is kept per thread.
|
|
|
+template <uint32 Value, uint32 Mask>
|
|
|
+class FPControlWord : public NonCopyable
|
|
|
+{
|
|
|
+public:
|
|
|
+ FPControlWord()
|
|
|
+ {
|
|
|
+ uint32 val;
|
|
|
+ asm volatile("vmrs %0, fpscr" : "=r" (val));
|
|
|
+ mPrevState = val;
|
|
|
+ val &= ~Mask;
|
|
|
+ val |= Value;
|
|
|
+ asm volatile("vmsr fpscr, %0" : /* no output */ : "r" (val));
|
|
|
+ }
|
|
|
+
|
|
|
+ ~FPControlWord()
|
|
|
+ {
|
|
|
+ uint32 val;
|
|
|
+ asm volatile("vmrs %0, fpscr" : "=r" (val));
|
|
|
+ val &= ~Mask;
|
|
|
+ val |= mPrevState & Mask;
|
|
|
+ asm volatile("vmsr fpscr, %0" : /* no output */ : "r" (val));
|
|
|
+ }
|
|
|
+
|
|
|
+private:
|
|
|
+ uint32 mPrevState;
|
|
|
+};
|
|
|
+
|
|
|
#elif defined(JPH_CPU_WASM)
|
|
|
|
|
|
// Not supported
|