Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/compiler/6814842/Test6814842.java
32285 views
/*1* Copyright (c) 2009, 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 681484226* @summary Load shortening optimizations27*28* @run main/othervm -Xcomp -XX:CompileOnly=Test6814842.loadS2B,Test6814842.loadS2Bmask255,Test6814842.loadUS2B,Test6814842.loadUS2Bmask255,Test6814842.loadI2B,Test6814842.loadI2Bmask255,Test6814842.loadI2S,Test6814842.loadI2Smask255,Test6814842.loadI2Smask65535,Test6814842.loadI2US,Test6814842.loadI2USmask255,Test6814842.loadI2USmask65535 Test681484229*/3031public class Test6814842 {32static final short[] sa = new short[] { (short) 0xF1F2 };33static final char[] ca = new char[] { (char) 0xF3F4 };34static final int[] ia = new int[] { 0xF1F2F3F4 };3536public static void main(String[] args)37{38byte s2b = loadS2B(sa);39if (s2b != (byte) 0xF2)40throw new InternalError("loadS2B failed: " + s2b + " != " + (byte) 0xF2);4142byte s2bmask255 = loadS2Bmask255(sa);43if (s2bmask255 != (byte) 0xF2)44throw new InternalError("loadS2Bmask255 failed: " + s2bmask255 + " != " + (byte) 0xF2);4546byte us2b = loadUS2B(ca);47if (us2b != (byte) 0xF4)48throw new InternalError("loadUS2B failed: " + us2b + " != " + (byte) 0xF4);4950byte us2bmask255 = loadUS2Bmask255(ca);51if (us2bmask255 != (byte) 0xF4)52throw new InternalError("loadUS2Bmask255 failed: " + us2bmask255 + " != " + (byte) 0xF4);5354byte i2b = loadI2B(ia);55if (i2b != (byte) 0xF4)56throw new InternalError("loadI2B failed: " + i2b + " != " + (byte) 0xF4);5758byte i2bmask255 = loadI2Bmask255(ia);59if (i2bmask255 != (byte) 0xF4)60throw new InternalError("loadI2Bmask255 failed: " + i2bmask255 + " != " + (byte) 0xF4);6162short i2s = loadI2S(ia);63if (i2s != (short) 0xF3F4)64throw new InternalError("loadI2S failed: " + i2s + " != " + (short) 0xF3F4);6566short i2smask255 = loadI2Smask255(ia);67if (i2smask255 != (short) 0xF4)68throw new InternalError("loadI2Smask255 failed: " + i2smask255 + " != " + (short) 0xF4);6970short i2smask65535 = loadI2Smask65535(ia);71if (i2smask65535 != (short) 0xF3F4)72throw new InternalError("loadI2Smask65535 failed: " + i2smask65535 + " != " + (short) 0xF3F4);7374char i2us = loadI2US(ia);75if (i2us != (char) 0xF3F4)76throw new InternalError("loadI2US failed: " + (int) i2us + " != " + (char) 0xF3F4);7778char i2usmask255 = loadI2USmask255(ia);79if (i2usmask255 != (char) 0xF4)80throw new InternalError("loadI2USmask255 failed: " + (int) i2usmask255 + " != " + (char) 0xF4);8182char i2usmask65535 = loadI2USmask65535(ia);83if (i2usmask65535 != (char) 0xF3F4)84throw new InternalError("loadI2USmask65535 failed: " + (int) i2usmask65535 + " != " + (char) 0xF3F4);85}8687static byte loadS2B (short[] sa) { return (byte) (sa[0] ); }88static byte loadS2Bmask255 (short[] sa) { return (byte) (sa[0] & 0xFF ); }8990static byte loadUS2B (char[] ca) { return (byte) (ca[0] ); }91static byte loadUS2Bmask255 (char[] ca) { return (byte) (ca[0] & 0xFF ); }9293static byte loadI2B (int[] ia) { return (byte) (ia[0] ); }94static byte loadI2Bmask255 (int[] ia) { return (byte) (ia[0] & 0xFF ); }9596static short loadI2S (int[] ia) { return (short) (ia[0] ); }97static short loadI2Smask255 (int[] ia) { return (short) (ia[0] & 0xFF ); }98static short loadI2Smask65535 (int[] ia) { return (short) (ia[0] & 0xFFFF); }99100static char loadI2US (int[] ia) { return (char) (ia[0] ); }101static char loadI2USmask255 (int[] ia) { return (char) (ia[0] & 0xFF ); }102static char loadI2USmask65535(int[] ia) { return (char) (ia[0] & 0xFFFF); }103}104105106