hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java
author hseigel
Wed, 01 Mar 2017 08:00:02 -0500
changeset 46194 5596e6f63072
parent 41705 332239c052cc
permissions -rw-r--r--
8172307: Remove ununsed JVM API JVM_GetModuleByPackageName() Summary: Remove get_module_by_package_name() etc., and unneeded test. Reviewed-by: sspitsyn, gtriantafill
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
     1
/*
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
     2
 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
23493
170c77c1103a 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.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
     4
 *
170c77c1103a 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
170c77c1103a 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
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
     8
 *
170c77c1103a 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
170c77c1103a 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
170c77c1103a 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
170c77c1103a 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
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    13
 * accompanied this code).
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    14
 *
170c77c1103a 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
170c77c1103a 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,
170c77c1103a 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.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    18
 *
170c77c1103a 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
170c77c1103a 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
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    21
 * questions.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    22
 */
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    23
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    24
/**
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    25
 * @test
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    26
 * @bug 8031321
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    27
 * @summary Verify that results of computations are the same w/
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    28
 *          and w/o usage of BLSI instruction
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    29
 * @library /test/lib /
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 33730
diff changeset
    30
 * @modules java.base/jdk.internal.misc
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28190
diff changeset
    31
 *          java.management
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    32
 *
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    33
 * @build sun.hotspot.WhiteBox
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    34
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    35
 *                                sun.hotspot.WhiteBox$WhiteBoxPermission
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    36
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    37
 *                   -XX:+WhiteBoxAPI
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    38
 *                   compiler.intrinsics.bmi.TestBlsiI
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    39
 */
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    40
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    41
package compiler.intrinsics.bmi;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    42
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    43
import sun.hotspot.cpuinfo.CPUInfo;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    44
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    45
public class TestBlsiI {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    46
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    47
    public static void main(String args[]) throws Throwable {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    48
        if (!CPUInfo.hasFeature("bmi1")) {
27425
8689c0c3824a 8043674: Update compiler/intrinsic/bmi tests to run it on all platforms
fzhinkin
parents: 25958
diff changeset
    49
            System.out.println("INFO: CPU does not support bmi1 feature.");
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    50
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    51
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    52
        BMITestRunner.runTests(BlsiIExpr.class, args,
27425
8689c0c3824a 8043674: Update compiler/intrinsic/bmi tests to run it on all platforms
fzhinkin
parents: 25958
diff changeset
    53
                               "-XX:+IgnoreUnrecognizedVMOptions",
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    54
                               "-XX:+UseBMI1Instructions");
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    55
        BMITestRunner.runTests(BlsiICommutativeExpr.class, args,
27425
8689c0c3824a 8043674: Update compiler/intrinsic/bmi tests to run it on all platforms
fzhinkin
parents: 25958
diff changeset
    56
                               "-XX:+IgnoreUnrecognizedVMOptions",
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    57
                               "-XX:+UseBMI1Instructions");
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    58
    }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    59
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    60
    public static class BlsiIExpr extends Expr.BMIUnaryIntExpr {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    61
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    62
        public int intExpr(int src) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    63
            return -src & src;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    64
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    65
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    66
        public int intExpr(Expr.MemI src) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    67
            return -src.value & src.value;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    68
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    69
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    70
    }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    71
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    72
    public static class BlsiICommutativeExpr extends Expr.BMIUnaryIntExpr {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    73
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    74
        public int intExpr(int src) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    75
            return src & -src;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    76
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    77
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    78
        public int intExpr(Expr.MemI src) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    79
            return src.value & -src.value;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    80
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    81
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    82
    }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    83
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    84
}