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

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') | no next file with comments »
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
243 DEFINE_NATIVE_ENTRY(Uint32x4_getSignMask, 1) {
244 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, self, arguments->NativeArgAt(0));
245 uint32_t mx = (self.x() & 0x80000000) >> 31;
246 uint32_t my = (self.y() & 0x80000000) >> 31;
247 uint32_t mz = (self.z() & 0x80000000) >> 31;
248 uint32_t mw = (self.w() & 0x80000000) >> 31;
249 uint32_t value = mx | (my << 1) | (mz << 2) | (mw << 3);
250 return Integer::New(value);
251 }
252
253
232 DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) { 254 DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) {
233 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); 255 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
234 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1)); 256 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1));
235 int64_t m = mask.AsInt64Value(); 257 int64_t m = mask.AsInt64Value();
236 if (m < 0 || m > 255) { 258 if (m < 0 || m > 255) {
237 const String& error = String::Handle( 259 const String& error = String::Handle(
238 String::NewFormatted("mask (%" Pd64 ") must be in the range [0..256)", 260 String::NewFormatted("mask (%" Pd64 ") must be in the range [0..256)",
239 m)); 261 m));
240 const Array& args = Array::Handle(Array::New(1)); 262 const Array& args = Array::Handle(Array::New(1));
241 args.SetAt(0, error); 263 args.SetAt(0, error);
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } 704 }
683 705
684 706
685 DEFINE_NATIVE_ENTRY(Uint32x4_toFloat32x4, 1) { 707 DEFINE_NATIVE_ENTRY(Uint32x4_toFloat32x4, 1) {
686 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, v, arguments->NativeArgAt(0)); 708 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, v, arguments->NativeArgAt(0));
687 return Float32x4::New(v.value()); 709 return Float32x4::New(v.value());
688 } 710 }
689 711
690 712
691 } // namespace dart 713 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/typed_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698