Test6863155.java revision 1472
d3ed5b56cb6b58f87ffd125bed48f7668f13de1edirkx/*
893328ef6ff86d0ca27774778d84410353789fb0fielding * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
842ae4bd224140319ae7feec1872b93dfd491143fielding * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
842ae4bd224140319ae7feec1872b93dfd491143fielding *
842ae4bd224140319ae7feec1872b93dfd491143fielding * This code is free software; you can redistribute it and/or modify it
842ae4bd224140319ae7feec1872b93dfd491143fielding * under the terms of the GNU General Public License version 2 only, as
842ae4bd224140319ae7feec1872b93dfd491143fielding * published by the Free Software Foundation.
842ae4bd224140319ae7feec1872b93dfd491143fielding *
893328ef6ff86d0ca27774778d84410353789fb0fielding * This code is distributed in the hope that it will be useful, but WITHOUT
0202d2114cc6d7042995100519cce45c808c153bnd * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
893328ef6ff86d0ca27774778d84410353789fb0fielding * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0202d2114cc6d7042995100519cce45c808c153bnd * version 2 for more details (a copy is included in the LICENSE file that
0202d2114cc6d7042995100519cce45c808c153bnd * accompanied this code).
0202d2114cc6d7042995100519cce45c808c153bnd *
0202d2114cc6d7042995100519cce45c808c153bnd * You should have received a copy of the GNU General Public License version
0202d2114cc6d7042995100519cce45c808c153bnd * 2 along with this work; if not, write to the Free Software Foundation,
893328ef6ff86d0ca27774778d84410353789fb0fielding * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
893328ef6ff86d0ca27774778d84410353789fb0fielding *
893328ef6ff86d0ca27774778d84410353789fb0fielding * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
893328ef6ff86d0ca27774778d84410353789fb0fielding * or visit www.oracle.com if you need additional information or have any
0d50a692ff2ac7bdb42e417737ed86ebf0a41671ben * questions.
14eccd0082c748ae3464dc2459430ff0772b5107sf */
14eccd0082c748ae3464dc2459430ff0772b5107sf
14eccd0082c748ae3464dc2459430ff0772b5107sf/**
14eccd0082c748ae3464dc2459430ff0772b5107sf * @test
14eccd0082c748ae3464dc2459430ff0772b5107sf * @bug 6863155
14eccd0082c748ae3464dc2459430ff0772b5107sf * @summary Server compiler generates incorrect code (x86, long, bitshift, bitmask)
14eccd0082c748ae3464dc2459430ff0772b5107sf *
14eccd0082c748ae3464dc2459430ff0772b5107sf * @run main/othervm -Xcomp -XX:CompileOnly=Test6863155.test Test6863155
14eccd0082c748ae3464dc2459430ff0772b5107sf */
14eccd0082c748ae3464dc2459430ff0772b5107sf
14eccd0082c748ae3464dc2459430ff0772b5107sfpublic class Test6863155 {
14eccd0082c748ae3464dc2459430ff0772b5107sf private static long test(byte b) {
99d360dcbb5ac2be27694be74cc6124dbadf3315jerenkrantz return b << 24 & 0xff000000L;
99d360dcbb5ac2be27694be74cc6124dbadf3315jerenkrantz }
99d360dcbb5ac2be27694be74cc6124dbadf3315jerenkrantz
90b402e944318ae02afd50911eae6da1910f661dpquerna public static void main(String... args) {
928f622b54e87afbbaba6add8aef8066ca16a040wrowe long result = test((byte) 0xc2);
99d360dcbb5ac2be27694be74cc6124dbadf3315jerenkrantz long expected = 0x00000000c2000000L;
99d360dcbb5ac2be27694be74cc6124dbadf3315jerenkrantz if (result != expected)
99d360dcbb5ac2be27694be74cc6124dbadf3315jerenkrantz throw new InternalError(Long.toHexString(result) + " != " + Long.toHexString(expected));
99d360dcbb5ac2be27694be74cc6124dbadf3315jerenkrantz }
99d360dcbb5ac2be27694be74cc6124dbadf3315jerenkrantz}
99d360dcbb5ac2be27694be74cc6124dbadf3315jerenkrantz