Mercurial > hg > truffle
annotate test/compiler/intrinsics/bmi/TestBlsmskL.java @ 19069:0499dbe2da01
factored out common code
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 02 Feb 2015 21:40:08 +0100 |
parents | a48e16541e6b |
children |
rev | line source |
---|---|
17778
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
1 /* |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
4 * |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
8 * |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
13 * accompanied this code). |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
14 * |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
18 * |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
21 * questions. |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
22 * |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
23 */ |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
24 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
25 /** |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
26 * @test |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
27 * @bug 8031321 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
28 * @summary Verify that results of computations are the same w/ |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
29 * and w/o usage of BLSMSK instruction |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
30 * @library /testlibrary /testlibrary/whitebox |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
31 * @build TestBlsmskL BMITestRunner Expr |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
32 * @run main ClassFileInstaller sun.hotspot.WhiteBox |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
33 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
34 * -XX:+WhiteBoxAPI TestBlsmskL |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
35 */ |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
36 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
37 import sun.hotspot.cpuinfo.CPUInfo; |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
38 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
39 public class TestBlsmskL { |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
40 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
41 public static void main(String args[]) throws Throwable { |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
42 if (!CPUInfo.hasFeature("bmi1")) { |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
43 System.out.println("CPU does not support bmi1 feature. " + |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
44 "Test skipped."); |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
45 return; |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
46 } |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
47 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
48 BMITestRunner.runTests(BlsmskLExpr.class, args, |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
49 "-XX:+UseBMI1Instructions"); |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
50 BMITestRunner.runTests(BlsmskLCommutativeExpr.class, args, |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
51 "-XX:+UseBMI1Instructions"); |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
52 } |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
53 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
54 public static class BlsmskLExpr |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
55 extends Expr.BMIUnaryLongExpr { |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
56 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
57 public long longExpr(long src) { |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
58 return (src - 1) ^ src; |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
59 } |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
60 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
61 public long longExpr(Expr.MemL src) { |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
62 return (src.value - 1) ^ src.value; |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
63 } |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
64 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
65 } |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
66 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
67 public static class BlsmskLCommutativeExpr |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
68 extends Expr.BMIUnaryLongExpr { |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
69 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
70 public long longExpr(long src) { |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
71 return src ^ (src - 1); |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
72 } |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
73 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
74 public long longExpr(Expr.MemL src) { |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
75 return src.value ^ (src.value - 1); |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
76 } |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
77 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
78 } |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
79 |
a48e16541e6b
8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff
changeset
|
80 } |