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

Side by Side Diff: runtime/platform/globals.h

Issue 148043003: Add Float64x2, Float64x2List, etc... with runtime and dart2js implementations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef PLATFORM_GLOBALS_H_ 5 #ifndef PLATFORM_GLOBALS_H_
6 #define PLATFORM_GLOBALS_H_ 6 #define PLATFORM_GLOBALS_H_
7 7
8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to
9 // enable platform independent printf format specifiers. 9 // enable platform independent printf format specifiers.
10 #ifndef __STDC_FORMAT_MACROS 10 #ifndef __STDC_FORMAT_MACROS
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #elif defined(_WIN32) 69 #elif defined(_WIN32)
70 #define TARGET_OS_WINDOWS 1 70 #define TARGET_OS_WINDOWS 1
71 #else 71 #else
72 #error Automatic target os detection failed. 72 #error Automatic target os detection failed.
73 #endif 73 #endif
74 74
75 struct simd128_value_t { 75 struct simd128_value_t {
76 union { 76 union {
77 float float_storage[4]; 77 float float_storage[4];
78 int32_t int_storage[4]; 78 int32_t int_storage[4];
79 double double_storage[2];
79 }; 80 };
80 simd128_value_t& readFrom(const float* v) { 81 simd128_value_t& readFrom(const float* v) {
81 float_storage[0] = v[0]; 82 float_storage[0] = v[0];
82 float_storage[1] = v[1]; 83 float_storage[1] = v[1];
83 float_storage[2] = v[2]; 84 float_storage[2] = v[2];
84 float_storage[3] = v[3]; 85 float_storage[3] = v[3];
85 return *this; 86 return *this;
86 } 87 }
87 simd128_value_t& readFrom(const int32_t* v) { 88 simd128_value_t& readFrom(const int32_t* v) {
88 int_storage[0] = v[0]; 89 int_storage[0] = v[0];
89 int_storage[1] = v[1]; 90 int_storage[1] = v[1];
90 int_storage[2] = v[2]; 91 int_storage[2] = v[2];
91 int_storage[3] = v[3]; 92 int_storage[3] = v[3];
92 return *this; 93 return *this;
93 } 94 }
95 simd128_value_t& readFrom(const double* v) {
96 double_storage[0] = v[0];
97 double_storage[1] = v[1];
98 return *this;
99 }
94 simd128_value_t& readFrom(const simd128_value_t* v) { 100 simd128_value_t& readFrom(const simd128_value_t* v) {
95 *this = *v; 101 *this = *v;
96 return *this; 102 return *this;
97 } 103 }
98 void writeTo(float* v) { 104 void writeTo(float* v) {
99 v[0] = float_storage[0]; 105 v[0] = float_storage[0];
100 v[1] = float_storage[1]; 106 v[1] = float_storage[1];
101 v[2] = float_storage[2]; 107 v[2] = float_storage[2];
102 v[3] = float_storage[3]; 108 v[3] = float_storage[3];
103 } 109 }
104 void writeTo(int32_t* v) { 110 void writeTo(int32_t* v) {
105 v[0] = int_storage[0]; 111 v[0] = int_storage[0];
106 v[1] = int_storage[1]; 112 v[1] = int_storage[1];
107 v[2] = int_storage[2]; 113 v[2] = int_storage[2];
108 v[3] = int_storage[3]; 114 v[3] = int_storage[3];
109 } 115 }
116 void writeTo(double* v) {
117 v[0] = double_storage[0];
118 v[1] = double_storage[1];
119 }
110 void writeTo(simd128_value_t* v) { 120 void writeTo(simd128_value_t* v) {
111 *v = *this; 121 *v = *this;
112 } 122 }
113 }; 123 };
114 124
115 // Processor architecture detection. For more info on what's defined, see: 125 // Processor architecture detection. For more info on what's defined, see:
116 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx 126 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
117 // http://www.agner.org/optimize/calling_conventions.pdf 127 // http://www.agner.org/optimize/calling_conventions.pdf
118 // or with gcc, run: "echo | gcc -E -dM -" 128 // or with gcc, run: "echo | gcc -E -dM -"
119 #if defined(_M_X64) || defined(__x86_64__) 129 #if defined(_M_X64) || defined(__x86_64__)
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods 500 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods
491 // have an implicit 'this' argument, the arguments of such methods 501 // have an implicit 'this' argument, the arguments of such methods
492 // should be counted from two, not one." 502 // should be counted from two, not one."
493 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ 503 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \
494 __attribute__((__format__(__printf__, string_index, first_to_check))) 504 __attribute__((__format__(__printf__, string_index, first_to_check)))
495 #else 505 #else
496 #define PRINTF_ATTRIBUTE(string_index, first_to_check) 506 #define PRINTF_ATTRIBUTE(string_index, first_to_check)
497 #endif 507 #endif
498 508
499 #endif // PLATFORM_GLOBALS_H_ 509 #endif // PLATFORM_GLOBALS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698