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

Side by Side Diff: tests/language/vm/regress_29137_vm_test.dart

Issue 2793003002: VM: Fix incorrect canonicalization rule for `UnboxedIntConverterInstr`. (Closed)
Patch Set: Address comments Created 3 years, 8 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
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2017, 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 //
5 // Check that optimizer correctly handles (x << y) & MASK_32 pattern on 32-bit
6 // platforms: given the pattern
7 //
8 // v1 <- UnboxedIntConverter([tr] mint->uint32, v0)
9 // v2 <- UnboxedIntConverter(uint32->mint, v1)
10 //
11 // optimizer must *not* replace v2 with v0 because the first convertion is
12 // truncating and is erasing the high part of the mint value.
13 //
14 // VMOptions=--optimization-counter-threshold=5 --no-background-compilation
15
16 import "package:expect/expect.dart";
17
18 const _MASK_32 = 0xffffffff;
19 int _rotl32(int val, int shift) {
20 final mod_shift = shift & 31;
21 return ((val << mod_shift) & _MASK_32) |
22 ((val & _MASK_32) >> (32 - mod_shift));
23 }
24
25 rot8(v) => _rotl32(v, 8);
26
27 main() {
28 // Note: value is selected in such a way that (value << 8) is not a smi - this
29 // triggers emittion of BinaryMintOp instructions for shifts.
30 const value = 0xF0F00000;
31 const rotated = 0xF00000F0;
32 Expect.equals(rotated, rot8(value));
33 for (var i = 0; i < 10; i++) {
34 Expect.equals(rotated, rot8(value));
35 }
36 }
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698