Path: blob/master/test/hotspot/jtreg/compiler/codegen/TestMultiMemInstructionMatching.java
41149 views
/*1* Copyright (c) 2020, 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 824090526* @summary Test matching of instructions that have multiple memory inputs.27* @run main/othervm -Xbatch -XX:-TieredCompilation28* compiler.codegen.TestMultiMemInstructionMatching29*/3031package compiler.codegen;3233public class TestMultiMemInstructionMatching {3435static volatile int iFldV = 42;36static volatile long lFldV = 42;37static int iFld = 42;38static long lFld = 42;3940// Integer versions4142static int test_blsiI_rReg_mem_1() {43return (0 - iFldV) & iFldV;44}4546static int test_blsiI_rReg_mem_2() {47int sub = (0 - iFld);48iFldV++;49return sub & iFld;50}5152static int test_blsrI_rReg_mem_1() {53return (iFldV - 1) & iFldV;54}5556static int test_blsrI_rReg_mem_2() {57int sub = (iFld - 1);58iFldV++;59return sub & iFld;60}6162static int test_blsmskI_rReg_mem_1() {63return (iFldV - 1) ^ iFldV;64}6566static int test_blsmskI_rReg_mem_2() {67int sub = (iFld - 1);68iFldV++;69return sub ^ iFld;70}7172// Long versions7374static long test_blsiL_rReg_mem_1() {75return (0 - lFldV) & lFldV;76}7778static long test_blsiL_rReg_mem_2() {79long sub = (0 - lFld);80lFldV++;81return sub & lFld;82}8384static long test_blsrL_rReg_mem_1() {85return (lFldV - 1) & lFldV;86}8788static long test_blsrL_rReg_mem_2() {89long sub = (lFld - 1);90lFldV++;91return sub & lFld;92}9394static long test_blsmskL_rReg_mem_1() {95return (lFldV - 1) ^ lFldV;96}9798static long test_blsmskL_rReg_mem_2() {99long sub = (lFld - 1);100lFldV++;101return sub ^ lFld;102}103104public static void main(String[] args) {105for (int i = 0;i < 100_000;++i) {106test_blsiI_rReg_mem_1();107test_blsiI_rReg_mem_2();108test_blsrI_rReg_mem_1();109test_blsrI_rReg_mem_2();110test_blsmskI_rReg_mem_1();111test_blsmskI_rReg_mem_2();112113test_blsiL_rReg_mem_1();114test_blsiL_rReg_mem_2();115test_blsrL_rReg_mem_1();116test_blsrL_rReg_mem_2();117test_blsmskL_rReg_mem_1();118test_blsmskL_rReg_mem_2();119}120}121}122123124