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

Unified Diff: runtime/lib/simd128.cc

Issue 23591069: Fix runtime clamp logic to match optimized code (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | « no previous file | sdk/lib/typed_data/dart2js/typed_data_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/simd128.cc
diff --git a/runtime/lib/simd128.cc b/runtime/lib/simd128.cc
index f1563b8415a0b93505079001d7abc24947987313..8f3cc3ec0610d836570c65dfa9e36ae0377f9e16 100644
--- a/runtime/lib/simd128.cc
+++ b/runtime/lib/simd128.cc
@@ -195,14 +195,16 @@ DEFINE_NATIVE_ENTRY(Float32x4_clamp, 3) {
GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, lo, arguments->NativeArgAt(1));
GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, hi, arguments->NativeArgAt(2));
- float _x = self.x() > lo.x() ? self.x() : lo.x();
- float _y = self.y() > lo.y() ? self.y() : lo.y();
- float _z = self.z() > lo.z() ? self.z() : lo.z();
- float _w = self.w() > lo.w() ? self.w() : lo.w();
- _x = _x > hi.x() ? hi.x() : _x;
- _y = _y > hi.y() ? hi.y() : _y;
- _z = _z > hi.z() ? hi.z() : _z;
- _w = _w > hi.w() ? hi.w() : _w;
+ // The order of the clamping must match the order of the optimized code:
+ // MAX(MIN(self, hi), lo).
+ float _x = self.x() < hi.x() ? self.x() : hi.x();
+ float _y = self.y() < hi.y() ? self.y() : hi.y();
+ float _z = self.z() < hi.z() ? self.z() : hi.z();
+ float _w = self.w() < hi.w() ? self.w() : hi.w();
+ _x = _x < lo.x() ? lo.x() : _x;
+ _y = _y < lo.y() ? lo.y() : _y;
+ _z = _z < lo.z() ? lo.z() : _z;
+ _w = _w < lo.w() ? lo.w() : _w;
return Float32x4::New(_x, _y, _z, _w);
}
« no previous file with comments | « no previous file | sdk/lib/typed_data/dart2js/typed_data_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698