diff options
author | lloyd <[email protected]> | 2009-10-26 17:37:44 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-10-26 17:37:44 +0000 |
commit | 49896908c8a7893586271e353c431bb91b5215a8 (patch) | |
tree | ead9a7549b339dd2fd884bf039d1b88d0c3c9393 /src/utils/simd_32/simd_32.h | |
parent | 3b2eef9bd141e70b7dfe90fe8cc57d6561733fbc (diff) |
Add a wrapper for a set of SSE2 operations with convenient syntax for 4x32
operations.
Also add a pure scalar code version.
Convert Serpent to use this new interface, and add an implementation of
XTEA in SIMD.
The wrappers plus the scalar version allow SIMD-ish code to work on all
platforms. This is often a win due to better ILP being visible to the
processor (as with the recent XTEA optimizations). Only real danger is
register starvation, mostly an issue on x86 these days. So it may (or may
not) be a win to consolidate the standard C++ versions and the SIMD versions
together.
Future work:
- Add AltiVec/VMX version
- Maybe also for ARM's NEON extension? Less pressing, I would think.
- Convert SHA-1 code to use SIMD_32
- Add XTEA SIMD decryption (currently only encrypt)
- Change SSE2 engine to SIMD_engine
- Modify configure.py to set BOTAN_TARGET_CPU_HAS_[SSE2|ALTIVEC|NEON|XXX] macros
Diffstat (limited to 'src/utils/simd_32/simd_32.h')
-rw-r--r-- | src/utils/simd_32/simd_32.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/utils/simd_32/simd_32.h b/src/utils/simd_32/simd_32.h new file mode 100644 index 000000000..d9fac0d3d --- /dev/null +++ b/src/utils/simd_32/simd_32.h @@ -0,0 +1,29 @@ +/** +* Lightweight wrappers for SIMD operations +*/ + +#ifndef BOTAN_SIMD_32_H__ +#define BOTAN_SIMD_32_H__ + +#include <botan/types.h> + +//#define BOTAN_TARGET_CPU_HAS_SSE2 + +#if defined(BOTAN_TARGET_CPU_HAS_SSE2) + + #include <botan/simd_sse.h> + namespace Botan { typedef SIMD_SSE2 SIMD_32; } + +#elif defined(BOTAN_TARGET_CPU_HAS_ALTIVEC) + + #include <botan/simd_altivec.h> + namespace Botan { typedef SIMD_Altivec SIMD_32; } + +#else + + #include <botan/simd_scalar.h> + namespace Botan { typedef SIMD_Scalar SIMD_32; } + +#endif + +#endif |