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

Unified Diff: tests/language/bit_operations_test.dart

Issue 11085004: Faster 64-bit left-shift for ia32. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments. Created 8 years, 2 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 | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/bit_operations_test.dart
===================================================================
--- tests/language/bit_operations_test.dart (revision 13352)
+++ tests/language/bit_operations_test.dart (working copy)
@@ -57,6 +57,10 @@
for (int i = 0; i < 10000; i++) {
TestCornerCasesRightShifts();
TestRightShift64Bit();
+ TestLeftShift64Bit();
+ TestLeftShift64BitWithOverflow1();
+ TestLeftShift64BitWithOverflow2();
+ TestLeftShift64BitWithOverflow3();
}
}
@@ -76,6 +80,31 @@
Expect.equals(0xffffffff, t >> 1);
}
+ static void TestLeftShift64Bit() {
+ var t = 0xffffffff;
+ Expect.equals(0xffffffff, t << 0);
+ Expect.equals(0x1fffffffe, t << 1);
+ Expect.equals(0x7fffffff80000000, t << 31);
+ Expect.equals(0x10000000000000000, 2*(t+1) << 31);
+ Expect.equals(0x20000000000000000, 4*(t+1) << 31);
+ Expect.equals(0x8000000000000000, (t+1) << 31);
+ }
+
+ static void TestLeftShift64BitWithOverflow1() {
+ var t = 0xffffffff;
+ Expect.equals(0x10000000000000000, 2*(t+1) << 31);
+ }
+
+ static void TestLeftShift64BitWithOverflow2() {
+ var t = 0xffffffff;
+ Expect.equals(0x20000000000000000, 4*(t+1) << 31);
+ }
+
+ static void TestLeftShift64BitWithOverflow3() {
+ var t = 0xffffffff;
+ Expect.equals(0x8000000000000000, (t+1) << 31);
+ }
+
static void TestNegativeCountShifts() {
bool throwOnLeft(a, b) {
try {
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698