Path: blob/master/test/hotspot/jtreg/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java
41149 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 without TZCNT instruction (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.TestUseCountTrailingZerosInstructionOnUnsupportedCPU38*/3940package compiler.arguments;4142import jdk.test.lib.cli.CommandLineOptionTest;4344public class TestUseCountTrailingZerosInstructionOnUnsupportedCPU45extends BMIUnsupportedCPUTest {46private static final String ENABLE_BMI = "-XX:+UseBMI1Instructions";4748public TestUseCountTrailingZerosInstructionOnUnsupportedCPU() {49super("UseCountTrailingZerosInstruction", TZCNT_WARNING, "bmi1");50}5152@Override53public void unsupportedX86CPUTestCases() throws Throwable {5455super.unsupportedX86CPUTestCases();5657/*58Verify that option will not be turned on during UseBMI1Instructions59processing. VM will be launched with following options:60-XX:+UseBMI1Instructions -version61*/62CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",63"Feature bmi1 is not supported on current CPU. Option "64+ "UseCountTrailingZerosInstruction should have 'false'"65+ " value",66TestUseCountTrailingZerosInstructionOnUnsupportedCPU.67ENABLE_BMI);6869/*70VM will be launched with following options:71-XX:+UseCountTrailingZerosInstruction -XX:+UseBMI1Instructions72-version73*/74CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",75"Feature bmi1 is not supported on current CPU. Option "76+ "UseCountTrailingZerosInstruction should have 'false'"77+ " value",78CommandLineOptionTest.prepareBooleanFlag(optionName, true),79TestUseCountTrailingZerosInstructionOnUnsupportedCPU.80ENABLE_BMI);81}8283public static void main(String args[]) throws Throwable {84new TestUseCountTrailingZerosInstructionOnUnsupportedCPU().test();85}86}87888990