aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/simd_32/simd_altivec.h3
-rw-r--r--src/utils/simd_32/simd_scalar.h2
-rw-r--r--src/utils/simd_32/simd_sse.h5
3 files changed, 9 insertions, 1 deletions
diff --git a/src/utils/simd_32/simd_altivec.h b/src/utils/simd_32/simd_altivec.h
index e63b9bdcc..c3d1a76dc 100644
--- a/src/utils/simd_32/simd_altivec.h
+++ b/src/utils/simd_32/simd_altivec.h
@@ -9,6 +9,8 @@
#define BOTAN_SIMD_ALTIVEC_H__
#include <botan/loadstor.h>
+#include <botan/cpuid.h>
+
#include <altivec.h>
#undef vector
@@ -17,6 +19,7 @@ namespace Botan {
class SIMD_Altivec
{
public:
+ bool enabled() const { return CPUID::has_altivec(); }
SIMD_Altivec(const u32bit B[4])
{
diff --git a/src/utils/simd_32/simd_scalar.h b/src/utils/simd_32/simd_scalar.h
index 38f69c294..606923289 100644
--- a/src/utils/simd_32/simd_scalar.h
+++ b/src/utils/simd_32/simd_scalar.h
@@ -15,6 +15,8 @@ namespace Botan {
class SIMD_Scalar
{
public:
+ bool enabled() const { return true; }
+
SIMD_Scalar(const u32bit B[4])
{
R0 = B[0];
diff --git a/src/utils/simd_32/simd_sse.h b/src/utils/simd_32/simd_sse.h
index 267852554..fcfe6f203 100644
--- a/src/utils/simd_32/simd_sse.h
+++ b/src/utils/simd_32/simd_sse.h
@@ -8,7 +8,8 @@
#ifndef BOTAN_SIMD_SSE_H__
#define BOTAN_SIMD_SSE_H__
-#include <botan/types.h>
+#include <botan/cpuid.h>
+
#include <emmintrin.h>
namespace Botan {
@@ -16,6 +17,8 @@ namespace Botan {
class SIMD_SSE2
{
public:
+ bool enabled() const { return CPUID::has_sse2(); }
+
SIMD_SSE2(const u32bit B[4])
{
reg = _mm_loadu_si128((const __m128i*)B);