hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java
author chegar
Tue, 22 Mar 2016 15:26:07 +0000
changeset 36694 182a5e7a519e
parent 30604 b8d532cb6420
child 40059 c2304140ed64
permissions -rw-r--r--
Merge
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
/*
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 27453
diff changeset
     2
 * Copyright (c) 2014, 2015, 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
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 27453
diff changeset
    25
import jdk.test.lib.Asserts;
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 27453
diff changeset
    26
import jdk.test.lib.OutputAnalyzer;
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 27453
diff changeset
    27
import jdk.test.lib.ProcessTools;
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 27453
diff changeset
    28
import jdk.test.lib.Utils;
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    29
import java.io.IOException;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    30
import java.nio.file.Files;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    31
import java.nio.file.Paths;
27453
9aeb9b97bef6 8044186: Introduce a reproducible random generator
iignatyev
parents: 23493
diff changeset
    32
import java.util.Collections;
9aeb9b97bef6 8044186: Introduce a reproducible random generator
iignatyev
parents: 23493
diff changeset
    33
import java.util.LinkedList;
9aeb9b97bef6 8044186: Introduce a reproducible random generator
iignatyev
parents: 23493
diff changeset
    34
import java.util.List;
9aeb9b97bef6 8044186: Introduce a reproducible random generator
iignatyev
parents: 23493
diff changeset
    35
import java.util.Random;
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    36
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    37
/**
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    38
 * Test runner that invokes all methods implemented by particular Expr
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    39
 * with random arguments in two different JVM processes and compares output.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    40
 * JVMs being started in different modes - one in int and other in comp
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    41
 * with C2 and disabled tiered compilation.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    42
 */
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    43
public class BMITestRunner {
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
    enum VMMode {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    46
        COMP, INT;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    47
    };
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    48
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    49
    public static int DEFAULT_ITERATIONS_COUNT = 4000;
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
     * Execute all methods implemented by <b>expr</b> in int and comp modes
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    53
     * and compare output.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    54
     * Test pass only of output obtained with different VM modes is equal.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    55
     * To control behaviour of test following options could be passed:
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    56
     * <ul>
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    57
     *   <li>-iterations=&lt;N&gt; each operation implemented by
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    58
     *       <b>expr</b> will be executed <i>N</i> times. Default value
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    59
     *       is 4000.</li>
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    60
     *   <li>-seed=&lt;SEED&gt; arguments for <b>expr</b>'s methods
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    61
     *       obtained via RNG initiated with seed <i>SEED</i>. By default
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    62
     *       some random seed will be used.</li>
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    63
     * </ul>
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
     * @param expr operation that should be tested
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    66
     * @param testOpts options to control test behaviour
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    67
     * @param additionalVMOpts additional options for VM
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
     * @throws Throwable if test failed.
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
    public static void runTests(Class<? extends Expr> expr,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    72
                                String testOpts[],
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    73
                                String... additionalVMOpts)
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    74
                         throws Throwable {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    75
27453
9aeb9b97bef6 8044186: Introduce a reproducible random generator
iignatyev
parents: 23493
diff changeset
    76
        int seed = Utils.getRandomInstance().nextInt();
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    77
        int iterations = DEFAULT_ITERATIONS_COUNT;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    78
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    79
        for (String testOption : testOpts) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    80
            if (testOption.startsWith("-iterations=")) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    81
                iterations = Integer.valueOf(testOption.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    82
                                             replace("-iterations=", ""));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    83
            } else if (testOption.startsWith("-seed=")) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    84
                seed = Integer.valueOf(testOption.replace("-seed=", ""));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    85
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    86
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    87
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    88
        OutputAnalyzer intOutput = runTest(expr, VMMode.INT,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    89
                                           additionalVMOpts,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    90
                                           seed, iterations);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    91
        OutputAnalyzer compOutput = runTest(expr, VMMode.COMP,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    92
                                            additionalVMOpts,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    93
                                            seed, iterations);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    94
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    95
        dumpOutput(intOutput, "int");
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    96
        dumpOutput(compOutput, "comp");
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    97
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    98
        Asserts.assertStringsEqual(intOutput.getStdout(),
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
    99
                                   compOutput.getStdout(),
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   100
                                   "Results obtained in -Xint and " +
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   101
                                   "-Xcomp should be the same.");
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   102
    }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   103
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   104
    /**
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   105
     * Execute tests on methods implemented by <b>expr</b> in new VM
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   106
     * started in <b>testVMMode</b> mode.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   107
     *
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   108
     * @param expr operation that should be tested
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   109
     * @param testVMMode VM mode for test
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   110
     * @param additionalVMOpts additional options for VM
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   111
     * @param seed for RNG used it tests
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   112
     * @param iterations that will be used to invoke <b>expr</b>'s methods.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   113
     *
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   114
     * @return OutputAnalyzer for executed test.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   115
     * @throws Throwable when something goes wrong.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   116
     */
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   117
    public static OutputAnalyzer runTest(Class<? extends Expr> expr,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   118
                                         VMMode testVMMode,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   119
                                         String additionalVMOpts[],
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   120
                                         int seed, int iterations)
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   121
                                  throws Throwable {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   122
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   123
        List<String> vmOpts = new LinkedList<String>();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   124
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   125
        Collections.addAll(vmOpts, additionalVMOpts);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   126
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   127
        //setup mode-specific options
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   128
        switch (testVMMode) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   129
        case INT:
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   130
            Collections.addAll(vmOpts, new String[] { "-Xint" });
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   131
            break;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   132
        case COMP:
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   133
            Collections.addAll(vmOpts, new String[] {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   134
                    "-Xcomp",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   135
                    "-XX:-TieredCompilation",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   136
                    String.format("-XX:CompileCommand=compileonly,%s::*",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   137
                                  expr.getName())
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   138
                });
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   139
            break;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   140
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   141
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   142
        Collections.addAll(vmOpts, new String[] {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   143
                "-XX:+DisplayVMOutputToStderr",
27453
9aeb9b97bef6 8044186: Introduce a reproducible random generator
iignatyev
parents: 23493
diff changeset
   144
                "-D" + Utils.SEED_PROPERTY_NAME + "=" + seed,
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   145
                Executor.class.getName(),
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   146
                expr.getName(),
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   147
                new Integer(iterations).toString()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   148
            });
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   149
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   150
        OutputAnalyzer outputAnalyzer = ProcessTools.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   151
            executeTestJvm(vmOpts.toArray(new String[vmOpts.size()]));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   152
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   153
        outputAnalyzer.shouldHaveExitValue(0);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   154
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   155
        return outputAnalyzer;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   156
    }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   157
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   158
    /**
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   159
     * Dump stdout and stderr of test process to <i>prefix</i>.test.out
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   160
     * and <i>prefix</i>.test.err respectively.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   161
     *
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   162
     * @param outputAnalyzer OutputAnalyzer whom output should be dumped
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   163
     * @param prefix Prefix that will be used in file names.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   164
     * @throws IOException if unable to dump output to file.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   165
     */
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   166
    protected static void dumpOutput(OutputAnalyzer outputAnalyzer,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   167
                                     String prefix)
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   168
                              throws IOException {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   169
        Files.write(Paths.get(prefix + ".test.out"),
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   170
                    outputAnalyzer.getStdout().getBytes());
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   171
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   172
        Files.write(Paths.get(prefix + ".test.err"),
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   173
                    outputAnalyzer.getStderr().getBytes());
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   174
    }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   175
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   176
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   177
    /**
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   178
     * Executor that invoke all methods implemented by particular
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   179
     * Expr instance.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   180
     */
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   181
    public static class Executor {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   182
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   183
        /**
27453
9aeb9b97bef6 8044186: Introduce a reproducible random generator
iignatyev
parents: 23493
diff changeset
   184
         * Usage: BMITestRunner$Executor &lt;ExprClassName&gt; &lt;iterations&gt;
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   185
         */
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   186
        public static void main(String args[]) throws Exception {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   187
            @SuppressWarnings("unchecked")
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   188
            Class<? extends Expr> exprClass =
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   189
                (Class<? extends Expr>)Class.forName(args[0]);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   190
            Expr expr = exprClass.getConstructor().newInstance();
27453
9aeb9b97bef6 8044186: Introduce a reproducible random generator
iignatyev
parents: 23493
diff changeset
   191
            int iterations = Integer.valueOf(args[1]);
9aeb9b97bef6 8044186: Introduce a reproducible random generator
iignatyev
parents: 23493
diff changeset
   192
            runTests(expr, iterations, Utils.getRandomInstance());
23493
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   193
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   194
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   195
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   196
        public static int[] getIntBitShifts() {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   197
            //SIZE+1 shift is for zero.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   198
            int data[] = new int[Integer.SIZE+1];
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   199
            for (int s = 0; s < data.length; s++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   200
                data[s] = 1<<s;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   201
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   202
            return data;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   203
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   204
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   205
        public static long[] getLongBitShifts() {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   206
            //SIZE+1 shift is for zero.
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   207
            long data[] = new long[Long.SIZE+1];
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   208
            for (int s = 0; s < data.length; s++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   209
                data[s] = 1L<<s;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   210
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   211
            return data;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   212
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   213
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   214
        public static void log(String format, Object... args) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   215
            System.out.println(String.format(format, args));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   216
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   217
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   218
        public static void runTests(Expr expr, int iterations, Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   219
            runUnaryIntRegTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   220
            runUnaryIntMemTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   221
            runUnaryLongRegTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   222
            runUnaryLongMemTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   223
            runBinaryRegRegIntTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   224
            runBinaryRegMemIntTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   225
            runBinaryMemRegIntTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   226
            runBinaryMemMemIntTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   227
            runBinaryRegRegLongTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   228
            runBinaryRegMemLongTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   229
            runBinaryMemRegLongTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   230
            runBinaryMemMemLongTest(expr, iterations, rng);
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   231
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   232
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   233
        public static void runUnaryIntRegTest(Expr expr, int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   234
                                              Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   235
            if (!(expr.isUnaryArgumentSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   236
                  && expr.isIntExprSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   237
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   238
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   239
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   240
            for (int value : getIntBitShifts()) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   241
                log("UnaryIntReg(0X%x) -> 0X%x",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   242
                    value, expr.intExpr(value));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   243
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   244
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   245
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   246
                int value = rng.nextInt();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   247
                log("UnaryIntReg(0X%x) -> 0X%x",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   248
                    value, expr.intExpr(value));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   249
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   250
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   251
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   252
        public static void runUnaryIntMemTest(Expr expr, int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   253
                                              Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   254
            if (!(expr.isUnaryArgumentSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   255
                  && expr.isIntExprSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   256
                  && expr.isMemExprSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   257
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   258
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   259
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   260
            for (int value : getIntBitShifts()) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   261
                log("UnaryIntMem(0X%x) -> 0X%x",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   262
                    value, expr.intExpr(new Expr.MemI(value)));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   263
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   264
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   265
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   266
                int value = rng.nextInt();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   267
                log("UnaryIntMem(0X%x) -> 0X%x",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   268
                    value, expr.intExpr(new Expr.MemI(value)));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   269
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   270
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   271
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   272
        public static void runUnaryLongRegTest(Expr expr, int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   273
                                               Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   274
            if (!(expr.isUnaryArgumentSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   275
                  && expr.isLongExprSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   276
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   277
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   278
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   279
            for (long value : getLongBitShifts()) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   280
                log("UnaryLongReg(0X%x) -> 0X%x",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   281
                    value, expr.longExpr(value));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   282
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   283
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   284
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   285
                long value = rng.nextLong();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   286
                log("UnaryLongReg(0X%x) -> 0X%x",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   287
                    value, expr.longExpr(value));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   288
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   289
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   290
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   291
        public static void runUnaryLongMemTest(Expr expr, int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   292
                                               Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   293
            if (!(expr.isUnaryArgumentSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   294
                  && expr.isLongExprSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   295
                  && expr.isMemExprSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   296
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   297
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   298
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   299
            for (long value : getLongBitShifts()) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   300
                log("UnaryLongMem(0X%x) -> 0X%x",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   301
                    value, expr.longExpr(new Expr.MemL(value)));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   302
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   303
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   304
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   305
                long value = rng.nextLong();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   306
                log("UnaryLongMem(0X%x) -> 0X%x",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   307
                    value, expr.longExpr(new Expr.MemL(value)));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   308
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   309
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   310
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   311
        public static void runBinaryRegRegIntTest(Expr expr, int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   312
                                                  Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   313
            if (!(expr.isIntExprSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   314
                  && expr.isBinaryArgumentSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   315
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   316
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   317
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   318
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   319
                int aValue = rng.nextInt();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   320
                int bValue = rng.nextInt();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   321
                log("BinaryIntRegReg(0X%x, 0X%x) -> 0X%x",
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   322
                    aValue, bValue, expr.intExpr(aValue, bValue));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   323
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   324
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   325
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   326
        public static void runBinaryRegMemIntTest(Expr expr, int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   327
                                                  Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   328
            if (!(expr.isIntExprSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   329
                  && expr.isBinaryArgumentSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   330
                  && expr.isMemExprSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   331
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   332
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   333
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   334
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   335
                int aValue = rng.nextInt();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   336
                int bValue = rng.nextInt();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   337
                log("BinaryIntRegMem(0X%x, 0X%x) -> 0X%x", aValue, bValue,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   338
                    expr.intExpr(aValue, new Expr.MemI(bValue)));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   339
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   340
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   341
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   342
        public static void runBinaryMemRegIntTest(Expr expr, int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   343
                                                  Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   344
            if (!(expr.isIntExprSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   345
                  && expr.isBinaryArgumentSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   346
                  && expr.isMemExprSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   347
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   348
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   349
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   350
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   351
                int aValue = rng.nextInt();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   352
                int bValue = rng.nextInt();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   353
                log("BinaryIntMemReg(0X%x, 0X%x) -> 0X%x", aValue, bValue,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   354
                    expr.intExpr(new Expr.MemI(aValue), bValue));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   355
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   356
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   357
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   358
        public static void runBinaryMemMemIntTest(Expr expr, int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   359
                                                  Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   360
            if (!(expr.isIntExprSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   361
                  && expr.isBinaryArgumentSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   362
                  && expr.isMemExprSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   363
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   364
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   365
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   366
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   367
                int aValue = rng.nextInt();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   368
                int bValue = rng.nextInt();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   369
                log("BinaryIntMemMem(0X%x, 0X%x) -> 0X%x", aValue, bValue,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   370
                    expr.intExpr(new Expr.MemI(aValue),
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   371
                                 new Expr.MemI(bValue)));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   372
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   373
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   374
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   375
        public static void runBinaryRegRegLongTest(Expr expr,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   376
                                                   int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   377
                                                   Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   378
            if (!(expr.isLongExprSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   379
                  && expr.isBinaryArgumentSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   380
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   381
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   382
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   383
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   384
                long aValue = rng.nextLong();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   385
                long bValue = rng.nextLong();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   386
                log("BinaryLongRegReg(0X%x, 0X%x) -> 0X%x", aValue, bValue,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   387
                    expr.longExpr(aValue, bValue));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   388
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   389
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   390
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   391
        public static void runBinaryRegMemLongTest(Expr expr,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   392
                                                   int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   393
                                                   Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   394
            if (!(expr.isLongExprSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   395
                  && expr.isBinaryArgumentSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   396
                  && expr.isMemExprSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   397
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   398
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   399
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   400
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   401
                long aValue = rng.nextLong();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   402
                long bValue = rng.nextLong();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   403
                log("BinaryLongRegMem(0X%x, 0X%x) -> 0X%x", aValue, bValue,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   404
                    expr.longExpr(aValue, new Expr.MemL(bValue)));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   405
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   406
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   407
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   408
        public static void runBinaryMemRegLongTest(Expr expr,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   409
                                                   int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   410
                                                   Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   411
            if (!(expr.isLongExprSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   412
                  && expr.isBinaryArgumentSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   413
                  && expr.isMemExprSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   414
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   415
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   416
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   417
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   418
                long aValue = rng.nextLong();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   419
                long bValue = rng.nextLong();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   420
                log("BinaryLongMemReg(0X%x, 0X%x) -> 0X%x", aValue, bValue,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   421
                    expr.longExpr(new Expr.MemL(aValue), bValue));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   422
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   423
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   424
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   425
        public static void runBinaryMemMemLongTest(Expr expr,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   426
                                                   int iterations,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   427
                                                   Random rng) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   428
            if (!(expr.isLongExprSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   429
                  && expr.isBinaryArgumentSupported()
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   430
                  && expr.isMemExprSupported())) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   431
                return;
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   432
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   433
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   434
            for (int i = 0; i < iterations; i++) {
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   435
                long aValue = rng.nextLong();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   436
                long bValue = rng.nextLong();
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   437
                log("BinaryLongMemMem(0X%x, 0X%x) -> 0X%x", aValue, bValue,
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   438
                    expr.longExpr(new Expr.MemL(aValue),
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   439
                                  new Expr.MemL(bValue)));
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   440
            }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   441
        }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   442
    }
170c77c1103a 8035857: Add tests to verify correctness of operations with BMI1 and LZCNT instructions
iignatyev
parents:
diff changeset
   443
}