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

Unified Diff: tests/language/bit_operations_test.dart

Issue 2974953002: Revise assertions and fix bug in the implementation of shifts (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: tests/language/bit_operations_test.dart
diff --git a/tests/language/bit_operations_test.dart b/tests/language/bit_operations_test.dart
index 0d3eece04bde8d098e2989f61d4870713d0eebb3..3c2dc93415f60c02912fa6598b6ef405016904c0 100644
--- a/tests/language/bit_operations_test.dart
+++ b/tests/language/bit_operations_test.dart
@@ -2,10 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Dart test for testing bitwise operations.
-// VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation --enable-inlining-annotations
import "package:expect/expect.dart";
+const neverInline = "NeverInline";
+
void main() {
for (int i = 0; i < 4; i++) {
test();
@@ -70,6 +72,9 @@ void test() {
testPrecedence(4, 5, 3, 1);
testPrecedence(3, 4, 5, 9);
testPrecedence(0x5c71, 0x6b92, 0x7654, 0x7d28);
+
+ // Test more special cases.
+ testRightShift65();
}
void testCornerCasesRightShifts() {
@@ -198,3 +203,16 @@ void testPrecedence(int a, int b, int c, int d) {
Expect.equals((a & (b << c)) ^ d, a & b << c ^ d);
Expect.notEquals((a & b) << (c ^ d), a & b << c ^ d);
}
+
+@neverInline
+rightShift65Noinline(a) => a >> 65;
+
+testRightShift65() {
+ var a = 0x5f22334455667788;
+ var b = -0x5f22334455667788;
+
+ for (var i = 0; i < 20; ++i) {
+ Expect.equals(0, rightShift65Noinline(a));
+ Expect.equals(-1, rightShift65Noinline(b));
+ }
+}
« runtime/vm/intermediate_language_x64.cc ('K') | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698