author | chegar |
Tue, 22 Mar 2016 15:26:07 +0000 | |
changeset 36694 | 182a5e7a519e |
parent 26916 | 8a1deee4f9b4 |
child 40059 | c2304140ed64 |
permissions | -rw-r--r-- |
22513
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
1 |
/* |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
4 |
* |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
8 |
* |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
13 |
* accompanied this code). |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
14 |
* |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
18 |
* |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
21 |
* questions. |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
22 |
*/ |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
23 |
|
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
24 |
/* |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
25 |
* @test |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
26 |
* @bug 8031743 |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
27 |
* @summary loadI2L_immI broken for negative memory values |
26916
8a1deee4f9b4
8038098: [TESTBUG] remove explicit set build flavor from hotspot/test/compiler/* tests
vlivanov
parents:
22513
diff
changeset
|
28 |
* @run main/othervm -Xbatch -XX:CompileCommand=compileonly,*.foo* LoadWithMask2 |
22513
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
29 |
* |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
30 |
*/ |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
31 |
public class LoadWithMask2 { |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
32 |
static int x; |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
33 |
static long foo1() { |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
34 |
return x & 0xfffffffe; |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
35 |
} |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
36 |
static long foo2() { |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
37 |
return x & 0xff000000; |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
38 |
} |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
39 |
static long foo3() { |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
40 |
return x & 0x8abcdef1; |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
41 |
} |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
42 |
|
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
43 |
public static void main(String[] args) { |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
44 |
x = -1; |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
45 |
long l = 0; |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
46 |
for (int i = 0; i < 100000; ++i) { |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
47 |
l = foo1() & foo2() & foo3(); |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
48 |
} |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
49 |
if (l > 0) { |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
50 |
System.out.println("FAILED"); |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
51 |
System.exit(97); |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
52 |
} |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
53 |
System.out.println("PASSED"); |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
54 |
} |
dc47bc8ecb75
8031743: C2: loadI2L_immI broken for negative memory values
iveresov
parents:
diff
changeset
|
55 |
} |