Mercurial > hg > truffle
annotate test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java @ 21326:8cef2c3f389b
LinearScan: encapsulate blockData.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 12 May 2015 11:55:11 +0200 |
parents | 4d8781a35525 |
children |
rev | line source |
---|---|
20428
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
1 /* |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
4 * |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
8 * |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
13 * accompanied this code). |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
14 * |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
18 * |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
21 * questions. |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
22 */ |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
23 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
24 package sha.predicate; |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
25 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
26 import com.oracle.java.testlibrary.Platform; |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
27 import com.oracle.java.testlibrary.cli.predicate.AndPredicate; |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
28 import com.oracle.java.testlibrary.cli.predicate.CPUSpecificPredicate; |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
29 import com.oracle.java.testlibrary.cli.predicate.OrPredicate; |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
30 import sun.hotspot.WhiteBox; |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
31 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
32 import java.util.function.BooleanSupplier; |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
33 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
34 /** |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
35 * Helper class aimed to provide predicates on availability of SHA-related |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
36 * CPU instructions and intrinsics. |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
37 */ |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
38 public class IntrinsicPredicates { |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
39 private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
40 private static final long TIERED_MAX_LEVEL = 4L; |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
41 /** |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
42 * Boolean supplier that check if any method could be compiled by C2. |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
43 * Method potentially could be compiled by C2 if Server VM is used and |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
44 * either tiered compilation is disabled or TIERED_MAX_LEVEL tier is |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
45 * reachable. |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
46 * |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
47 * Please don't place this definition after SHA*_INTRINSICS_AVAILABLE |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
48 * definitions. Otherwise its value will be {@code null} at the time when |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
49 * all dependent fields will be initialized. |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
50 */ |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
51 private static final BooleanSupplier COMPILABLE_BY_C2 = () -> { |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
52 boolean isTiered = IntrinsicPredicates.WHITE_BOX.getBooleanVMFlag( |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
53 "TieredCompilation"); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
54 long tieredMaxLevel = IntrinsicPredicates.WHITE_BOX.getIntxVMFlag( |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
55 "TieredStopAtLevel"); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
56 boolean maxLevelIsReachable = (tieredMaxLevel |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
57 == IntrinsicPredicates.TIERED_MAX_LEVEL); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
58 return Platform.isServer() && (!isTiered || maxLevelIsReachable); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
59 }; |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
60 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
61 public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
62 = new CPUSpecificPredicate("sparc.*", new String[] { "sha1" }, |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
63 null); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
64 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
65 public static final BooleanSupplier SHA256_INSTRUCTION_AVAILABLE |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
66 = new CPUSpecificPredicate("sparc.*", new String[] { "sha256" }, |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
67 null); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
68 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
69 public static final BooleanSupplier SHA512_INSTRUCTION_AVAILABLE |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
70 = new CPUSpecificPredicate("sparc.*", new String[] { "sha512" }, |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
71 null); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
72 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
73 public static final BooleanSupplier ANY_SHA_INSTRUCTION_AVAILABLE |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
74 = new OrPredicate(IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE, |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
75 new OrPredicate( |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
76 IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE, |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
77 IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE)); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
78 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
79 public static final BooleanSupplier SHA1_INTRINSICS_AVAILABLE |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
80 = new AndPredicate(new AndPredicate( |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
81 IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE, |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
82 IntrinsicPredicates.COMPILABLE_BY_C2), |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
83 IntrinsicPredicates.booleanOptionValue("UseSHA1Intrinsics")); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
84 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
85 public static final BooleanSupplier SHA256_INTRINSICS_AVAILABLE |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
86 = new AndPredicate(new AndPredicate( |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
87 IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE, |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
88 IntrinsicPredicates.COMPILABLE_BY_C2), |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
89 IntrinsicPredicates.booleanOptionValue("UseSHA256Intrinsics")); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
90 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
91 public static final BooleanSupplier SHA512_INTRINSICS_AVAILABLE |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
92 = new AndPredicate(new AndPredicate( |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
93 IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE, |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
94 IntrinsicPredicates.COMPILABLE_BY_C2), |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
95 IntrinsicPredicates.booleanOptionValue("UseSHA512Intrinsics")); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
96 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
97 private static BooleanSupplier booleanOptionValue(String option) { |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
98 return () -> IntrinsicPredicates.WHITE_BOX.getBooleanVMFlag(option); |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
99 } |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
100 |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
101 private IntrinsicPredicates() { |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
102 } |
4d8781a35525
8055903: Develop sanity tests on SPARC's SHA instructions support
fzhinkin
parents:
diff
changeset
|
103 } |