0N/A/*
1472N/A * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
0N/Apackage sun.jvm.hotspot.asm.sparc;
0N/A
0N/Aimport sun.jvm.hotspot.asm.*;
0N/A
0N/Apublic class SPARCLogicInstruction extends SPARCFormat3AInstruction
0N/A implements LogicInstruction {
0N/A final private int operation;
0N/A
0N/A public SPARCLogicInstruction(String name, int opcode, int operation, SPARCRegister rs1,
0N/A ImmediateOrRegister operand2, SPARCRegister rd) {
0N/A super(name, opcode, rs1, operand2, rd);
0N/A this.operation = operation;
0N/A }
0N/A
0N/A protected String getDescription() {
0N/A SPARCRegister G0 = SPARCRegisters.G0;
0N/A if (opcode == ORcc && rd == G0 && rd == operand2) {
0N/A StringBuffer buf = new StringBuffer();
0N/A buf.append("tst");
0N/A buf.append(spaces);
0N/A buf.append(getOperand2String());
0N/A return buf.toString();
0N/A } else if (opcode == XNOR && G0 == operand2) {
0N/A StringBuffer buf = new StringBuffer();
0N/A buf.append("not");
0N/A buf.append(spaces);
0N/A buf.append(rs1.toString());
0N/A if (rs1 != rd) {
0N/A buf.append(comma);
0N/A buf.append(rd.toString());
0N/A }
0N/A return buf.toString();
0N/A } else if (opcode == ANDcc && rd == G0) {
0N/A StringBuffer buf = new StringBuffer();
0N/A buf.append("btst");
0N/A buf.append(spaces);
0N/A buf.append(getOperand2String());
0N/A buf.append(comma);
0N/A buf.append(rd.toString());
0N/A return buf.toString();
0N/A } else if (rs1 == rd) {
0N/A StringBuffer buf = new StringBuffer();
0N/A switch (opcode) {
0N/A case OR:
0N/A buf.append("bset");
0N/A break;
0N/A case ANDN:
0N/A buf.append("bclr");
0N/A break;
0N/A case XOR:
0N/A buf.append("btog");
0N/A break;
0N/A default:
0N/A return super.getDescription();
0N/A }
0N/A buf.append(spaces);
0N/A buf.append(getOperand2String());
0N/A buf.append(comma);
0N/A buf.append(rd.toString());
0N/A return buf.toString();
0N/A } else {
0N/A return super.getDescription();
0N/A }
0N/A }
0N/A
0N/A public Operand getLogicDestination() {
0N/A return getDestinationRegister();
0N/A }
0N/A
0N/A public Operand[] getLogicSources() {
0N/A return (new Operand[] { rs1, operand2 });
0N/A }
0N/A
0N/A public int getOperation() {
0N/A return operation;
0N/A }
0N/A
0N/A public boolean isLogic() {
0N/A return true;
0N/A }
0N/A}