author | bsrbnd |
Wed, 13 Nov 2019 11:21:15 +0100 | |
changeset 59051 | f0312c7d5b37 |
permissions | -rw-r--r-- |
59051
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
1 |
/* |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
2 |
* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
4 |
* |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
8 |
* |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
13 |
* accompanied this code). |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
14 |
* |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
18 |
* |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
21 |
* questions. |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
22 |
*/ |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
23 |
|
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
24 |
/* |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
25 |
* @test |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
26 |
* @bug 8214239 |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
27 |
* @summary Missing x86_64.ad patterns for clearing and setting long vector bits |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
28 |
* |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
29 |
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
30 |
* -XX:-TieredCompilation -XX:CompileThreshold=1000 |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
31 |
* -XX:CompileCommand=print,compiler/c2/TestBitSetAndReset.test* |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
32 |
* -XX:CompileCommand=compileonly,compiler/c2/TestBitSetAndReset.test* |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
33 |
* -XX:CompileCommand=dontinline,compiler/c2/TestBitSetAndReset.test* |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
34 |
* compiler.c2.TestBitSetAndReset |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
35 |
*/ |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
36 |
|
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
37 |
package compiler.c2; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
38 |
|
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
39 |
public class TestBitSetAndReset { |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
40 |
private static final int COUNT = 10_000; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
41 |
|
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
42 |
private static final long MASK63 = 0x8000_0000_0000_0000L; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
43 |
private static final long MASK32 = 0x0000_0001_0000_0000L; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
44 |
private static final long MASK31 = 0x0000_0000_8000_0000L; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
45 |
private static final long MASK15 = 0x0000_0000_0000_8000L; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
46 |
private static final long MASK00 = 0x0000_0000_0000_0001L; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
47 |
|
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
48 |
private static long andq, orq; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
49 |
|
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
50 |
public static void main(String... args) { |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
51 |
boolean success = true; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
52 |
|
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
53 |
for (int i=0; i<COUNT; i++) { |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
54 |
andq = MASK63 | MASK31 | MASK15 | MASK00; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
55 |
orq = 0; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
56 |
test63(); |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
57 |
test32(); |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
58 |
test31(); |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
59 |
test15(); |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
60 |
test00(); |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
61 |
success &= andq == 0 && orq == (MASK63 | MASK32 | MASK31 | MASK15 | MASK00); |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
62 |
} |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
63 |
if (!success) |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
64 |
throw new AssertionError("Failure while setting or clearing long vector bits!"); |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
65 |
} |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
66 |
|
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
67 |
private static void test63() { |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
68 |
andq &= ~MASK63; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
69 |
orq |= MASK63; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
70 |
} |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
71 |
private static void test32() { |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
72 |
andq &= ~MASK32; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
73 |
orq |= MASK32; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
74 |
} |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
75 |
private static void test31() { |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
76 |
andq &= ~MASK31; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
77 |
orq |= MASK31; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
78 |
} |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
79 |
private static void test15() { |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
80 |
andq &= ~MASK15; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
81 |
orq |= MASK15; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
82 |
} |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
83 |
private static void test00() { |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
84 |
andq &= ~MASK00; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
85 |
orq |= MASK00; |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
86 |
} |
f0312c7d5b37
8214239: Missing x86_64.ad patterns for clearing and setting long vector bits
bsrbnd
parents:
diff
changeset
|
87 |
} |