hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java
author iignatyev
Wed, 22 Jun 2016 00:29:32 +0300
changeset 39438 206a712f8f16
parent 34155 8d9e0cbf93a2
child 40059 c2304140ed64
permissions -rw-r--r--
8132920: use package in compiler testlibraries Reviewed-by: kvn, psandoz
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
     1
/*
30589
4722e25bfd6d 8078593: [TESTBUG] ppc: Enable jtreg tests for new features
goetz
parents: 26437
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
     4
 *
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
     8
 *
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    13
 * accompanied this code).
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    14
 *
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    18
 *
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    21
 * questions.
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    22
 */
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    23
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 26437
diff changeset
    24
import jdk.test.lib.Platform;
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    25
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    26
import java.io.FileOutputStream;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    27
import java.lang.reflect.Executable;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    28
import java.util.Properties;
39438
206a712f8f16 8132920: use package in compiler testlibraries
iignatyev
parents: 34155
diff changeset
    29
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 31962
diff changeset
    30
import compiler.whitebox.CompilerWhiteBoxTest;
39438
206a712f8f16 8132920: use package in compiler testlibraries
iignatyev
parents: 34155
diff changeset
    31
import compiler.testlibrary.intrinsics.Verifier;
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    32
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    33
public abstract class IntrinsicBase extends CompilerWhiteBoxTest {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    34
    protected String javaVmName;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    35
    protected String useMathExactIntrinsics;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    36
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    37
    protected IntrinsicBase(TestCase testCase) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    38
        super(testCase);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    39
        javaVmName = System.getProperty("java.vm.name");
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    40
        useMathExactIntrinsics = getVMOption("UseMathExactIntrinsics");
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    41
    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    42
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    43
    @Override
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    44
    protected void test() throws Exception {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    45
        //java.lang.Math should be loaded to allow a compilation of the methods that use Math's method
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    46
        System.out.println("class java.lang.Math should be loaded. Proof: " + Math.class);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    47
        printEnvironmentInfo();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    48
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    49
        int expectedIntrinsicCount = 0;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    50
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    51
        switch (MODE) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    52
            case "compiled mode":
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    53
            case "mixed mode":
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    54
                if (isServerVM()) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    55
                    if (TIERED_COMPILATION) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    56
                        int max_level = TIERED_STOP_AT_LEVEL;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    57
                        expectedIntrinsicCount = (max_level == COMP_LEVEL_MAX) ? 1 : 0;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    58
                        for (int i = CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE; i <= max_level; ++i) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    59
                            deoptimize();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    60
                            compileAtLevel(i);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    61
                        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    62
                    } else {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    63
                        expectedIntrinsicCount = 1;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    64
                        deoptimize();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    65
                        compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    66
                    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    67
                } else {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    68
                    deoptimize();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    69
                    compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    70
                }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    71
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
    72
                if (!isIntrinsicAvailable()) {
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    73
                    expectedIntrinsicCount = 0;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    74
                }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    75
                break;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    76
            case "interpreted mode": //test is not applicable in this mode;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    77
                System.err.println("Warning: This test is not applicable in mode: " + MODE);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    78
                break;
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    79
            default:
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    80
                throw new RuntimeException("Test bug, unknown VM mode: " + MODE);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    81
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    82
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    83
        System.out.println("Expected intrinsic count is " + expectedIntrinsicCount + " name " + getIntrinsicId());
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    84
26437
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents: 22214
diff changeset
    85
        final FileOutputStream out = new FileOutputStream(getVMOption("LogFile") + Verifier.PROPERTY_FILE_SUFFIX);
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    86
        Properties expectedProps = new Properties();
26437
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents: 22214
diff changeset
    87
        expectedProps.setProperty(Verifier.INTRINSIC_NAME_PROPERTY, getIntrinsicId());
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents: 22214
diff changeset
    88
        expectedProps.setProperty(Verifier.INTRINSIC_EXPECTED_COUNT_PROPERTY, String.valueOf(expectedIntrinsicCount));
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    89
        expectedProps.store(out, null);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    90
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    91
        out.close();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    92
    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    93
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    94
    protected void printEnvironmentInfo() {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    95
        System.out.println("java.vm.name=" + javaVmName);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    96
        System.out.println("os.arch=" + Platform.getOsArch());
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    97
        System.out.println("java.vm.info=" + MODE);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    98
        System.out.println("useMathExactIntrinsics=" + useMathExactIntrinsics);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
    99
    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   100
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   101
    protected void compileAtLevel(int level) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   102
        WHITE_BOX.enqueueMethodForCompilation(method, level);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   103
        waitBackgroundCompilation();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   104
        checkCompilation(method, level);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   105
    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   106
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   107
    protected void checkCompilation(Executable executable, int level) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   108
        if (!WHITE_BOX.isMethodCompiled(executable)) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   109
            throw new RuntimeException("Test bug, expected compilation (level): " + level + ", but not compiled");
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   110
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   111
        final int compilationLevel = WHITE_BOX.getMethodCompilationLevel(executable);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   112
        if (compilationLevel != level) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   113
            if (!(TIERED_COMPILATION && level == COMP_LEVEL_FULL_PROFILE && compilationLevel == COMP_LEVEL_LIMITED_PROFILE)) { //possible case
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   114
                throw new RuntimeException("Test bug, expected compilation (level): " + level + ", but level: " + compilationLevel);
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   115
            }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   116
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   117
    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   118
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   119
    // An intrinsic is available if:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   120
    // - the intrinsic is enabled (by using the appropriate command-line flag) and
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   121
    // - the intrinsic is supported by the VM (i.e., the platform on which the VM is
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   122
    //   running provides the instructions necessary for the VM to generate the intrinsic).
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   123
    protected abstract boolean isIntrinsicAvailable();
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   124
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   125
    protected abstract String getIntrinsicId();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   126
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   127
    protected boolean isServerVM() {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   128
        return javaVmName.toLowerCase().contains("server");
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   129
    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   130
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   131
    static class IntTest extends IntrinsicBase {
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   132
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   133
        protected boolean isIntrinsicAvailable; // The tested intrinsic is available on the current platform.
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   134
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   135
        protected IntTest(MathIntrinsic.IntIntrinsic testCase) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   136
            super(testCase);
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   137
            // Only the C2 compiler intrinsifies exact math methods
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   138
            // so check if the intrinsics are available with C2.
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   139
            isIntrinsicAvailable = WHITE_BOX.isIntrinsicAvailable(testCase.getTestMethod(),
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   140
                                                                  COMP_LEVEL_FULL_OPTIMIZATION);
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   141
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   142
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   143
        @Override
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   144
        protected boolean isIntrinsicAvailable() {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   145
            return isIntrinsicAvailable;
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   146
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   147
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   148
        @Override
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   149
        protected String getIntrinsicId() {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   150
            return "_" + testCase.name().toLowerCase() + "ExactI";
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   151
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   152
    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   153
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   154
    static class LongTest extends IntrinsicBase {
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   155
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   156
        protected boolean isIntrinsicAvailable; // The tested intrinsic is available on the current platform.
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   157
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   158
        protected LongTest(MathIntrinsic.LongIntrinsic testCase) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   159
            super(testCase);
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   160
            // Only the C2 compiler intrinsifies exact math methods
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   161
            // so check if the intrinsics are available with C2.
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   162
            isIntrinsicAvailable = WHITE_BOX.isIntrinsicAvailable(testCase.getTestMethod(),
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   163
                                                                  COMP_LEVEL_FULL_OPTIMIZATION);
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   164
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   165
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   166
        @Override
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   167
        protected boolean isIntrinsicAvailable() {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 30761
diff changeset
   168
            return isIntrinsicAvailable;
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   169
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   170
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   171
        @Override
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   172
        protected String getIntrinsicId() {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   173
            return "_" + testCase.name().toLowerCase() + "ExactL";
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   174
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   175
    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff changeset
   176
}