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

Side by Side Diff: tests/standalone/unboxed_int_converter_test.dart

Issue 504143003: Support Int32 representation for selected binary operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4 // Test UnboxedIntConverter for int32.
5
6 import "package:expect/expect.dart";
7 import "dart:typed_data";
8
9 int32_to_mint(a, b) {
10 var sum = 0;
11 var j = 0;
12 for (var i = a; i <= b; i++) {
Florian Schneider 2014/08/27 09:36:51 This test does not seem to cover all int32 operati
Vyacheslav Egorov (Google) 2014/08/27 11:45:37 both `sum` and `j` are int32 phis here. I will a
13 sum -= (j * ++j) & 0xff;
14 }
15
16 return 0xffffffff + sum;
17 }
18
19 mint_to_int32(a, c, d) {
20 return a * a * a * (c - d);
21 }
22
23 uint32_to_int32(a, c) {
24 return (a * a * a) * (c & 0xFFFFFFFF);
25
26 }
27
28 main() {
29 for (var j = 0; j < 10000; j++) {
30 Expect.equals(4294839503, int32_to_mint(0, 1000));
31 Expect.equals(-8, mint_to_int32(2, 0x100000000, 0x100000001));
32 Expect.equals(8, uint32_to_int32(2, 0x100000001));
33 }
34 Expect.equals(8 * 0x80000001, uint32_to_int32(2, 0x180000001));
35 }
OLDNEW
« runtime/vm/intermediate_language_ia32.cc ('K') | « tests/standalone/standalone.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698