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

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

Issue 19564014: Add all 256 shuffle methods to Float32x4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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/lib/typed_data.dart » ('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_getXXXX, 1) { 232 DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) {
233 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); 233 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
234 float value = self.x(); 234 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1));
235 return Float32x4::New(value, value, value, value); 235 int64_t m = mask.AsInt64Value();
236 float data[4] = { self.x(), self.y(), self.z(), self.w() };
237 float _x = data[m & 0x3];
238 float _y = data[(m >> 2) & 0x3];
239 float _z = data[(m >> 4) & 0x3];
240 float _w = data[(m >> 6) & 0x3];
241 return Float32x4::New(_x, _y, _z, _w);
236 } 242 }
237 243
238 244
239 DEFINE_NATIVE_ENTRY(Float32x4_getYYYY, 1) {
240 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
241 float value = self.y();
242 return Float32x4::New(value, value, value, value);
243 }
244
245
246 DEFINE_NATIVE_ENTRY(Float32x4_getZZZZ, 1) {
247 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
248 float value = self.z();
249 return Float32x4::New(value, value, value, value);
250 }
251
252
253 DEFINE_NATIVE_ENTRY(Float32x4_getWWWW, 1) {
254 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
255 float value = self.w();
256 return Float32x4::New(value, value, value, value);
257 }
258
259
260 DEFINE_NATIVE_ENTRY(Float32x4_setX, 2) { 245 DEFINE_NATIVE_ENTRY(Float32x4_setX, 2) {
261 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); 246 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
262 GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(1)); 247 GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(1));
263 float _x = static_cast<float>(x.value()); 248 float _x = static_cast<float>(x.value());
264 float _y = self.y(); 249 float _y = self.y();
265 float _z = self.z(); 250 float _z = self.z();
266 float _w = self.w(); 251 float _w = self.w();
267 return Float32x4::New(_x, _y, _z, _w); 252 return Float32x4::New(_x, _y, _z, _w);
268 } 253 }
269 254
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 } 597 }
613 598
614 599
615 DEFINE_NATIVE_ENTRY(Uint32x4_toFloat32x4, 1) { 600 DEFINE_NATIVE_ENTRY(Uint32x4_toFloat32x4, 1) {
616 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, v, arguments->NativeArgAt(0)); 601 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, v, arguments->NativeArgAt(0));
617 return Float32x4::New(v.value()); 602 return Float32x4::New(v.value());
618 } 603 }
619 604
620 605
621 } // namespace dart 606 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/typed_data.dart » ('j') | runtime/lib/typed_data.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698