Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: runtime/platform/globals.h

Issue 12871015: SIMD plumbing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: s/materialize/Materialize Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/byte_array.cc ('k') | runtime/vm/code_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/globals.h
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index f06f04c75c40a3f347c74ac67f1e56933b633625..2d566bbb62f88c1984674c3a325696ffce02b5c7 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -72,6 +72,45 @@
#error Automatic target os detection failed.
#endif
+struct simd128_value_t {
+ float storage[4];
+ simd128_value_t& readFrom(const float* v) {
+ storage[0] = v[0];
+ storage[1] = v[1];
+ storage[2] = v[2];
+ storage[3] = v[3];
+ return *this;
+ }
+ simd128_value_t& readFrom(const uint32_t* v) {
+ const float* vv = reinterpret_cast<const float*>(v);
+ storage[0] = vv[0];
+ storage[1] = vv[1];
+ storage[2] = vv[2];
+ storage[3] = vv[3];
+ return *this;
+ }
+ simd128_value_t& readFrom(const simd128_value_t* v) {
+ *this = *v;
+ return *this;
+ }
+ void writeTo(float* v) {
+ v[0] = storage[0];
+ v[1] = storage[1];
+ v[2] = storage[2];
+ v[3] = storage[3];
+ }
+ void writeTo(uint32_t* v) {
+ float* vv = reinterpret_cast<float*>(v);
+ vv[0] = storage[0];
+ vv[1] = storage[1];
+ vv[2] = storage[2];
+ vv[3] = storage[3];
+ }
+ void writeTo(simd128_value_t* v) {
+ *v = *this;
+ }
+};
+
// Processor architecture detection. For more info on what's defined, see:
// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
// http://www.agner.org/optimize/calling_conventions.pdf
@@ -79,47 +118,23 @@
#if defined(_M_X64) || defined(__x86_64__)
#define HOST_ARCH_X64 1
#define ARCH_IS_64_BIT 1
-#include <xmmintrin.h> // NOLINT
#define kFpuRegisterSize 16
-typedef __m128 fpu_register_t;
-typedef __m128 simd_value_t;
-// Unaligned load.
-#define simd_value_safe_load(addr) \
- _mm_loadu_ps(reinterpret_cast<const float*>(addr))
-// Unaligned store.
-#define simd_value_safe_store(addr, value) \
- _mm_storeu_ps(reinterpret_cast<float*>(addr), value)
+typedef simd128_value_t fpu_register_t;
#elif defined(_M_IX86) || defined(__i386__)
#define HOST_ARCH_IA32 1
#define ARCH_IS_32_BIT 1
-#include <xmmintrin.h> // NOLINT
#define kFpuRegisterSize 16
-typedef __m128 fpu_register_t;
-typedef __m128 simd_value_t;
-// Unaligned load.
-#define simd_value_safe_load(addr) \
- _mm_loadu_ps(reinterpret_cast<const float*>(addr))
-// Unaligned store.
-#define simd_value_safe_store(addr, value) \
- _mm_storeu_ps(reinterpret_cast<float*>(addr), value)
+typedef simd128_value_t fpu_register_t;
#elif defined(__ARMEL__)
#define HOST_ARCH_ARM 1
#define ARCH_IS_32_BIT 1
#define kFpuRegisterSize 8
typedef double fpu_register_t;
-// TODO(johnmccutchan): ARM simd type.
-typedef struct {
- uint32_t data_[4];
-} simd_value_t;
#elif defined(__MIPSEL__)
#define HOST_ARCH_MIPS 1
#define ARCH_IS_32_BIT 1
#define kFpuRegisterSize 8
typedef double fpu_register_t;
-// TODO(johnmccutchan): MIPS simd type.
-typedef struct {
- uint32_t data_[4];
-} simd_value_t;
#else
#error Architecture was not detected as supported by Dart.
#endif
@@ -215,7 +230,7 @@ typedef uintptr_t uword;
const int kWordSize = sizeof(word);
const int kDoubleSize = sizeof(double); // NOLINT
const int kFloatSize = sizeof(float); // NOLINT
-const int kSimd128Size = 16;
+const int kSimd128Size = sizeof(simd128_value_t); // NOLINT
#ifdef ARCH_IS_32_BIT
const int kWordSizeLog2 = 2;
const uword kUwordMax = kMaxUint32;
« no previous file with comments | « runtime/lib/byte_array.cc ('k') | runtime/vm/code_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698