Path: blob/master/test/hotspot/jtreg/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java
41152 views
/*1* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 803132126* @summary Verify processing of UseCountTrailingZerosInstruction option27* on CPU with TZCNT (BMI1 feature) support.28* @library /test/lib /29* @requires vm.flagless30* @modules java.base/jdk.internal.misc31* java.management32*33* @build sun.hotspot.WhiteBox34* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox35* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions36* -XX:+WhiteBoxAPI37* compiler.arguments.TestUseCountTrailingZerosInstructionOnSupportedCPU38*/3940package compiler.arguments;4142import jdk.test.lib.cli.CommandLineOptionTest;4344public class TestUseCountTrailingZerosInstructionOnSupportedCPU45extends BMISupportedCPUTest {46private static final String DISABLE_BMI = "-XX:-UseBMI1Instructions";4748public TestUseCountTrailingZerosInstructionOnSupportedCPU() {49super("UseCountTrailingZerosInstruction", TZCNT_WARNING, "bmi1");50}5152@Override53public void runTestCases() throws Throwable {5455super.runTestCases();5657/*58Verify that option will be disabled if all BMI1 instructions59are explicitly disabled. VM will be launched with following options:60-XX:-UseBMI1Instructions -version61*/62CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",63"Option 'UseCountTrailingZerosInstruction' should have "64+ "'false' value if all BMI1 instructions are explicitly"65+ " disabled (-XX:-UseBMI1Instructions flag used)",66TestUseCountTrailingZerosInstructionOnSupportedCPU.DISABLE_BMI);6768/*69Verify that option could be turned on even if other BMI170instructions were turned off. VM will be launched with following71options: -XX:-UseBMI1Instructions72-XX:+UseCountTrailingZerosInstruction -version73*/74CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",75"Option 'UseCountTrailingZerosInstruction' should be able to "76+ "be turned on even if all BMI1 instructions are "77+ "disabled (-XX:-UseBMI1Instructions flag used)",78TestUseCountTrailingZerosInstructionOnSupportedCPU.DISABLE_BMI,79CommandLineOptionTest.prepareBooleanFlag(optionName, true));80}8182public static void main(String args[]) throws Throwable {83new TestUseCountTrailingZerosInstructionOnSupportedCPU().test();84}85}86878889