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

Side by Side Diff: runtime/lib/simd128.cc

Issue 22947006: Add signMask getter to Float32x4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | runtime/lib/typed_data.dart » ('j') | runtime/vm/flow_graph_optimizer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/native_entry.h" 8 #include "vm/native_entry.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 224
225 DEFINE_NATIVE_ENTRY(Float32x4_getW, 1) { 225 DEFINE_NATIVE_ENTRY(Float32x4_getW, 1) {
226 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); 226 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
227 double value = static_cast<double>(self.w()); 227 double value = static_cast<double>(self.w());
228 return Double::New(value); 228 return Double::New(value);
229 } 229 }
230 230
231 231
232 DEFINE_NATIVE_ENTRY(Float32x4_getSignMask, 1) {
233 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
234 uint32_t mx = (bit_cast<uint32_t>(self.x()) & 0x80000000) >> 31;
235 uint32_t my = (bit_cast<uint32_t>(self.y()) & 0x80000000) >> 31;
236 uint32_t mz = (bit_cast<uint32_t>(self.z()) & 0x80000000) >> 31;
237 uint32_t mw = (bit_cast<uint32_t>(self.w()) & 0x80000000) >> 31;
238 uint32_t value = mx | (my << 1) | (mz << 2) | (mw << 3);
239 return Integer::New(value);
240 }
241
242
232 DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) { 243 DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) {
233 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); 244 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
234 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1)); 245 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1));
235 int64_t m = mask.AsInt64Value(); 246 int64_t m = mask.AsInt64Value();
236 float data[4] = { self.x(), self.y(), self.z(), self.w() }; 247 float data[4] = { self.x(), self.y(), self.z(), self.w() };
237 float _x = data[m & 0x3]; 248 float _x = data[m & 0x3];
238 float _y = data[(m >> 2) & 0x3]; 249 float _y = data[(m >> 2) & 0x3];
239 float _z = data[(m >> 4) & 0x3]; 250 float _z = data[(m >> 4) & 0x3];
240 float _w = data[(m >> 6) & 0x3]; 251 float _w = data[(m >> 6) & 0x3];
241 return Float32x4::New(_x, _y, _z, _w); 252 return Float32x4::New(_x, _y, _z, _w);
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 } 663 }
653 664
654 665
655 DEFINE_NATIVE_ENTRY(Uint32x4_toFloat32x4, 1) { 666 DEFINE_NATIVE_ENTRY(Uint32x4_toFloat32x4, 1) {
656 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, v, arguments->NativeArgAt(0)); 667 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, v, arguments->NativeArgAt(0));
657 return Float32x4::New(v.value()); 668 return Float32x4::New(v.value());
658 } 669 }
659 670
660 671
661 } // namespace dart 672 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/typed_data.dart » ('j') | runtime/vm/flow_graph_optimizer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698