Wed, 09 May 2012 13:07:42 -0700
Added tag jdk8-b37 for changeset bfcf92bfefb8
twisti@1220 | 1 | /* |
trims@1907 | 2 | * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
twisti@1220 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
twisti@1220 | 4 | * |
twisti@1220 | 5 | * This code is free software; you can redistribute it and/or modify it |
twisti@1220 | 6 | * under the terms of the GNU General Public License version 2 only, as |
twisti@1220 | 7 | * published by the Free Software Foundation. |
twisti@1220 | 8 | * |
twisti@1220 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
twisti@1220 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
twisti@1220 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
twisti@1220 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
twisti@1220 | 13 | * accompanied this code). |
twisti@1220 | 14 | * |
twisti@1220 | 15 | * You should have received a copy of the GNU General Public License version |
twisti@1220 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
twisti@1220 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
twisti@1220 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
twisti@1220 | 22 | */ |
twisti@1220 | 23 | |
twisti@1220 | 24 | /** |
twisti@1220 | 25 | * @test |
twisti@1220 | 26 | * @bug 6814842 |
twisti@1220 | 27 | * @summary Load shortening optimizations |
twisti@1220 | 28 | * |
twisti@1220 | 29 | * @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 Test6814842 |
twisti@1220 | 30 | */ |
twisti@1220 | 31 | |
twisti@1220 | 32 | public class Test6814842 { |
twisti@1220 | 33 | static final short[] sa = new short[] { (short) 0xF1F2 }; |
twisti@1220 | 34 | static final char[] ca = new char[] { (char) 0xF3F4 }; |
twisti@1220 | 35 | static final int[] ia = new int[] { 0xF1F2F3F4 }; |
twisti@1220 | 36 | |
twisti@1220 | 37 | public static void main(String[] args) |
twisti@1220 | 38 | { |
twisti@1220 | 39 | byte s2b = loadS2B(sa); |
twisti@1220 | 40 | if (s2b != (byte) 0xF2) |
twisti@1220 | 41 | throw new InternalError("loadS2B failed: " + s2b + " != " + (byte) 0xF2); |
twisti@1220 | 42 | |
twisti@1220 | 43 | byte s2bmask255 = loadS2Bmask255(sa); |
twisti@1220 | 44 | if (s2bmask255 != (byte) 0xF2) |
twisti@1220 | 45 | throw new InternalError("loadS2Bmask255 failed: " + s2bmask255 + " != " + (byte) 0xF2); |
twisti@1220 | 46 | |
twisti@1220 | 47 | byte us2b = loadUS2B(ca); |
twisti@1220 | 48 | if (us2b != (byte) 0xF4) |
twisti@1220 | 49 | throw new InternalError("loadUS2B failed: " + us2b + " != " + (byte) 0xF4); |
twisti@1220 | 50 | |
twisti@1220 | 51 | byte us2bmask255 = loadUS2Bmask255(ca); |
twisti@1220 | 52 | if (us2bmask255 != (byte) 0xF4) |
twisti@1220 | 53 | throw new InternalError("loadUS2Bmask255 failed: " + us2bmask255 + " != " + (byte) 0xF4); |
twisti@1220 | 54 | |
twisti@1220 | 55 | byte i2b = loadI2B(ia); |
twisti@1220 | 56 | if (i2b != (byte) 0xF4) |
twisti@1220 | 57 | throw new InternalError("loadI2B failed: " + i2b + " != " + (byte) 0xF4); |
twisti@1220 | 58 | |
twisti@1220 | 59 | byte i2bmask255 = loadI2Bmask255(ia); |
twisti@1220 | 60 | if (i2bmask255 != (byte) 0xF4) |
twisti@1220 | 61 | throw new InternalError("loadI2Bmask255 failed: " + i2bmask255 + " != " + (byte) 0xF4); |
twisti@1220 | 62 | |
twisti@1220 | 63 | short i2s = loadI2S(ia); |
twisti@1220 | 64 | if (i2s != (short) 0xF3F4) |
twisti@1220 | 65 | throw new InternalError("loadI2S failed: " + i2s + " != " + (short) 0xF3F4); |
twisti@1220 | 66 | |
twisti@1220 | 67 | short i2smask255 = loadI2Smask255(ia); |
twisti@1220 | 68 | if (i2smask255 != (short) 0xF4) |
twisti@1220 | 69 | throw new InternalError("loadI2Smask255 failed: " + i2smask255 + " != " + (short) 0xF4); |
twisti@1220 | 70 | |
twisti@1220 | 71 | short i2smask65535 = loadI2Smask65535(ia); |
twisti@1220 | 72 | if (i2smask65535 != (short) 0xF3F4) |
twisti@1220 | 73 | throw new InternalError("loadI2Smask65535 failed: " + i2smask65535 + " != " + (short) 0xF3F4); |
twisti@1220 | 74 | |
twisti@1220 | 75 | char i2us = loadI2US(ia); |
twisti@1220 | 76 | if (i2us != (char) 0xF3F4) |
twisti@1220 | 77 | throw new InternalError("loadI2US failed: " + (int) i2us + " != " + (char) 0xF3F4); |
twisti@1220 | 78 | |
twisti@1220 | 79 | char i2usmask255 = loadI2USmask255(ia); |
twisti@1220 | 80 | if (i2usmask255 != (char) 0xF4) |
twisti@1220 | 81 | throw new InternalError("loadI2USmask255 failed: " + (int) i2usmask255 + " != " + (char) 0xF4); |
twisti@1220 | 82 | |
twisti@1220 | 83 | char i2usmask65535 = loadI2USmask65535(ia); |
twisti@1220 | 84 | if (i2usmask65535 != (char) 0xF3F4) |
twisti@1220 | 85 | throw new InternalError("loadI2USmask65535 failed: " + (int) i2usmask65535 + " != " + (char) 0xF3F4); |
twisti@1220 | 86 | } |
twisti@1220 | 87 | |
twisti@1220 | 88 | static byte loadS2B (short[] sa) { return (byte) (sa[0] ); } |
twisti@1220 | 89 | static byte loadS2Bmask255 (short[] sa) { return (byte) (sa[0] & 0xFF ); } |
twisti@1220 | 90 | |
twisti@1220 | 91 | static byte loadUS2B (char[] ca) { return (byte) (ca[0] ); } |
twisti@1220 | 92 | static byte loadUS2Bmask255 (char[] ca) { return (byte) (ca[0] & 0xFF ); } |
twisti@1220 | 93 | |
twisti@1220 | 94 | static byte loadI2B (int[] ia) { return (byte) (ia[0] ); } |
twisti@1220 | 95 | static byte loadI2Bmask255 (int[] ia) { return (byte) (ia[0] & 0xFF ); } |
twisti@1220 | 96 | |
twisti@1220 | 97 | static short loadI2S (int[] ia) { return (short) (ia[0] ); } |
twisti@1220 | 98 | static short loadI2Smask255 (int[] ia) { return (short) (ia[0] & 0xFF ); } |
twisti@1220 | 99 | static short loadI2Smask65535 (int[] ia) { return (short) (ia[0] & 0xFFFF); } |
twisti@1220 | 100 | |
twisti@1220 | 101 | static char loadI2US (int[] ia) { return (char) (ia[0] ); } |
twisti@1220 | 102 | static char loadI2USmask255 (int[] ia) { return (char) (ia[0] & 0xFF ); } |
twisti@1220 | 103 | static char loadI2USmask65535(int[] ia) { return (char) (ia[0] & 0xFFFF); } |
twisti@1220 | 104 | } |