annotate graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java @ 22604:b00cc0475f31

Update jvmci import: Refactoring: Rename Kind to JavaKind.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 08 Sep 2015 19:57:39 +0200
parents eb2f0fb5b0a2
children 05183a084a08
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
22469
eb2f0fb5b0a2 [SPARC] Only accept STORE_LOAD memory barrier in LIR Instruction
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22468
diff changeset
2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
21720
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
23 package com.oracle.graal.asm.sparc;
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
21720
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
25 import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*;
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
26 import static com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag.*;
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
27 import static com.oracle.graal.asm.sparc.SPARCAssembler.Op3s.*;
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
28 import static com.oracle.graal.asm.sparc.SPARCAssembler.Opfs.*;
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
29 import static com.oracle.graal.asm.sparc.SPARCAssembler.Ops.*;
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
30 import static java.lang.String.*;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 21733
diff changeset
31 import static jdk.internal.jvmci.sparc.SPARC.*;
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
32
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
33 import java.util.*;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
34
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 21733
diff changeset
35 import jdk.internal.jvmci.code.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 21733
diff changeset
36 import jdk.internal.jvmci.meta.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 21733
diff changeset
37 import jdk.internal.jvmci.sparc.*;
22055
52633d9af8ba Fix unused imports.
twisti
parents: 22054
diff changeset
38 import jdk.internal.jvmci.sparc.SPARC.CPUFeature;
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
39
21720
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
40 import com.oracle.graal.asm.*;
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42 /**
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 * This class implements an assembler that can encode most SPARC instructions.
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 */
14032
d1c1f103d42c renamed com.oracle.graal.asm.AbstractAssembler to com.oracle.graal.asm.Assembler
twisti
parents: 14031
diff changeset
45 public abstract class SPARCAssembler extends Assembler {
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
46
10465
699ee4e4f9dc fixed gate warnings
twisti
parents: 10459
diff changeset
47 /**
10686
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10564
diff changeset
48 * Constructs an assembler for the SPARC architecture.
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 14908
diff changeset
49 *
22056
278d8233af3a Fix javadoc formatting.
twisti
parents: 22055
diff changeset
50 * @param registerConfig the register configuration used to bind {@link Register#Frame} and
10465
699ee4e4f9dc fixed gate warnings
twisti
parents: 10459
diff changeset
51 * {@link Register#CallerFrame} to physical registers. This value can be null if this
699ee4e4f9dc fixed gate warnings
twisti
parents: 10459
diff changeset
52 * assembler instance will not be used to assemble instructions using these logical
699ee4e4f9dc fixed gate warnings
twisti
parents: 10459
diff changeset
53 * registers.
699ee4e4f9dc fixed gate warnings
twisti
parents: 10459
diff changeset
54 */
699ee4e4f9dc fixed gate warnings
twisti
parents: 10459
diff changeset
55 public SPARCAssembler(TargetDescription target, RegisterConfig registerConfig) {
699ee4e4f9dc fixed gate warnings
twisti
parents: 10459
diff changeset
56 super(target);
699ee4e4f9dc fixed gate warnings
twisti
parents: 10459
diff changeset
57 }
699ee4e4f9dc fixed gate warnings
twisti
parents: 10459
diff changeset
58
18844
5e80dd2f1783 Extend emitMul, emitAdd and emitSub in ArithmeticLIRGenerator for explicitly requesting to set the flags register. (In AMD64 flags are set implicitly, but on SPARC it is not)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18717
diff changeset
59 public static final int CCR_ICC_SHIFT = 0;
5e80dd2f1783 Extend emitMul, emitAdd and emitSub in ArithmeticLIRGenerator for explicitly requesting to set the flags register. (In AMD64 flags are set implicitly, but on SPARC it is not)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18717
diff changeset
60 public static final int CCR_XCC_SHIFT = 4;
5e80dd2f1783 Extend emitMul, emitAdd and emitSub in ArithmeticLIRGenerator for explicitly requesting to set the flags register. (In AMD64 flags are set implicitly, but on SPARC it is not)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18717
diff changeset
61 public static final int CCR_V_SHIFT = 1;
5e80dd2f1783 Extend emitMul, emitAdd and emitSub in ArithmeticLIRGenerator for explicitly requesting to set the flags register. (In AMD64 flags are set implicitly, but on SPARC it is not)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18717
diff changeset
62
22468
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
63 public static final int MEMBAR_LOAD_LOAD = 1;
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
64 public static final int MEMBAR_STORE_LOAD = 2;
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
65 public static final int MEMBAR_LOAD_STORE = 3;
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
66 public static final int MEMBAR_STORE_STORE = 4;
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
67
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
68 private static final Ops[] OPS;
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
69 private static final Op2s[] OP2S;
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
70 private static final Op3s[][] OP3S;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
71
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
72 private ArrayList<Integer> delaySlotOptimizationPoints = new ArrayList<>(5);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
73
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
74 static {
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
75 Ops[] ops = Ops.values();
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
76 OPS = new Ops[ops.length];
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
77 for (Ops op : ops) {
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
78 OPS[op.value] = op;
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
79 }
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
80 Op2s[] op2s = Op2s.values();
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
81 OP2S = new Op2s[op2s.length];
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
82 for (Op2s op2 : op2s) {
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
83 OP2S[op2.value] = op2;
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
84 }
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
85 OP3S = new Op3s[2][64];
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
86 for (Op3s op3 : Op3s.values()) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
87 if (op3.value >= 1 << 6) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
88 throw new RuntimeException("Error " + op3 + " " + op3.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
89 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
90 OP3S[op3.op.value & 1][op3.value] = op3;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
91 }
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
92 }
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
93
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
94 public enum Ops {
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
95 // @formatter:off
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
96 BranchOp(0b00),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
97 CallOp(0b01),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
98 ArithOp(0b10),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
99 LdstOp(0b11);
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
100 // @formatter:on
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
101
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
102 private final int value;
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
103
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
104 private Ops(int value) {
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
105 this.value = value;
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
106 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
107
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
108 public int getValue() {
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
109 return value;
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
110 }
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
111
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
112 public boolean appliesTo(int instructionWord) {
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
113 int opShift = 30;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
114 return (instructionWord >>> opShift) == value;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
115 }
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
116 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
117
9828
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
118 public enum Op2s {
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
119 // @formatter:off
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
120 Illtrap(0b000),
16520
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
121 Bpr (0b011),
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
122 Fb (0b110),
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
123 Fbp (0b101),
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
124 Br (0b010),
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
125 Bp (0b001),
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
126 Cb (0b111),
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
127 Sethi (0b100);
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
128 // @formatter:on
9828
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
129
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
130 private final int value;
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
131
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
132 private Op2s(int value) {
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
133 this.value = value;
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
134 }
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
135
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
136 public int getValue() {
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
137 return value;
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
138 }
16520
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
139
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
140 public static Op2s byValue(int value) {
22131
6b4469fe86c9 [SPARC] Use correct position in SPARCAssembler.insertNopAfterCBCond
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22126
diff changeset
141 return OP2S[value];
16520
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
142 }
9828
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
143 }
5aedcaed6ccf Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9825
diff changeset
144
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
145 public enum Op3s {
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
146 // @formatter:off
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
147
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
148 Add(0x00, "add", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
149 And(0x01, "and", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
150 Or(0x02, "or", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
151 Xor(0x03, "xor", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
152 Sub(0x04, "sub", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
153 Andn(0x05, "andn", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
154 Orn(0x06, "orn", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
155 Xnor(0x07, "xnor", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
156 Addc(0x08, "addc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
157 Mulx(0x09, "mulx", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
158 Umul(0x0A, "umul", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
159 Smul(0x0B, "smul", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
160 Subc(0x0C, "subc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
161 Udivx(0x0D, "udivx", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
162 Udiv(0x0E, "udiv", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
163 Sdiv(0x0F, "sdiv", ArithOp),
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
164
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
165 Addcc(0x10, "addcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
166 Andcc(0x11, "andcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
167 Orcc(0x12, "orcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
168 Xorcc(0x13, "xorcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
169 Subcc(0x14, "subcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
170 Andncc(0x15, "andncc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
171 Orncc(0x16, "orncc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
172 Xnorcc(0x17, "xnorcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
173 Addccc(0x18, "addccc", ArithOp),
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
174
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
175 Umulcc(0x1A, "umulcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
176 Smulcc(0x1B, "smulcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
177 Subccc(0x1C, "subccc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
178 Udivcc(0x1E, "udivcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
179 Sdivcc(0x1F, "sdivcc", ArithOp),
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
180
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
181 Taddcc(0x20, "taddcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
182 Tsubcc(0x21, "tsubcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
183 Taddcctv(0x22, "taddcctv", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
184 Tsubcctv(0x23, "tsubcctv", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
185 Mulscc(0x24, "mulscc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
186 Sll(0x25, "sll", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
187 Sllx(0x25, "sllx", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
188 Srl(0x26, "srl", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
189 Srlx(0x26, "srlx", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
190 Sra(0x27, "srax", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
191 Srax(0x27, "srax", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
192 Membar(0x28, "membar", ArithOp),
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
193
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
194 Flushw(0x2B, "flushw", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
195 Movcc(0x2C, "movcc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
196 Sdivx(0x2D, "sdivx", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
197 Popc(0x2E, "popc", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
198 Movr(0x2F, "movr", ArithOp),
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
199
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
200 Fpop1(0b11_0100, "fpop1", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
201 Fpop2(0b11_0101, "fpop2", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
202 Impdep1(0b11_0110, "impdep1", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
203 Impdep2(0b11_0111, "impdep2", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
204 Jmpl(0x38, "jmpl", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
205 Rett(0x39, "rett", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
206 Trap(0x3a, "trap", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
207 Flush(0x3b, "flush", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
208 Save(0x3c, "save", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
209 Restore(0x3d, "restore", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
210 Retry(0x3e, "retry", ArithOp),
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
211
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
212
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
213 Casa(0b111100, "casa", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
214 Casxa(0b111110, "casxa", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
215 Prefetch(0b101101, "prefetch", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
216 Prefetcha(0b111101, "prefetcha", LdstOp),
9825
81d5d8089cda SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9817
diff changeset
217
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
218 Lduw (0b00_0000, "lduw", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
219 Ldub (0b00_0001, "ldub", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
220 Lduh (0b00_0010, "lduh", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
221 Stw (0b00_0100, "stw", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
222 Stb (0b00_0101, "stb", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
223 Sth (0b00_0110, "sth", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
224 Ldsw (0b00_1000, "ldsw", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
225 Ldsb (0b00_1001, "ldsb", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
226 Ldsh (0b00_1010, "ldsh", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
227 Ldx (0b00_1011, "ldx", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
228 Stx (0b00_1110, "stx", LdstOp),
16635
d4fe35867b95 [SPARC] Reformatting some enum constants to match better to the SPARC 2011 Architecture manual
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16633
diff changeset
229
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
230 Ldf (0b10_0000, "ldf", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
231 Ldfsr (0b10_0001, "ldfsr", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
232 Ldaf (0b10_0010, "ldaf", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
233 Lddf (0b10_0011, "lddf", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
234 Stf (0b10_0100, "stf", LdstOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
235 Stfsr (0b10_0101, "stfsr", LdstOp),
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
236 Staf (0b10_0110, "staf", LdstOp),
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
237 Stdf (0b10_0111, "stdf", LdstOp),
16635
d4fe35867b95 [SPARC] Reformatting some enum constants to match better to the SPARC 2011 Architecture manual
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16633
diff changeset
238
22468
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
239 Stba (0b01_0101, "stba", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
240 Stha (0b01_0110, "stha", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
241 Stwa (0b01_0100, "stwa", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
242 Stxa (0b01_1110, "stxa", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
243
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
244 Ldsba (0b01_1001, "ldsba", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
245 Ldsha (0b01_1010, "ldsha", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
246 Ldswa (0b01_1000, "ldswa", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
247 Lduba (0b01_0001, "lduba", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
248 Lduha (0b01_0010, "lduha", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
249 Lduwa (0b01_0000, "lduwa", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
250
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
251 Ldxa (0b01_1011, "ldxa", LdstOp),
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
252
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
253 Rd (0b10_1000, "rd", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
254 Wr (0b11_0000, "wr", ArithOp),
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
255 Fcmp (0b11_0101, "fcmp", ArithOp),
16635
d4fe35867b95 [SPARC] Reformatting some enum constants to match better to the SPARC 2011 Architecture manual
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16633
diff changeset
256
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
257 Tcc(0b11_1010, "tcc", ArithOp);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
258
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
259 // @formatter:on
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
260
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
261 private final int value;
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
262 private final String operator;
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
263 private final Ops op;
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
264
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
265 private Op3s(int value, String name, Ops op) {
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
266 assert isImm(value, 6);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
267 this.value = value;
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
268 this.operator = name;
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
269 this.op = op;
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
270 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
271
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
272 public int getValue() {
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
273 return value;
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
274 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
275
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
276 public String getOperator() {
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
277 return operator;
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
278 }
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
279
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
280 public boolean throwsException() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
281 if (op == LdstOp) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
282 return true;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
283 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
284 switch (this) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
285 case Udiv:
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
286 case Udivx:
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
287 case Sdiv:
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
288 case Sdivx:
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
289 case Udivcc:
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
290 case Sdivcc:
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
291 return true;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
292 default:
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
293 return false;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
294 }
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
295 }
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
296 }
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
297
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
298 public enum Opfs {
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
299 // @formatter:off
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
300
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 14908
diff changeset
301 Fmovs(0b0_0000_0001, "fmovs"),
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 14908
diff changeset
302 Fmovd(0b0_0000_0010, "fmovd"),
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 14908
diff changeset
303 Fmovq(0b0_0000_0011, "fmovq"),
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
304 Fmovscc(0b00_0001, "fmovscc"),
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
305 Fmovdcc(0b00_0010, "fmovdcc"),
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
306 Fnegs(0x05, "fnegs"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
307 Fnegd(0x06, "fnegd"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
308 Fnegq(0x07, "fnegq"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
309 Fabss(0x09, "fabss"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
310 Fabsd(0x0A, "fabsd"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
311 Fabsq(0x0B, "fabsq"),
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
312
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
313 // start VIS1
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
314 Edge8cc(0x0, "edge8cc"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
315 Edge8n(0x1, "edge8n"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
316 Edge8lcc(0x2, "edge8lcc"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
317 Edge8ln(0x3, "edge8ln"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
318 Edge16cc(0x4, "edge16cc"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
319 Edge16n(0x5, "edge16n"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
320 Edge16lcc(0x6, "edge16lcc"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
321 Edge16ln(0x7, "edge16ln"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
322 Edge32cc(0x8, "edge32cc"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
323 Edge32n(0x9, "edge32n"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
324 Edge32lcc(0xA, "edge32lcc"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
325 Edge32ln(0xB, "edge32ln"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
326 Array8(0x10, "array8"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
327 Array16(0x12, "array16"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
328 Array32(0x14, "array32"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
329 AlignAddress(0x18, "alignaddress"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
330 AlignAddressLittle(0x1A, "alignaddress_little"),
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
331 Fpcmple16(0x20, "fpcmple16"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
332 Fpcmpne16(0x22, "fpcmpne16"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
333 Fpcmple32(0x24, "fpcmple32"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
334 Fpcmpne32(0x26, "fpcmpne32"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
335 Fpcmpgt16(0x28, "fpcmpgt16"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
336 Fpcmpeq16(0x2A, "fpcmpeq16"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
337 Fpcmpgt32(0x2C, "fpcmpgt32"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
338 Fpcmpeq32(0x2E, "fpcmpeq32"),
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
339 Fmul8x16(0x31, "fmul8x16"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
340 Fmul8x16au(0x33, "fmul8x16au"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
341 Fmul8x16al(0x35, "fmul8x16al"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
342 Fmul8sux16(0x36, "fmul8sux16"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
343 Fmul8ulx16(0x37, "fmul8ulx16"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
344 Fmuld8sux16(0x38, "fmuld8sux16"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
345 Fmuld8ulx16(0x39, "fmuld8ulx16"),
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
346 Fpack32(0x3A, "fpack32"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
347 Fpack16(0x3B, "fpack16"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
348 Fpackfix(0x3D, "fpackfix"),
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
349 Faligndatag(0x48, "faligndata"),
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
350 Fpmerge(0x4B, "fpmerge"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
351 Fpadd16(0x50, "fpadd16"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
352 Fpadd16s(0x51, "fpadd16s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
353 Fpadd32(0x52, "fpadd32"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
354 Fpadd32s(0x53, "fpadd32s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
355 Fpsub16(0x54, "fpadd16"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
356 Fpsub16s(0x55, "fpadd16s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
357 Fpsub32(0x56, "fpadd32"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
358 Fpsub32s(0x57, "fpadd32s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
359 Fzerod(0x60, "fzerod"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
360 Fzeros(0x61, "fzeros"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
361 Fnot2d(0x66, "fnot1d"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
362 Fnot2s(0x67, "fnot1s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
363 Fnot1d(0x6A, "fnot1d"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
364 Fnot1s(0x6B, "fnot1s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
365 Fsrc1d(0x74, "fsrc1d"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
366 Fsrc1s(0x75, "fsrc1s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
367 Fsrc2d(0x78, "fsrc2d"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
368 Fsrc2s(0x79, "fsrc2s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
369 Foned(0x7E, "foned"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
370 Fones(0x7F, "fones"),
16520
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
371 Fandd(0b0_0111_0000, "fandd"),
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
372 Fands(0b0_0111_0001, "fands"),
17116
dced35fd40f7 [SPARC] fix the floatingpoint loading of constant +0.0 and -0.0, changed ArraysCompare more to the C2 implementation.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17109
diff changeset
373 Fxord(0b0_0110_1100, "fxord"),
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
374 Fxors(0b0_0110_1101, "fxors"),
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
375 // end VIS1
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
376
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
377 // start VIS2
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
378 Bmask(0x19, "bmask"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
379 Bshuffle(0x4c, "bshuffle"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
380 // end VIS2 only
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
381
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
382 // start VIS3
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
383 Addxc(0x11, "addxc"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
384 Addxccc(0x13, "addxccc"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
385 Cmask8(0x1B, "cmask8"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
386 Cmask16(0x1D, "cmask16"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
387 Cmask32(0x1F, "cmask32"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
388 Fmean16(0x40, "fmean16"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
389 Fnadds(0x51, "fnadds"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
390 Fnaddd(0x52, "fnaddd"),
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
391 Fnmuls(0x59, "fnmuls"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
392 Fnmuld(0x5A, "fnmuld"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
393 Fnsmuld(0x79, "fnsmuld"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
394 Fnhadds(0x71, "fnhadds"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
395 Fnhaddd(0x72, "fnhaddd"),
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
396 Movdtox(0x110, "movdtox"),
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
397 Movstouw(0x111, "movstouw"),
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
398 Movstosw(0x113, "movstosw"),
16319
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
399 Movxtod(0x118, "movxtod"),
16927
949347518b66 [SPARC] new vis3 instruction umulxhi
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16651
diff changeset
400 Movwtos(0b1_0001_1001, "movwtos"),
949347518b66 [SPARC] new vis3 instruction umulxhi
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16651
diff changeset
401 UMulxhi(0b0_0001_0110, "umulxhi"),
18844
5e80dd2f1783 Extend emitMul, emitAdd and emitSub in ArithmeticLIRGenerator for explicitly requesting to set the flags register. (In AMD64 flags are set implicitly, but on SPARC it is not)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18717
diff changeset
402 Lzcnt (0b0_0001_0111, "lzcnt"),
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
403 // end VIS3
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
404
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
405 // start CAMMELLIA
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
406 CammelliaFl(0x13C, "cammelia_fl"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
407 CammelliaFli(0x13D, "cammellia_fli"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
408 // end CAMMELLIA
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
409
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
410 // start CRYPTO
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
411 Crc32c(0x147, "crc32c"),
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
412 // end CRYPTO
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
413
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
414 // start OSA 2011
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
415 Fpadd64(0x44, "fpadd64"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
416 Fpsub64(0x46, "fpsub64"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
417 Fpadds16(0x58, "fpadds16"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
418 Fpadds16s(0x59, "fpadds16"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
419 Fpadds32(0x5A, "fpadds32"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
420 Fpadds32s(0x5B, "fpadds32s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
421 Fpsubs16(0x5C, "fpsubs16"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
422 Fpsubs16s(0x5D, "fpsubs16s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
423 Fpsubs32(0x5E, "fpsubs32"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
424 Fpsubs32s(0x5F, "fpsubs32s"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
425 Fpcmpne8(0x122, "fpcmpne8"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
426 Fpcmpeq8(0x12C, "fpcmpeq8"),
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
427 // end OSA 2011
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
428
9817
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
429 Fadds(0x41, "fadds"),
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
430 Faddd(0x42, "faddd"),
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
431 Faddq(0x43, "faddq"),
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
432 Fsubs(0x45, "fsubs"),
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
433 Fsubd(0x46, "fsubd"),
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
434 Fsubq(0x47, "fsubq"),
9825
81d5d8089cda SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9817
diff changeset
435 Fmuls(0x49, "fmuls"),
81d5d8089cda SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9817
diff changeset
436 Fmuld(0x4A, "fmuld"),
16317
4b24d2019286 Fixing issues with fdiv
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16315
diff changeset
437 Fdivs(0x4D, "fdivs"),
4b24d2019286 Fixing issues with fdiv
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16315
diff changeset
438 Fdivd(0x4E, "fdivd"),
4b24d2019286 Fixing issues with fdiv
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16315
diff changeset
439 Fdivq(0x4F, "fdivq"),
9825
81d5d8089cda SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9817
diff changeset
440
9846
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
441 Fsqrts(0x29, "fsqrts"),
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
442 Fsqrtd(0x2A, "fsqrtd"),
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
443 Fsqrtq(0x2B, "fsqrtq"),
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
444
9825
81d5d8089cda SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9817
diff changeset
445 Fsmuld(0x69, "fsmuld"),
81d5d8089cda SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9817
diff changeset
446 Fmulq(0x6B, "fmulq"),
81d5d8089cda SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9817
diff changeset
447 Fdmuldq(0x6E, "fdmulq"),
81d5d8089cda SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9817
diff changeset
448
9817
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
449 Fstoi(0xD1, "fstoi"),
16315
b955d649fca8 Fixing BC_i2f, BC_i2c, BC_fadd
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16313
diff changeset
450 Fdtoi(0xD2, "fdtoi"),
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
451 Fstox(0x81, "fstox"),
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
452 Fdtox(0x82, "fdtox"),
16319
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
453 Fxtos(0x84, "fxtos"),
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
454 Fxtod(0x88, "fxtod"),
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
455 Fxtoq(0x8C, "fxtoq"),
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
456 Fitos(0xC4, "fitos"),
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
457 Fdtos(0xC6, "fdtos"),
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
458 Fitod(0xC8, "fitod"),
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
459 Fstod(0xC9, "fstod"),
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
460 Fitoq(0xCC, "fitoq"),
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
461
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
462
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
463 Fcmps(0x51, "fcmps"),
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
464 Fcmpd(0x52, "fcmpd"),
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 17207
diff changeset
465 Fcmpq(0x53, "fcmpq");
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 17207
diff changeset
466
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
467 // @formatter:on
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
468
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
469 private final int value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
470 private final String operator;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
471
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
472 private Opfs(int value, String op) {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
473 this.value = value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
474 this.operator = op;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
475 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
476
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
477 public int getValue() {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
478 return value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
479 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
480
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
481 public String getOperator() {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
482 return operator;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
483 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
484 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
485
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
486 public enum Annul {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
487 ANNUL(1),
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
488 NOT_ANNUL(0);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
489 public final int flag;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
490
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
491 Annul(int flag) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
492 this.flag = flag;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
493 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
494 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
495
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
496 public enum BranchPredict {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
497 PREDICT_TAKEN(1),
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
498 PREDICT_NOT_TAKEN(0);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
499 public final int flag;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
500
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
501 BranchPredict(int flag) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
502 this.flag = flag;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
503 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
504 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
505
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
506 public enum MembarMask {
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
507 // @formatter:off
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
508
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
509 StoreStore(1 << 3, "storestore"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
510 LoadStore(1 << 2, "loadstore"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
511 StoreLoad(1 << 1, "storeload"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
512 LoadLoad(1 << 0, "loadload"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
513 Sync(1 << 6, "sync"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
514 MemIssue(1 << 5, "memissue"),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
515 LookAside(1 << 4, "lookaside");
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
516
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
517 // @formatter:on
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
518
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
519 private final int value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
520 private final String operator;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
521
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
522 private MembarMask(int value, String op) {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
523 this.value = value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
524 this.operator = op;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
525 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
526
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
527 public int getValue() {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
528 return value | 0x2000;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
529 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
530
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
531 public String getOperator() {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
532 return operator;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
533 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
534 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
535
16303
66c7e50a9a32 SPARCMove.java: Adding constant float and double loads
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14908
diff changeset
536 /**
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 17207
diff changeset
537 * Condition Codes to use for instruction.
16303
66c7e50a9a32 SPARCMove.java: Adding constant float and double loads
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14908
diff changeset
538 */
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
539 public enum CC {
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
540 // @formatter:off
16303
66c7e50a9a32 SPARCMove.java: Adding constant float and double loads
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14908
diff changeset
541 /**
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 17207
diff changeset
542 * Condition is considered as 32bit operation condition.
16303
66c7e50a9a32 SPARCMove.java: Adding constant float and double loads
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14908
diff changeset
543 */
19683
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
544 Icc(0b00, "icc", false),
16303
66c7e50a9a32 SPARCMove.java: Adding constant float and double loads
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14908
diff changeset
545 /**
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 17207
diff changeset
546 * Condition is considered as 64bit operation condition.
16303
66c7e50a9a32 SPARCMove.java: Adding constant float and double loads
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14908
diff changeset
547 */
19683
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
548 Xcc(0b10, "xcc", false),
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
549 Fcc0(0b00, "fcc0", true),
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
550 Fcc1(0b01, "fcc1", true),
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
551 Fcc2(0b10, "fcc2", true),
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
552 Fcc3(0b11, "fcc3", true);
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
553
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
554 // @formatter:on
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
555
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
556 private final int value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
557 private final String operator;
19683
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
558 private boolean isFloat;
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
559
19683
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
560 private CC(int value, String op, boolean isFloat) {
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
561 this.value = value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
562 this.operator = op;
19683
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
563 this.isFloat = isFloat;
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
564 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
565
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
566 public int getValue() {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
567 return value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
568 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
569
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
570 public String getOperator() {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
571 return operator;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
572 }
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
573
22604
b00cc0475f31 Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22469
diff changeset
574 public static CC forKind(JavaKind kind) {
b00cc0475f31 Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22469
diff changeset
575 boolean isInt = kind == JavaKind.Boolean || kind == JavaKind.Byte || kind == JavaKind.Char || kind == JavaKind.Short || kind == JavaKind.Int;
b00cc0475f31 Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22469
diff changeset
576 boolean isFloat = kind == JavaKind.Float || kind == JavaKind.Double;
b00cc0475f31 Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22469
diff changeset
577 boolean isLong = kind == JavaKind.Long || kind == JavaKind.Object;
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
578 assert isInt || isFloat || isLong;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
579 if (isLong) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
580 return Xcc;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
581 } else if (isInt) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
582 return Icc;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
583 } else if (isFloat) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
584 return Fcc0;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
585 } else {
21708
6df25b1418be moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21673
diff changeset
586 throw new InternalError();
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
587 }
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
588 }
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
589 }
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
590
9846
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
591 public enum ConditionFlag {
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
592 // @formatter:off
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
593
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
594 // for FBfcc & FBPfcc instruction
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
595 F_Never(0, "f_never"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
596 F_NotEqual(1, "f_notEqual"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
597 F_LessOrGreater(2, "f_lessOrGreater"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
598 F_UnorderedOrLess(3, "f_unorderedOrLess"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
599 F_Less(4, "f_less"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
600 F_UnorderedOrGreater(5, "f_unorderedOrGreater"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
601 F_Greater(6, "f_greater"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
602 F_Unordered(7, "f_unordered"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
603 F_Always(8, "f_always"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
604 F_Equal(9, "f_equal"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
605 F_UnorderedOrEqual(10, "f_unorderedOrEqual"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
606 F_GreaterOrEqual(11, "f_greaterOrEqual"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
607 F_UnorderedGreaterOrEqual(12, "f_unorderedGreaterOrEqual"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
608 F_LessOrEqual(13, "f_lessOrEqual"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
609 F_UnorderedOrLessOrEqual(14, "f_unorderedOrLessOrEqual"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
610 F_Ordered(15, "f_ordered"),
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
611
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
612 // for integers
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
613 Never(0, "never"),
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
614 Equal(1, "equal", true),
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
615 Zero(1, "zero"),
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
616 LessEqual(2, "lessEqual", true),
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
617 Less(3, "less", true),
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
618 LessEqualUnsigned(4, "lessEqualUnsigned", true),
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
619 LessUnsigned(5, "lessUnsigned", true),
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
620 CarrySet(5, "carrySet"),
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
621 Negative(6, "negative", true),
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
622 OverflowSet(7, "overflowSet", true),
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
623 Always(8, "always"),
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
624 NotEqual(9, "notEqual", true),
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
625 NotZero(9, "notZero"),
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
626 Greater(10, "greater", true),
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
627 GreaterEqual(11, "greaterEqual", true),
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
628 GreaterUnsigned(12, "greaterUnsigned", true),
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
629 GreaterEqualUnsigned(13, "greaterEqualUnsigned", true),
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
630 CarryClear(13, "carryClear"),
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
631 Positive(14, "positive", true),
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
632 OverflowClear(15, "overflowClear", true);
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
633
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
634 // @formatter:on
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
635
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
636 private final int value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
637 private final String operator;
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
638 private boolean forCBcond = false;
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
639
9846
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
640 private ConditionFlag(int value, String op) {
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
641 this(value, op, false);
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
642 }
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
643
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
644 private ConditionFlag(int value, String op, boolean cbcond) {
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
645 this.value = value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
646 this.operator = op;
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
647 this.forCBcond = cbcond;
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
648 }
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
649
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
650 public boolean isCBCond() {
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
651 return forCBcond;
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
652 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
653
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
654 public int getValue() {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
655 return value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
656 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
657
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
658 public String getOperator() {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
659 return operator;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
660 }
16927
949347518b66 [SPARC] new vis3 instruction umulxhi
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16651
diff changeset
661
949347518b66 [SPARC] new vis3 instruction umulxhi
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16651
diff changeset
662 public ConditionFlag negate() {
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
663 //@formatter:off
16927
949347518b66 [SPARC] new vis3 instruction umulxhi
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16651
diff changeset
664 switch (this) {
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
665 case F_Never : return F_Always;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
666 case F_Always : return F_Never;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
667 case F_NotEqual : return F_Equal;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
668 case F_Equal : return F_NotEqual;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
669 case F_LessOrGreater : return F_UnorderedOrEqual;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
670 case F_UnorderedOrEqual : return F_LessOrGreater;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
671 case F_Less : return F_UnorderedGreaterOrEqual;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
672 case F_UnorderedGreaterOrEqual: return F_Less;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
673 case F_LessOrEqual : return F_UnorderedOrGreater;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
674 case F_UnorderedOrGreater : return F_LessOrEqual;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
675 case F_Greater : return F_UnorderedOrLessOrEqual;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
676 case F_UnorderedOrLessOrEqual : return F_Greater;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
677 case F_GreaterOrEqual : return F_UnorderedOrLess;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
678 case F_UnorderedOrLess : return F_GreaterOrEqual;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
679 case F_Unordered : return F_Ordered;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
680 case F_Ordered : return F_Unordered;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
681 case Never : return Always;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
682 case Always : return Never;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
683 case Equal : return NotEqual;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
684 case NotEqual : return Equal;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
685 case Zero : return NotZero;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
686 case NotZero : return Zero;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
687 case LessEqual : return Greater;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
688 case Greater : return LessEqual;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
689 case Less : return GreaterEqual;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
690 case GreaterEqual : return Less;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
691 case LessEqualUnsigned : return GreaterUnsigned;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
692 case GreaterUnsigned : return LessEqualUnsigned;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
693 case LessUnsigned : return GreaterEqualUnsigned;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
694 case GreaterEqualUnsigned : return LessUnsigned;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
695 case CarrySet : return CarryClear;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
696 case CarryClear : return CarrySet;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
697 case Negative : return Positive;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
698 case Positive : return Negative;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
699 case OverflowSet : return OverflowClear;
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
700 case OverflowClear : return OverflowSet;
16927
949347518b66 [SPARC] new vis3 instruction umulxhi
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16651
diff changeset
701 default:
21708
6df25b1418be moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21673
diff changeset
702 throw new InternalError();
16927
949347518b66 [SPARC] new vis3 instruction umulxhi
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16651
diff changeset
703 }
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
704 //@formatter:on
16927
949347518b66 [SPARC] new vis3 instruction umulxhi
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16651
diff changeset
705 }
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
706
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
707 public ConditionFlag mirror() {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
708 switch (this) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
709 //@formatter:off
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
710 case F_Less : return F_Greater;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
711 case F_Greater : return F_Less;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
712 case F_LessOrEqual : return F_GreaterOrEqual;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
713 case F_UnorderedGreaterOrEqual: return F_UnorderedOrLessOrEqual;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
714 case F_UnorderedOrGreater : return F_UnorderedOrLess;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
715 case F_UnorderedOrLessOrEqual : return F_UnorderedGreaterOrEqual;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
716 case F_GreaterOrEqual : return F_LessOrEqual;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
717 case F_UnorderedOrLess : return F_UnorderedOrGreater;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
718 case LessEqual : return GreaterEqual;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
719 case Greater : return Less;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
720 case Less : return Greater;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
721 case GreaterEqual : return LessEqual;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
722 case LessEqualUnsigned : return GreaterEqualUnsigned;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
723 case GreaterUnsigned : return LessUnsigned;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
724 case LessUnsigned : return GreaterUnsigned;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
725 case GreaterEqualUnsigned : return LessEqualUnsigned;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
726 default:
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
727 return this;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
728 //@formatter:on
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
729 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
730 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
731
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
732 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
733
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
734 public enum RCondition {
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
735 // @formatter:off
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
736
17109
1a92d77a851b [SPARC] Implementing ArrayEqualsOp for sparc
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17104
diff changeset
737 Rc_z(0b001, "rc_z"),
1a92d77a851b [SPARC] Implementing ArrayEqualsOp for sparc
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17104
diff changeset
738 Rc_lez(0b010, "rc_lez"),
1a92d77a851b [SPARC] Implementing ArrayEqualsOp for sparc
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17104
diff changeset
739 Rc_lz(0b011, "rc_lz"),
1a92d77a851b [SPARC] Implementing ArrayEqualsOp for sparc
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17104
diff changeset
740 Rc_nz(0b101, "rc_nz"),
1a92d77a851b [SPARC] Implementing ArrayEqualsOp for sparc
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17104
diff changeset
741 Rc_gz(0b110, "rc_gz"),
1a92d77a851b [SPARC] Implementing ArrayEqualsOp for sparc
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17104
diff changeset
742 Rc_gez(0b111, "rc_gez"),
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
743 Rc_last(Rc_gez.getValue(), "rc_last");
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
744
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
745 // @formatter:on
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
746
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
747 private final int value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
748 private final String operator;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
749
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
750 private RCondition(int value, String op) {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
751 this.value = value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
752 this.operator = op;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
753 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
754
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
755 public int getValue() {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
756 return value;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
757 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
758
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
759 public String getOperator() {
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
760 return operator;
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
761 }
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
762 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
763
16303
66c7e50a9a32 SPARCMove.java: Adding constant float and double loads
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14908
diff changeset
764 /**
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 17207
diff changeset
765 * Represents the <b>Address Space Identifier</b> defined in the SPARC architecture.
16303
66c7e50a9a32 SPARCMove.java: Adding constant float and double loads
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14908
diff changeset
766 */
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
767 public enum Asi {
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
768 // @formatter:off
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
769
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
770 INVALID(-1),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
771 ASI_PRIMARY(0x80),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
772 ASI_PRIMARY_NOFAULT(0x82),
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
773 ASI_PRIMARY_LITTLE(0x88),
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
774 // Block initializing store
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
775 ASI_ST_BLKINIT_PRIMARY(0xE2),
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
776 // Most-Recently-Used (MRU) BIS variant
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
777 ASI_ST_BLKINIT_MRU_PRIMARY(0xF2);
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
778
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
779 // @formatter:on
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
780
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
781 private final int value;
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
782
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
783 private Asi(int value) {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
784 this.value = value;
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
785 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
786
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
787 public int getValue() {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
788 return value;
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
789 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
790
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
791 public boolean isValid() {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
792 return value != INVALID.getValue();
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
793 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
794 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
795
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
796 public enum Fcn {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
797 SeveralWritesAndPossiblyReads(2),
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
798 SeveralReadsWeak(0),
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
799 OneRead(1),
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
800 OneWrite(3),
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
801 Page(4),
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
802 NearestUnifiedCache(17),
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
803 SeveralReadsStrong(20),
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
804 OneReadStrong(21),
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
805 SeveralWritesAndPossiblyReadsStrong(22),
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
806 OneWriteStrong(23);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
807
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
808 private final int value;
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
809
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
810 private Fcn(int value) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
811 this.value = value;
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
812 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
813
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
814 public int getValue() {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
815 return value;
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
816 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
817 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
818
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
819 /**
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
820 * Specifies various bit fields used in SPARC instructions.
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
821 */
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
822 @SuppressWarnings("unused")
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
823 public abstract static class BitSpec {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
824 private static final BitSpec op = new ContinousBitSpec(31, 30, "op");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
825 private static final BitSpec op2 = new ContinousBitSpec(24, 22, "op2");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
826 private static final BitSpec op3 = new ContinousBitSpec(24, 19, "op3");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
827 private static final BitSpec rd = new ContinousBitSpec(29, 25, "rd");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
828 private static final BitSpec rs1 = new ContinousBitSpec(18, 14, "rs1");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
829 private static final BitSpec rs2 = new ContinousBitSpec(4, 0, "rs2");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
830 private static final BitSpec simm13 = new ContinousBitSpec(12, 0, "simm13");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
831 private static final BitSpec imm22 = new ContinousBitSpec(21, 0, "imm22");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
832 private static final BitSpec immAsi = new ContinousBitSpec(12, 5, "immASI");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
833 private static final BitSpec i = new ContinousBitSpec(13, 13, "i");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
834 private static final BitSpec disp19 = new ContinousBitSpec(18, 0, true, "disp19");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
835 private static final BitSpec disp22 = new ContinousBitSpec(21, 0, true, "disp22");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
836 private static final BitSpec disp30 = new ContinousBitSpec(29, 0, true, "disp30");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
837 private static final BitSpec a = new ContinousBitSpec(29, 29, "a");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
838 private static final BitSpec p = new ContinousBitSpec(19, 19, "p");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
839 private static final BitSpec cond = new ContinousBitSpec(28, 25, "cond");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
840 private static final BitSpec rcond = new ContinousBitSpec(27, 25, "rcond");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
841 private static final BitSpec cc = new ContinousBitSpec(21, 20, "cc");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
842 private static final BitSpec d16hi = new ContinousBitSpec(21, 20, "d16hi");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
843 private static final BitSpec d16lo = new ContinousBitSpec(13, 0, "d16lo");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
844 private static final BitSpec d16 = new CompositeBitSpec(d16hi, d16lo);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
845 // CBCond
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
846 private static final BitSpec cLo = new ContinousBitSpec(27, 25, "cLo");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
847 private static final BitSpec cHi = new ContinousBitSpec(29, 29, "cHi");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
848 private static final BitSpec c = new CompositeBitSpec(cHi, cLo);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
849 private static final BitSpec cbcond = new ContinousBitSpec(28, 28, "cbcond");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
850 private static final BitSpec cc2 = new ContinousBitSpec(21, 21, "cc2");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
851 private static final BitSpec d10Lo = new ContinousBitSpec(12, 5, "d10Lo");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
852 private static final BitSpec d10Hi = new ContinousBitSpec(20, 19, "d10Hi");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
853 private static final BitSpec d10 = new CompositeBitSpec(d10Hi, d10Lo);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
854 private static final BitSpec simm5 = new ContinousBitSpec(4, 0, true, "simm5");
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
855
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
856 public abstract int setBits(int word, int value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
857
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
858 public abstract int getBits(int word);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
859
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
860 public abstract int getWidth();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
861
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
862 public abstract boolean valueFits(int value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
863 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
864
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
865 public static class ContinousBitSpec extends BitSpec {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
866 private final int hiBit;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
867 private final int lowBit;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
868 private final int width;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
869 private final boolean signExt;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
870 private final int mask;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
871 private final String name;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
872
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
873 public ContinousBitSpec(int hiBit, int lowBit, String name) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
874 this(hiBit, lowBit, false, name);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
875 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
876
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
877 public ContinousBitSpec(int hiBit, int lowBit, boolean signExt, String name) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
878 super();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
879 this.hiBit = hiBit;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
880 this.lowBit = lowBit;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
881 this.signExt = signExt;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
882 this.width = hiBit - lowBit + 1;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
883 mask = ((1 << width) - 1) << lowBit;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
884 this.name = name;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
885 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
886
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
887 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
888 public int setBits(int word, int value) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
889 assert valueFits(value) : "Value: " + value + " does not fit in " + this;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
890 return (word & ~mask) | ((value << lowBit) & mask);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
891 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
892
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
893 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
894 public int getBits(int word) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
895 if (signExt) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
896 return ((word & mask) << (31 - hiBit)) >> (32 - width);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
897 } else {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
898 return (word & mask) >>> lowBit;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
899 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
900 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
901
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
902 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
903 public int getWidth() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
904 return width;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
905 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
906
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
907 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
908 public String toString() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
909 return String.format("%s [%d:%d]", name, hiBit, lowBit);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
910 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
911
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
912 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
913 public boolean valueFits(int value) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
914 if (signExt) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
915 return isSimm(value, getWidth());
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
916 } else {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
917 return isImm(value, getWidth());
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
918 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
919 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
920 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
921
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
922 public static class CompositeBitSpec extends BitSpec {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
923 private final BitSpec left;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
924 private final int leftWidth;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
925 private final BitSpec right;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
926 private final int rightWidth;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
927
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
928 public CompositeBitSpec(BitSpec left, BitSpec right) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
929 super();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
930 this.left = left;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
931 this.leftWidth = left.getWidth();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
932 this.right = right;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
933 this.rightWidth = right.getWidth();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
934 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
935
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
936 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
937 public int getBits(int word) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
938 int l = left.getBits(word);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
939 int r = right.getBits(word);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
940 return l << rightWidth | r;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
941 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
942
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
943 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
944 public int setBits(int word, int value) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
945 int l = leftBits(value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
946 int r = rightBits(value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
947 return left.setBits(right.setBits(word, r), l);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
948 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
949
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
950 private int leftBits(int value) {
22412
9961439fc100 [SPARC] Consolidate compareBranch into SPARCMacroAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22410
diff changeset
951 return SPARCAssembler.getBits(value, rightWidth + leftWidth - 1, rightWidth);
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
952 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
953
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
954 private int rightBits(int value) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
955 return SPARCAssembler.getBits(value, rightWidth - 1, 0);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
956 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
957
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
958 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
959 public int getWidth() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
960 return left.getWidth() + right.getWidth();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
961 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
962
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
963 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
964 public String toString() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
965 return String.format("CompositeBitSpec[%s, %s]", left, right);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
966 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
967
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
968 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
969 public boolean valueFits(int value) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
970 return left.valueFits(leftBits(value)) && right.valueFits(rightBits(value));
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
971 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
972 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
973
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
974 public static class BitKey {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
975 private final BitSpec spec;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
976 private final int value;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
977
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
978 public BitKey(BitSpec spec, int value) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
979 super();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
980 this.spec = spec;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
981 this.value = value;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
982 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
983
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
984 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
985 public String toString() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
986 return String.format("BitKey %s=%s", spec, value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
987 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
988 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
989
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
990 /**
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
991 * Represents a prefix tree of {@link BitSpec} objects to find the most accurate SPARCOp.
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
992 */
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
993 public static class BitKeyIndex {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
994 private final BitSpec spec;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
995 private final Map<Integer, BitKeyIndex> nodes;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
996 private SPARCOp op;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
997
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
998 public BitKeyIndex(SPARCOp op) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
999 assert op != null;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1000 this.op = op;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1001 this.nodes = null;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1002 this.spec = null;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1003 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1004
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1005 public BitKeyIndex(BitSpec spec) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1006 assert spec != null;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1007 this.op = null;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1008 this.nodes = new HashMap<>(4);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1009 this.spec = spec;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1010 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1011
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1012 /**
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1013 * Adds operation to the index.
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1014 *
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1015 * @param keys Ordered by the importance
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1016 * @param operation Operation represented by this list of keys
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1017 */
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1018 private void addOp(List<BitKey> keys, SPARCOp operation) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1019 assert keys.size() > 0;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1020 BitKey first = keys.get(0);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1021 assert first.spec.equals(spec) : first.spec + " " + spec;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1022 BitKeyIndex node;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1023 if (keys.size() == 1) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1024 if (nodes.containsKey(first.value)) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1025 node = nodes.get(first.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1026 assert node.op == null : node + " " + keys;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1027 node.op = operation;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1028 } else {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1029 assert !nodes.containsKey(first.value) : "Index must be unique. Existing key: " + nodes.get(first.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1030 node = new BitKeyIndex(operation);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1031 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1032 } else {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1033 node = nodes.get(first.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1034 if (node == null) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1035 node = new BitKeyIndex(keys.get(1).spec);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1036 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1037 node.addOp(keys.subList(1, keys.size()), operation);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1038 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1039 nodes.put(first.value, node);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1040 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1041
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1042 /**
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1043 * Finds the best matching {@link SPARCOp} for this instruction.
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1044 */
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1045 public SPARCOp find(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1046 if (nodes != null) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1047 int key = spec.getBits(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1048 BitKeyIndex sub = nodes.get(key);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1049 if (sub == null) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1050 if (op != null) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1051 return op;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1052 } else {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1053 throw new RuntimeException(String.format("%s 0x%x, 0x%x %s", spec, inst, key, nodes));
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1054 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1055 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1056 return sub.find(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1057 } else {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1058 return this.op;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1059 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1060 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1061
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1062 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1063 public String toString() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1064 return this.op == null ? this.spec + ": " + this.nodes : this.op.toString();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1065 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1066 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1067
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1068 public static final Bpcc BPCC = new Bpcc(Op2s.Bp);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1069 public static final Bpcc FBPCC = new Bpcc(Op2s.Fbp);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1070 public static final CBCond CBCOND = new CBCond();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1071 public static final Bpr BPR = new Bpr();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1072 public static final Br BR = new Br();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1073 public static final Sethi SETHI = new Sethi();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1074 public static final Op3Op OP3 = new Op3Op();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1075 public static final SPARCOp LDST = new SPARCOp(Ops.LdstOp);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1076 public static final SPARCOp BRANCH = new SPARCOp(Ops.BranchOp);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1077 public static final SPARCOp CALL = new SPARCOp(Ops.CallOp);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1078 private static final BitKeyIndex INDEX = new BitKeyIndex(BitSpec.op);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1079
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1080 static {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1081 for (SPARCOp op : SPARCOp.OPS) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1082 INDEX.addOp(op.getKeys(), op);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1083 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1084 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1085
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1086 public static SPARCOp getSPARCOp(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1087 return INDEX.find(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1088 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1089
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1090 /**
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1091 * Represents a class of SPARC instruction and gives methods to modify its fields.
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1092 */
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1093 public static class SPARCOp {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1094 private final Ops op;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1095 private final BitKey opKey;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1096 private List<BitKey> keyFields;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1097 private static final List<SPARCOp> OPS = new ArrayList<>();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1098
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1099 public SPARCOp(Ops op) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1100 super();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1101 this.op = op;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1102 this.opKey = new BitKey(BitSpec.op, op.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1103 OPS.add(this);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1104 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1105
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1106 protected int setBits(int word) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1107 return BitSpec.op.setBits(word, op.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1108 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1109
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1110 public boolean match(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1111 for (BitKey k : keyFields) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1112 if (k.spec.getBits(inst) != k.value) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1113 return false;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1114 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1115 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1116 return true;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1117 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1118
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1119 protected List<BitKey> getKeys() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1120 if (keyFields == null) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1121 keyFields = new ArrayList<>(4);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1122 keyFields.add(opKey);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1123 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1124 return keyFields;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1125 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1126
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1127 public Ops getOp(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1128 return SPARCAssembler.OPS[BitSpec.op.getBits(inst)];
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1129 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1130
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1131 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1132 public String toString() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1133 String name = getClass().getName();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1134 name = name.substring(name.lastIndexOf(".") + 1);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1135 return name + "[op: " + op + "]";
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1136 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1137 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1138
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1139 /**
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1140 * Base class for control transfer operations; provides access to the disp field.
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1141 */
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1142 public abstract static class ControlTransferOp extends SPARCOp {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1143 private final Op2s op2;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1144 private final boolean delaySlot;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1145 private final BitSpec disp;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1146 private final BitKey op2Key;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1147
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1148 private ControlTransferOp(Ops op, Op2s op2, boolean delaySlot, BitSpec disp) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1149 super(op);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1150 this.op2 = op2;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1151 this.delaySlot = delaySlot;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1152 this.disp = disp;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1153 this.op2Key = new BitKey(BitSpec.op2, op2.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1154 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1155
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1156 public boolean hasDelaySlot() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1157 return delaySlot;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1158 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1159
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1160 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1161 protected int setBits(int word) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1162 return BitSpec.op2.setBits(super.setBits(word), op2.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1163 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1164
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1165 protected int setDisp(int inst, SPARCMacroAssembler masm, Label lab) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1166 if (lab.isBound()) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1167 int d = (lab.position() - masm.position()) / 4;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1168 return setDisp(inst, d);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1169 } else {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1170 masm.patchUnbound(lab);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1171 return inst;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1172 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1173 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1174
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1175 public int setDisp(int inst, int d) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1176 assert this.match(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1177 return this.disp.setBits(inst, d);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1178 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1179
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1180 public boolean isValidDisp(int d) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1181 return this.disp.valueFits(d);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1182 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1183
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1184 public int setAnnul(int inst, boolean a) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1185 return BitSpec.a.setBits(inst, a ? 1 : 0);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1186 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1187
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1188 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1189 protected List<BitKey> getKeys() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1190 List<BitKey> keys = super.getKeys();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1191 keys.add(op2Key);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1192 return keys;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1193 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1194
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1195 public int getDisp(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1196 return this.disp.getBits(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1197 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1198
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1199 public abstract boolean isAnnulable(int inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1200
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1201 public abstract boolean isConditional(int inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1202 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1203
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1204 public static class Bpcc extends ControlTransferOp {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1205 public Bpcc(Op2s op2) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1206 super(Ops.BranchOp, op2, true, BitSpec.disp19);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1207 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1208
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1209 public void emit(SPARCMacroAssembler masm, CC cc, ConditionFlag cf, Annul annul, BranchPredict p, Label lab) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1210 int inst = setBits(0);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1211 inst = BitSpec.a.setBits(inst, annul.flag);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1212 inst = BitSpec.cond.setBits(inst, cf.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1213 inst = BitSpec.cc.setBits(inst, cc.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1214 inst = BitSpec.p.setBits(inst, p.flag);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1215 masm.emitInt(setDisp(inst, masm, lab));
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1216 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1217
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1218 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1219 public boolean isAnnulable(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1220 return isConditional(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1221 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1222
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1223 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1224 public boolean isConditional(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1225 int cond = BitSpec.cond.getBits(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1226 return cond != ConditionFlag.Always.value && cond != ConditionFlag.Never.value;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1227 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1228 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1229
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1230 public static class Br extends ControlTransferOp {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1231 public Br() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1232 super(Ops.BranchOp, Op2s.Br, true, BitSpec.disp22);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1233 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1234
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1235 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1236 public boolean isAnnulable(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1237 return isConditional(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1238 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1239
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1240 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1241 public boolean isConditional(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1242 int cond = BitSpec.cond.getBits(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1243 return cond != ConditionFlag.Always.value && cond != ConditionFlag.Never.value;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1244 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1245 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1246
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1247 public static class Bpr extends ControlTransferOp {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1248 private static final BitKey CBCOND_KEY = new BitKey(BitSpec.cbcond, 0);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1249
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1250 public Bpr() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1251 super(Ops.BranchOp, Op2s.Bpr, true, BitSpec.d16);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1252 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1253
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1254 public void emit(SPARCMacroAssembler masm, RCondition rcond, Annul a, BranchPredict p, Register rs1, Label lab) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1255 int inst = setBits(0);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1256 inst = BitSpec.rcond.setBits(inst, rcond.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1257 inst = BitSpec.a.setBits(inst, a.flag);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1258 inst = BitSpec.p.setBits(inst, p.flag);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1259 inst = BitSpec.rs1.setBits(inst, rs1.encoding);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1260 masm.emitInt(setDisp(inst, masm, lab));
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1261 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1262
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1263 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1264 protected List<BitKey> getKeys() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1265 List<BitKey> keys = super.getKeys();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1266 keys.add(CBCOND_KEY);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1267 return keys;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1268 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1269
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1270 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1271 public boolean isAnnulable(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1272 return isConditional(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1273 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1274
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1275 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1276 public boolean isConditional(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1277 int cond = BitSpec.cond.getBits(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1278 return cond != ConditionFlag.Always.value && cond != ConditionFlag.Never.value;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1279 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1280 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1281
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1282 public static final class CBCond extends ControlTransferOp {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1283 private static final BitKey CBCOND_KEY = new BitKey(BitSpec.cbcond, 1);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1284
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1285 private CBCond() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1286 super(Ops.BranchOp, Op2s.Bpr, false, BitSpec.d10);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1287 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1288
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1289 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1290 protected List<BitKey> getKeys() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1291 List<BitKey> keys = super.getKeys();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1292 keys.add(CBCOND_KEY);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1293 return keys;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1294 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1295
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1296 public void emit(SPARCMacroAssembler masm, ConditionFlag cf, boolean cc2, Register rs1, Register rs2, Label lab) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1297 int inst = setBits(0, cf, cc2, rs1);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1298 inst = BitSpec.rs2.setBits(inst, rs2.encoding);
22412
9961439fc100 [SPARC] Consolidate compareBranch into SPARCMacroAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22410
diff changeset
1299 inst = BitSpec.i.setBits(inst, 0);
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1300 emit(masm, lab, inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1301 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1302
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1303 public void emit(SPARCMacroAssembler masm, ConditionFlag cf, boolean cc2, Register rs1, int simm5, Label lab) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1304 int inst = setBits(0, cf, cc2, rs1);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1305 inst = BitSpec.simm5.setBits(inst, simm5);
22412
9961439fc100 [SPARC] Consolidate compareBranch into SPARCMacroAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22410
diff changeset
1306 inst = BitSpec.i.setBits(inst, 1);
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1307 emit(masm, lab, inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1308 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1309
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1310 private void emit(SPARCMacroAssembler masm, Label lab, int baseInst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1311 int inst = baseInst;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1312 masm.insertNopAfterCBCond();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1313 masm.emitInt(setDisp(inst, masm, lab));
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1314 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1315
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1316 private int setBits(int base, ConditionFlag cf, boolean cc2, Register rs1) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1317 int inst = super.setBits(base);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1318 inst = BitSpec.rs1.setBits(inst, rs1.encoding);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1319 inst = BitSpec.cc2.setBits(inst, cc2 ? 1 : 0);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1320 inst = BitSpec.c.setBits(inst, cf.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1321 return BitSpec.cbcond.setBits(inst, 1);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1322 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1323
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1324 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1325 public boolean isAnnulable(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1326 return false;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1327 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1328
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1329 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1330 public boolean isConditional(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1331 return true;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1332 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1333 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1334
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1335 public static class Op2Op extends SPARCOp {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1336 private final Op2s op2;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1337 private final BitKey op2Key;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1338
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1339 public Op2Op(Ops op, Op2s op2) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1340 super(op);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1341 this.op2 = op2;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1342 op2Key = new BitKey(BitSpec.op2, op2.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1343 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1344
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1345 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1346 protected int setBits(int word) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1347 int result = super.setBits(word);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1348 return BitSpec.op2.setBits(result, op2.value);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1349 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1350
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1351 @Override
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1352 protected List<BitKey> getKeys() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1353 List<BitKey> keys = super.getKeys();
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1354 keys.add(op2Key);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1355 return keys;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1356 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1357 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1358
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1359 public static class Sethi extends Op2Op {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1360 public Sethi() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1361 super(Ops.BranchOp, Op2s.Sethi);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1362 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1363
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1364 public Register getRS1(int word) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1365 int regNum = BitSpec.rs1.getBits(word);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1366 return SPARC.cpuRegisters[regNum];
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1367 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1368
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1369 public int getImm22(int word) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1370 return BitSpec.imm22.getBits(word);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1371 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1372
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1373 public boolean isNop(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1374 return getRS1(inst).equals(g0) && getImm22(inst) == 0;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1375 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1376 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1377
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1378 public static class Op3Op extends SPARCOp {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1379 public Op3Op() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1380 super(ArithOp);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1381 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1382
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1383 public Op3s getOp3(int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1384 assert match(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1385 return OP3S[ArithOp.value & 1][BitSpec.op3.getBits(inst)];
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1386 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1387 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1388
17144
44a96c7413a7 [SPARC] Gearing up with CBcond instruction
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17117
diff changeset
1389 public boolean hasFeature(CPUFeature feature) {
44a96c7413a7 [SPARC] Gearing up with CBcond instruction
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17117
diff changeset
1390 return ((SPARC) this.target.arch).features.contains(feature);
44a96c7413a7 [SPARC] Gearing up with CBcond instruction
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17117
diff changeset
1391 }
44a96c7413a7 [SPARC] Gearing up with CBcond instruction
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17117
diff changeset
1392
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1393 public static final int simm(int x, int nbits) {
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1394 // assert_signed_range(x, nbits);
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1395 return x & ((1 << nbits) - 1);
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1396 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1397
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1398 public static final boolean isImm(int x, int nbits) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1399 // assert_signed_range(x, nbits);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1400 return simm(x, nbits) == x;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1401 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1402
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1403 /**
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1404 * Minimum value for signed immediate ranges.
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1405 */
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1406 public static long minSimm(long nbits) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1407 return -(1L << (nbits - 1));
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1408 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1409
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1410 /**
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1411 * Maximum value for signed immediate ranges.
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1412 */
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1413 public static long maxSimm(long nbits) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1414 return (1L << (nbits - 1)) - 1;
9831
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
1415 }
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
1416
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1417 /**
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1418 * Test if imm is within signed immediate range for nbits.
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1419 */
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1420 public static boolean isSimm(long imm, int nbits) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1421 return minSimm(nbits) <= imm && imm <= maxSimm(nbits);
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1422 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1423
17164
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
1424 public static boolean isSimm10(long imm) {
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
1425 return isSimm(imm, 10);
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
1426 }
5ecd1f298c64 [SPARC] Fix few issues (sign extension) on CBcond instructions, and one typo
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17144
diff changeset
1427
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
1428 public static boolean isSimm11(long imm) {
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
1429 return isSimm(imm, 11);
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
1430 }
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
1431
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18163
diff changeset
1432 public static boolean isSimm11(JavaConstant constant) {
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
1433 return constant.isNull() || isSimm11(constant.asLong());
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
1434 }
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
1435
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18163
diff changeset
1436 public static boolean isSimm5(JavaConstant constant) {
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
1437 return constant.isNull() || isSimm(constant.asLong(), 5);
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
1438 }
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
1439
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1440 public static boolean isSimm13(int imm) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1441 return isSimm(imm, 13);
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1442 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1443
21022
b4b103d7f46f [SPARC] Fix performance regression with CBcond; Do not use short branch, when constant fits into simm13 but not in simm5
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20968
diff changeset
1444 public static boolean isSimm13(JavaConstant constant) {
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1445 long bits;
22604
b00cc0475f31 Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22469
diff changeset
1446 switch (constant.getJavaKind()) {
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1447 case Double:
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1448 bits = Double.doubleToRawLongBits(constant.asDouble());
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1449 break;
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1450 case Float:
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1451 bits = Float.floatToRawIntBits(constant.asFloat());
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1452 break;
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1453 case Object:
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1454 return JavaConstant.NULL_POINTER.equals(constant);
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1455 default:
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1456 bits = constant.asLong();
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1457 break;
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1458 }
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
1459 return constant.isNull() || isSimm13(bits);
21022
b4b103d7f46f [SPARC] Fix performance regression with CBcond; Do not use short branch, when constant fits into simm13 but not in simm5
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20968
diff changeset
1460 }
b4b103d7f46f [SPARC] Fix performance regression with CBcond; Do not use short branch, when constant fits into simm13 but not in simm5
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20968
diff changeset
1461
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1462 public static boolean isSimm13(long imm) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1463 return NumUtil.isInt(imm) && isSimm(imm, 13);
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1464 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1465
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1466 public static boolean isWordDisp30(long imm) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
1467 return isSimm(imm, 30 + 2);
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
1468 }
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
1469
9831
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
1470 public static final int hi22(int x) {
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
1471 return x >>> 10;
9831
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
1472 }
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
1473
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
1474 public static final int lo10(int x) {
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
1475 return x & ((1 << 10) - 1);
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
1476 }
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
1477
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1478 // @formatter:off
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1479 /**
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1480 * Instruction format for Fmt00 instructions. This abstraction is needed as it
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1481 * makes the patching easier later on.
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1482 * <pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1483 * | 00 | a | op2 | b |
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1484 * |31 30|29 25|24 22|21 0|
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1485 * </pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1486 */
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1487 // @formatter:on
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1488 protected void fmt00(int a, int op2, int b) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1489 assert isImm(a, 5) && isImm(op2, 3) && isImm(b, 22) : String.format("a: 0x%x op2: 0x%x b: 0x%x", a, op2, b);
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1490 int word = 0;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1491 BitSpec.op.setBits(word, 0);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1492 BitSpec.rd.setBits(word, a);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1493 BitSpec.op2.setBits(word, op2);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1494 BitSpec.imm22.setBits(word, b);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1495 emitInt(a << 25 | op2 << 22 | b);
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1496 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1497
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1498 private void op3(Op3s op3, Opfs opf, Register rs1, Register rs2, Register rd) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1499 int b = opf.value << 5 | (rs2 == null ? 0 : rs2.encoding);
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
1500 fmt(op3.op.value, rd.encoding, op3.value, rs1 == null ? 0 : rs1.encoding, b);
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1501 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1502
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1503 protected void op3(Op3s op3, Register rs1, Register rs2, Register rd) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1504 int b = rs2 == null ? 0 : rs2.encoding;
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1505 int xBit = getXBit(op3);
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
1506 fmt(op3.op.value, rd.encoding, op3.value, rs1 == null ? 0 : rs1.encoding, b | xBit);
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1507 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1508
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1509 protected void op3(Op3s op3, Register rs1, int simm13, Register rd) {
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
1510 assert isSimm13(simm13) : simm13;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1511 int i = 1 << 13;
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1512 int simm13WithX = simm13 | getXBit(op3);
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
1513 fmt(op3.op.value, rd.encoding, op3.value, rs1.encoding, i | simm13WithX & ((1 << 13) - 1));
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1514 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1515
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1516 // @formatter:off
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1517 /**
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1518 * Branch on Integer Condition Codes.
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1519 * <pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1520 * | 00 |annul| cond| 010 | disp22 |
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1521 * |31 30|29 |28 25|24 22|21 0|
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1522 * </pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1523 */
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1524 // @formatter:on
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1525 public void bicc(ConditionFlag cond, Annul annul, Label l) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1526 bcc(Op2s.Br, cond, annul, l);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1527 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1528
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1529 // @formatter:off
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1530 /**
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1531 * Branch on Floating-Point Condition Codes.
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1532 * <pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1533 * | 00 |annul| cond| 110 | disp22 |
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1534 * |31 30|29 |28 25|24 22|21 0|
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1535 * </pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1536 */
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1537 // @formatter:on
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1538 public void fbcc(ConditionFlag cond, Annul annul, Label l) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1539 bcc(Op2s.Fb, cond, annul, l);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1540 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1541
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1542 // @formatter:off
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1543 /**
19685
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19684
diff changeset
1544 * Branch on (Integer|Floatingpoint) Condition Codes.
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1545 * <pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1546 * | 00 |annul| cond| op2 | disp22 |
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1547 * |31 30|29 |28 25|24 22|21 0|
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1548 * </pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1549 */
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1550 // @formatter:on
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1551 private void bcc(Op2s op2, ConditionFlag cond, Annul annul, Label l) {
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1552 insertNopAfterCBCond();
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1553 int pos = !l.isBound() ? patchUnbound(l) : (l.position() - position()) / 4;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1554 final int disp = 22;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1555 assert isSimm(pos, disp);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1556 pos &= (1 << disp) - 1;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1557 int a = (annul.flag << 4) | cond.getValue();
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1558 fmt00(a, op2.getValue(), pos);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1559 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1560
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1561 public void insertNopAfterCBCond() {
22131
6b4469fe86c9 [SPARC] Use correct position in SPARCAssembler.insertNopAfterCBCond
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22126
diff changeset
1562 int pos = position() - INSTRUCTION_SIZE;
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1563 if (pos == 0) {
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1564 return;
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1565 }
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1566 int inst = getInt(pos);
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1567 if (isCBCond(inst)) {
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1568 nop();
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1569 }
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1570 }
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1571
22133
dd52addb374d [SPARC] Remove duplicate/unused code from SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22131
diff changeset
1572 protected static boolean isCBCond(int inst) {
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1573 return isOp2(Ops.BranchOp, Op2s.Bpr, inst) && getBits(inst, 28, 28) == 1;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1574 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1575
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1576 private static boolean isOp2(Ops ops, Op2s op2s, int inst) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1577 return getOp(inst).equals(ops) && getOp2(inst).equals(op2s);
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1578 }
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1579
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1580 private static Ops getOp(int inst) {
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1581 return OPS[getBits(inst, 31, 30)];
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1582 }
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1583
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1584 private static Op2s getOp2(int inst) {
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1585 return OP2S[getBits(inst, 24, 22)];
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1586 }
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1587
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1588 public static int getBits(int inst, int hiBit, int lowBit) {
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1589 return (inst >> lowBit) & ((1 << (hiBit - lowBit + 1)) - 1);
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1590 }
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1591
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1592 // @formatter:off
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1593 /**
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1594 * Branch on Integer Condition Codes with Prediction.
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1595 * <pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1596 * | 00 |an|cond | 001 |cc1 2|p | disp19 |
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1597 * |31 30|29|28 25|24 22|21 20|19| 0|
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1598 * </pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1599 */
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1600 // @formatter:on
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1601 public void bpcc(ConditionFlag cond, Annul annul, Label l, CC cc, BranchPredict predictTaken) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1602 bpcc(Op2s.Bp, cond, annul, l, cc, predictTaken);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1603 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1604
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1605 // @formatter:off
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1606 /**
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1607 * Branch on Integer Condition Codes with Prediction.
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1608 * <pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1609 * | 00 |an|cond | 101 |cc1 2|p | disp19 |
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1610 * |31 30|29|28 25|24 22|21 20|19| 0|
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1611 * </pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1612 */
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1613 // @formatter:on
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1614 public void fbpcc(ConditionFlag cond, Annul annul, Label l, CC cc, BranchPredict predictTaken) {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1615 bpcc(Op2s.Fbp, cond, annul, l, cc, predictTaken);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1616 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1617
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1618 // @formatter:off
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1619 /**
19685
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19684
diff changeset
1620 * Used for fbpcc (Float) and bpcc (Integer).
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1621 * <pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1622 * | 00 |an|cond | op2 |cc1 2|p | disp19 |
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1623 * |31 30|29|28 25|24 22|21 20|19| 0|
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1624 * </pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1625 */
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1626 // @formatter:on
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1627 private void bpcc(Op2s op2, ConditionFlag cond, Annul annul, Label l, CC cc, BranchPredict predictTaken) {
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1628 insertNopAfterCBCond();
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1629 int pos = !l.isBound() ? patchUnbound(l) : (l.position() - position()) / 4;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1630 final int disp = 19;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1631 assert isSimm(pos, disp);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1632 pos &= (1 << disp) - 1;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1633 int a = (annul.flag << 4) | cond.getValue();
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1634 int b = (cc.getValue() << 20) | ((predictTaken.flag) << 19) | pos;
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1635 delaySlotOptimizationPoints.add(position());
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1636 fmt00(a, op2.getValue(), b);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1637 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1638
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1639 // @formatter:off
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1640 /**
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1641 * Branch on Integer Register with Prediction.
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1642 * <pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1643 * | 00 |an| 0|rcond | 011 |d16hi|p | rs1 | d16lo |
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1644 * |31 30|29|28|27 25 |24 22|21 20|19|18 14| 0|
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1645 * </pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1646 */
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1647 // @formatter:on
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1648 public void bpr(RCondition cond, Annul annul, Label l, BranchPredict predictTaken, Register rs1) {
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1649 insertNopAfterCBCond();
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1650 int pos = !l.isBound() ? patchUnbound(l) : (l.position() - position()) / 4;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1651 final int disp = 16;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1652 assert isSimm(pos, disp);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1653 pos &= (1 << disp) - 1;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1654 int a = (annul.flag << 4) | cond.getValue();
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1655 int d16hi = (pos >> 13) << 13;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1656 int d16lo = d16hi ^ pos;
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1657 int b = (d16hi << 20) | (predictTaken.flag << 19) | (rs1.encoding() << 14) | d16lo;
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1658 delaySlotOptimizationPoints.add(position());
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1659 fmt00(a, Op2s.Bpr.getValue(), b);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1660 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1661
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1662 protected int patchUnbound(Label label) {
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1663 label.addPatchAt(position());
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1664 return 0;
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1665 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1666
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1667 // @formatter:off
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1668 /**
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1669 * NOP.
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1670 * <pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1671 * | 00 |00000| 100 | 0 |
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1672 * |31 30|29 25|24 22|21 0|
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1673 * </pre>
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1674 */
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1675 // @formatter:on
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1676 public void nop() {
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1677 emitInt(1 << 24);
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1678 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1679
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1680 public void sethi(int imm22, Register dst) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1681 fmt00(dst.encoding, Op2s.Sethi.value, imm22);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1682 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1683
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1684 // @formatter:off
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1685 /**
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1686 * Instruction format for calls.
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1687 * <pre>
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1688 * | 01 | disp30 |
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1689 * |31 30|29 0|
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1690 * </pre>
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1691 *
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1692 * @return Position of the call instruction
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1693 */
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1694 // @formatter:on
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1695 public int call(int disp30) {
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1696 assert isImm(disp30, 30);
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1697 insertNopAfterCBCond();
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1698 int before = position();
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1699 int instr = 1 << 30;
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1700 instr |= disp30;
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
1701 emitInt(instr);
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1702 return before;
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1703 }
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18844
diff changeset
1704
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1705 public void add(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1706 op3(Add, rs1, rs2, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1707 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
1708
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1709 public void add(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1710 op3(Add, rs1, simm13, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1711 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
1712
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1713 public void addc(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1714 op3(Addc, rs1, rs2, rd);
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
1715 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
1716
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1717 public void addc(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1718 op3(Addc, rs1, simm13, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1719 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1720
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1721 public void addcc(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1722 op3(Addcc, rs1, rs2, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1723 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
1724
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1725 public void addcc(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1726 op3(Addcc, rs1, simm13, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1727 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
1728
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1729 public void and(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1730 op3(And, rs1, rs2, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1731 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
1732
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1733 public void and(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1734 op3(And, rs1, simm13, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1735 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
1736
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1737 public void andcc(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1738 op3(Andcc, rs1, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1739 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1740
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1741 public void andcc(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1742 op3(Andcc, rs1, simm13, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1743 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
1744
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1745 public void andn(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1746 op3(Andn, rs1, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1747 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1748
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1749 public void andn(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1750 op3(Andn, rs1, simm13, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1751 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1752
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1753 public void andncc(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1754 op3(Andncc, rs1, rs2, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1755 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
1756
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1757 public void andncc(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1758 op3(Andncc, rs1, simm13, rd);
16319
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
1759 }
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
1760
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1761 public void movwtos(Register rs2, Register rd) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
1762 assert isSingleFloatRegister(rd) && isCPURegister(rs2) : String.format("%s %s", rs2, rd);
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1763 op3(Impdep1, Movwtos, null, rs2, rd);
16927
949347518b66 [SPARC] new vis3 instruction umulxhi
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16651
diff changeset
1764 }
949347518b66 [SPARC] new vis3 instruction umulxhi
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16651
diff changeset
1765
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1766 public void umulxhi(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1767 op3(Impdep1, UMulxhi, rs1, rs2, rd);
16319
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
1768 }
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
1769
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1770 public void fdtos(Register rs2, Register rd) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
1771 assert isSingleFloatRegister(rd) && isDoubleFloatRegister(rs2) : String.format("%s %s", rs2, rd);
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1772 op3(Fpop1, Fdtos, null, rs2, rd);
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1773 }
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1774
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1775 public void movstouw(Register rs2, Register rd) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
1776 assert isSingleFloatRegister(rs2) && isCPURegister(rd) : String.format("%s %s", rs2, rd);
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1777 op3(Impdep1, Movstosw, null, rs2, rd);
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1778 }
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1779
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1780 public void movstosw(Register rs2, Register rd) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
1781 assert isSingleFloatRegister(rs2) && isCPURegister(rd) : String.format("%s %s", rs2, rd);
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1782 op3(Impdep1, Movstosw, null, rs2, rd);
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1783 }
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1784
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1785 public void movdtox(Register rs2, Register rd) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
1786 assert isDoubleFloatRegister(rs2) && isCPURegister(rd) : String.format("%s %s", rs2, rd);
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1787 op3(Impdep1, Movdtox, null, rs2, rd);
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1788 }
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1789
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1790 public void movxtod(Register rs2, Register rd) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
1791 assert isCPURegister(rs2) && isDoubleFloatRegister(rd) : String.format("%s %s", rs2, rd);
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1792 op3(Impdep1, Movxtod, null, rs2, rd);
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
1793 }
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
1794
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1795 public void fadds(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1796 op3(Fpop1, Fadds, rs1, rs2, rd);
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
1797 }
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
1798
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1799 public void faddd(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1800 op3(Fpop1, Faddd, rs1, rs2, rd);
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
1801 }
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
1802
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1803 public void faddq(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1804 op3(Fpop1, Faddq, rs1, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1805 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1806
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1807 public void fdivs(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1808 op3(Fpop1, Fdivs, rs1, rs2, rd);
9825
81d5d8089cda SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9817
diff changeset
1809 }
81d5d8089cda SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9817
diff changeset
1810
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1811 public void fdivd(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1812 op3(Fpop1, Fdivd, rs1, rs2, rd);
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
1813 }
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
1814
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1815 public void fmovs(Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1816 op3(Fpop1, Fmovs, null, rs2, rd);
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
1817 }
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
1818
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1819 public void fmovd(Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1820 op3(Fpop1, Fmovd, null, rs2, rd);
16933
f011bf910f34 [SPARC] Fix sign extension, add debug messages to assertions in Assembler, add FSMULD , Entering frame is now possible with > 2k framesize
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16927
diff changeset
1821 }
f011bf910f34 [SPARC] Fix sign extension, add debug messages to assertions in Assembler, add FSMULD , Entering frame is now possible with > 2k framesize
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16927
diff changeset
1822
22160
0be1cc9089de [SPARC] Use FSRC2(d|s) instead of FMOV(d|s)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22133
diff changeset
1823 public void fsrc2s(Register rs2, Register rd) {
0be1cc9089de [SPARC] Use FSRC2(d|s) instead of FMOV(d|s)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22133
diff changeset
1824 op3(Impdep1, Fsrc2s, null, rs2, rd);
0be1cc9089de [SPARC] Use FSRC2(d|s) instead of FMOV(d|s)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22133
diff changeset
1825 }
0be1cc9089de [SPARC] Use FSRC2(d|s) instead of FMOV(d|s)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22133
diff changeset
1826
0be1cc9089de [SPARC] Use FSRC2(d|s) instead of FMOV(d|s)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22133
diff changeset
1827 public void fsrc2d(Register rs2, Register rd) {
0be1cc9089de [SPARC] Use FSRC2(d|s) instead of FMOV(d|s)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22133
diff changeset
1828 op3(Impdep1, Fsrc2d, null, rs2, rd);
0be1cc9089de [SPARC] Use FSRC2(d|s) instead of FMOV(d|s)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22133
diff changeset
1829 }
0be1cc9089de [SPARC] Use FSRC2(d|s) instead of FMOV(d|s)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22133
diff changeset
1830
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1831 public void fmuls(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1832 op3(Fpop1, Fmuls, rs1, rs2, rd);
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1833 }
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1834
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1835 public void fsmuld(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1836 op3(Fpop1, Fsmuld, rs1, rs2, rd);
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1837 }
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1838
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1839 public void fmuld(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1840 op3(Fpop1, Fmuld, rs1, rs2, rd);
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1841 }
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1842
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1843 public void fnegs(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1844 op3(Fpop1, Fnegs, null, rs2, rd);
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1845 }
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1846
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1847 public void fnegd(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1848 op3(Fpop1, Fnegd, null, rs2, rd);
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1849 }
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1850
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1851 /**
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1852 * Helper method to determine if the instruction needs the X bit set.
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1853 */
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1854 private static int getXBit(Op3s op3) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1855 switch (op3) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1856 case Sllx:
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1857 case Srax:
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1858 case Srlx:
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1859 return 1 << 12;
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1860 default:
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1861 return 0;
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1862 }
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1863 }
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1864
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1865 public void fstoi(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1866 op3(Fpop1, Fstoi, null, rs2, rd);
9817
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
1867 }
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
1868
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1869 public void fstox(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1870 op3(Fpop1, Fstox, null, rs2, rd);
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1871 }
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1872
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1873 public void fdtox(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1874 op3(Fpop1, Fdtox, null, rs2, rd);
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1875 }
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1876
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1877 public void fstod(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1878 op3(Fpop1, Fstod, null, rs2, rd);
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1879 }
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1880
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1881 public void fdtoi(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1882 op3(Fpop1, Fdtoi, null, rs2, rd);
16319
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
1883 }
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
1884
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1885 public void fitos(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1886 op3(Fpop1, Fitos, null, rs2, rd);
9817
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
1887 }
26960d32552c SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9816
diff changeset
1888
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1889 public void fitod(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1890 op3(Fpop1, Fitod, null, rs2, rd);
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1891 }
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1892
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1893 public void fxtos(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1894 op3(Fpop1, Fxtos, null, rs2, rd);
16315
b955d649fca8 Fixing BC_i2f, BC_i2c, BC_fadd
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16313
diff changeset
1895 }
b955d649fca8 Fixing BC_i2f, BC_i2c, BC_fadd
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16313
diff changeset
1896
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1897 public void fxtod(Register rs2, Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1898 op3(Fpop1, Fxtod, null, rs2, rd);
16319
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
1899 }
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
1900
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1901 public void fzeros(Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1902 op3(Impdep1, Fzeros, null, null, rd);
17082
f8586d059f9d [SPARC] make compatible for CPU without VIS3 and do some cleanup
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17029
diff changeset
1903 }
f8586d059f9d [SPARC] make compatible for CPU without VIS3 and do some cleanup
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17029
diff changeset
1904
19680
4be296f6eeac [SPARC] Change part of the fpop assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19679
diff changeset
1905 public void fzerod(Register rd) {
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1906 op3(Impdep1, Fzerod, null, null, rd);
16319
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
1907 }
a4bd33d52985 Fixing tests with number conversions, float and double handling. Introducing new VIS3 instructions. Adding testcases.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16317
diff changeset
1908
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1909 public void flushw() {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1910 op3(Flushw, g0, g0, g0);
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1911 }
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1912
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1913 public void fsqrtd(Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1914 op3(Fpop1, Fsqrtd, null, rs2, rd);
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1915 }
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1916
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1917 public void fsqrts(Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1918 op3(Fpop1, Fsqrts, null, rs2, rd);
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1919 }
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1920
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1921 public void fabss(Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1922 op3(Fpop1, Fabss, null, rs2, rd);
17117
d980377abc6f [SPARC] MathIntrinsic for sqrt and abs
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17116
diff changeset
1923 }
d980377abc6f [SPARC] MathIntrinsic for sqrt and abs
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17116
diff changeset
1924
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1925 public void fabsd(Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1926 op3(Fpop1, Fabsd, null, rs2, rd);
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1927 }
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1928
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1929 public void fsubs(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1930 op3(Fpop1, Fsubs, rs1, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1931 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
1932
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1933 public void fsubd(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1934 op3(Fpop1, Fsubd, rs1, rs2, rd);
10564
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1935 }
1b864a1552e0 SPARCAssembler Fmt3p upgrade
Morris Meyer <morris.meyer@oracle.com>
parents: 10468
diff changeset
1936
19679
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1937 // @formatter:off
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1938 /**
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1939 * Instruction format for fcmp.
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1940 * <pre>
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1941 * | 10 | --- |cc1|cc0|desc | rs1 | opf | rs2 |
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1942 * |31 30|29 27|26 |25 |24 19|18 14|13 5|4 0|
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1943 * </pre>
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1944 */
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1945 // @formatter:on
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1946 public void fcmp(CC cc, Opfs opf, Register rs1, Register rs2) {
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1947 int a = cc.value;
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1948 int b = opf.value << 5 | rs2.encoding;
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
1949 delaySlotOptimizationPoints.add(position());
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
1950 fmt10(a, Fcmp.value, rs1.encoding, b);
19679
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1951 }
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1952
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1953 // @formatter:off
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1954 /**
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1955 * Instruction format for most arithmetic stuff.
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1956 * <pre>
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1957 * | 10 | rd | op3 | rs1 | b |
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1958 * |31 30|29 25|24 19|18 14|13 0|
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1959 * </pre>
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1960 */
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1961 // @formatter:on
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1962 protected void fmt10(int rd, int op3, int rs1, int b) {
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1963 fmt(0b10, rd, op3, rs1, b);
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1964 }
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1965
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1966 // @formatter:off
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1967 /**
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1968 * Instruction format for most arithmetic stuff.
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1969 * <pre>
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1970 * | op | rd | op3 | rs1 | b |
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1971 * |31 30|29 25|24 19|18 14|13 0|
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1972 * </pre>
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1973 */
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1974 // @formatter:on
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1975 protected void fmt(int op, int rd, int op3, int rs1, int b) {
19679
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1976 assert isImm(rd, 5) && isImm(op3, 6) && isImm(b, 14) : String.format("rd: 0x%x op3: 0x%x b: 0x%x", rd, op3, b);
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
1977 int instr = op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | b;
19679
b1b887938753 [SPARC] Change fcmp
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19678
diff changeset
1978 emitInt(instr);
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1979 }
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16319
diff changeset
1980
19677
7d3afd4356a2 [SPARC] Remove all object oriented fmt00 instructions (sethi, nop, cbcond) and use simple function calls
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19675
diff changeset
1981 public void illtrap(int const22) {
7d3afd4356a2 [SPARC] Remove all object oriented fmt00 instructions (sethi, nop, cbcond) and use simple function calls
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19675
diff changeset
1982 fmt00(0, Op2s.Illtrap.value, const22);
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
1983 }
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
1984
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1985 public void jmpl(Register rs1, Register rs2, Register rd) {
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1986 insertNopAfterCBCond();
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1987 op3(Jmpl, rs1, rs2, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1988 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
1989
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1990 /**
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1991 * @return Position of the jmpl instruction
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1992 */
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1993 public int jmpl(Register rs1, int simm13, Register rd) {
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1994 insertNopAfterCBCond();
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1995 int before = position();
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
1996 op3(Jmpl, rs1, simm13, rd);
22126
5f622eadfa5b [SPARC] Put nop after cbcond only for following branch/call instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
1997 return before;
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9843
diff changeset
1998 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9843
diff changeset
1999
19683
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2000 public void fmovdcc(ConditionFlag cond, CC cc, Register rs2, Register rd) {
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2001 fmovcc(cond, cc, rs2, rd, Fmovdcc.value);
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2002 }
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
2003
19683
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2004 public void fmovscc(ConditionFlag cond, CC cc, Register rs2, Register rd) {
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2005 fmovcc(cond, cc, rs2, rd, Fmovscc.value);
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2006 }
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2007
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2008 private void fmovcc(ConditionFlag cond, CC cc, Register rs2, Register rd, int opfLow) {
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2009 int opfCC = cc.value;
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2010 int a = opfCC << 11 | opfLow << 5 | rs2.encoding;
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2011 fmt10(rd.encoding, Fpop2.value, cond.value, a);
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
2012 }
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
2013
19683
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2014 public void movcc(ConditionFlag conditionFlag, CC cc, Register rs2, Register rd) {
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2015 movcc(conditionFlag, cc, 0, rs2.encoding, rd);
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
2016 }
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17165
diff changeset
2017
19683
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2018 public void movcc(ConditionFlag conditionFlag, CC cc, int simm11, Register rd) {
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2019 assert isSimm11(simm11);
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2020 movcc(conditionFlag, cc, 1, simm11 & ((1 << 11) - 1), rd);
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2021 }
10468
cfbe4f978116 SPARC assembler enhancements and more fixes
twisti
parents: 10465
diff changeset
2022
19683
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2023 private void movcc(ConditionFlag conditionFlag, CC cc, int i, int imm, Register rd) {
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2024 int cc01 = 0b11 & cc.value;
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2025 int cc2 = cc.isFloat ? 0 : 1;
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2026 int a = cc2 << 4 | conditionFlag.value;
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2027 int b = cc01 << 11 | i << 13 | imm;
9459ec57fa73 [SPARC] Change conditional move ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
2028 fmt10(rd.encoding, Movcc.value, a, b);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2029 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2030
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2031 public void mulx(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2032 op3(Mulx, rs1, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2033 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2034
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2035 public void mulx(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2036 op3(Mulx, rs1, simm13, rd);
18844
5e80dd2f1783 Extend emitMul, emitAdd and emitSub in ArithmeticLIRGenerator for explicitly requesting to set the flags register. (In AMD64 flags are set implicitly, but on SPARC it is not)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18717
diff changeset
2037 }
5e80dd2f1783 Extend emitMul, emitAdd and emitSub in ArithmeticLIRGenerator for explicitly requesting to set the flags register. (In AMD64 flags are set implicitly, but on SPARC it is not)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18717
diff changeset
2038
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2039 public void or(Register rs1, Register rs2, Register rd) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2040 assert isCPURegister(rs1, rs2, rd) : String.format("%s %s %s", rs1, rs2, rd);
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2041 op3(Or, rs1, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2042 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2043
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2044 public void or(Register rs1, int simm13, Register rd) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2045 assert isCPURegister(rs1, rd) : String.format("%s %s", rs1, rd);
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2046 op3(Or, rs1, simm13, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2047 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2048
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2049 public void popc(Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2050 op3(Popc, g0, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2051 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2052
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2053 public void popc(int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2054 op3(Popc, g0, simm13, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2055 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2056
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2057 public void prefetch(SPARCAddress addr, Fcn fcn) {
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2058 Register rs1 = addr.getBase();
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2059 if (addr.getIndex().equals(Register.None)) {
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2060 int dis = addr.getDisplacement();
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2061 assert isSimm13(dis);
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
2062 fmt(Prefetch.op.value, fcn.value, Prefetch.value, rs1.encoding, 1 << 13 | dis & ((1 << 13) - 1));
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2063 } else {
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2064 Register rs2 = addr.getIndex();
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
2065 fmt(Prefetch.op.value, fcn.value, Prefetch.value, rs1.encoding, rs2.encoding);
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2066 }
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2067 }
14013
4347ad3df3d7 make SPARC compile code again
twisti
parents: 12464
diff changeset
2068
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2069 // A.44 Read State Register
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2070
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2071 public void rdpc(Register rd) {
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2072 op3(Rd, r5, g0, rd);
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2073 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2074
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2075 public void restore(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2076 op3(Restore, rs1, rs2, rd);
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9843
diff changeset
2077 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents: 9843
diff changeset
2078
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2079 public static final int PC_RETURN_OFFSET = 8;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
2080
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2081 public void save(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2082 op3(Save, rs1, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2083 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2084
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2085 public void save(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2086 op3(Save, rs1, simm13, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2087 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2088
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2089 public void sdivx(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2090 op3(Sdivx, rs1, rs2, rd);
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2091 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2092
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2093 public void sdivx(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2094 op3(Sdivx, rs1, simm13, rd);
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2095 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2096
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2097 public void udivx(Register rs1, Register rs2, Register rd) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2098 op3(Udivx, rs1, rs2, rd);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2099 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2100
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2101 public void udivx(Register rs1, int simm13, Register rd) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2102 op3(Udivx, rs1, simm13, rd);
9831
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
2103 }
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
2104
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2105 public void sll(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2106 op3(Sll, rs1, rs2, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2107 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
2108
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2109 public void sll(Register rs1, int shcnt32, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2110 assert isImm(shcnt32, 5);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2111 op3(Sll, rs1, shcnt32, rd);
9831
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
2112 }
705aca4ebf2f SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents: 9828
diff changeset
2113
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2114 public void sllx(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2115 op3(Sllx, rs1, rs2, rd);
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2116 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2117
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2118 public void sllx(Register rs1, int shcnt64, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2119 assert isImm(shcnt64, 6);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2120 op3(Sllx, rs1, shcnt64, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2121 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
2122
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2123 public void sra(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2124 op3(Sra, rs1, rs2, rd);
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2125 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2126
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2127 public void sra(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2128 op3(Sra, rs1, simm13, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2129 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
2130
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2131 public void srax(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2132 op3(Srax, rs1, rs2, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2133 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
2134
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2135 public void srax(Register rs1, int shcnt64, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2136 assert isImm(shcnt64, 6);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2137 op3(Srax, rs1, shcnt64, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2138 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2139
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2140 public void srl(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2141 op3(Srl, rs1, rs2, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2142 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
2143
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2144 public void srl(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2145 op3(Srl, rs1, simm13, rd);
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2146 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2147
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2148 public void srlx(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2149 op3(Srlx, rs1, rs2, rd);
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2150 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9695
diff changeset
2151
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2152 public void srlx(Register rs1, int shcnt64, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2153 assert isImm(shcnt64, 6);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2154 op3(Srlx, rs1, shcnt64, rd);
16520
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
2155 }
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
2156
19681
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
2157 public void fandd(Register rs1, Register rs2, Register rd) {
32a5dd091f5f [SPARC] Replace fpop instructions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19680
diff changeset
2158 op3(Impdep1, Fandd, rs1, rs2, rd);
16520
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
2159 }
9a07bf8467a6 [SPARC] Implement floatingpoint branch instructions, removing math substitutions for SPARC; fixing problems with constants in debug info (Big/Little Endian problems)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16518
diff changeset
2160
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2161 public void sub(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2162 op3(Sub, rs1, rs2, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2163 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
2164
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2165 public void sub(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2166 op3(Sub, rs1, simm13, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2167 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2168
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2169 public void subcc(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2170 op3(Subcc, rs1, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2171 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2172
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2173 public void subcc(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2174 op3(Subcc, rs1, simm13, rd);
18668
6ace9e5bc384 [SPARC] Fix trap instruction
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18187
diff changeset
2175 }
6ace9e5bc384 [SPARC] Fix trap instruction
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18187
diff changeset
2176
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2177 public void ta(int trap) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2178 tcc(Icc, Always, trap);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2179 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2180
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2181 public void tcc(CC cc, ConditionFlag flag, int trap) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2182 assert isImm(trap, 8);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2183 int b = cc.value << 11;
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2184 b |= 1 << 13;
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2185 b |= trap;
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2186 fmt10(flag.value, Op3s.Tcc.getValue(), 0, b);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2187 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2188
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2189 public void wrccr(Register rs1, Register rs2) {
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2190 op3(Wr, rs1, rs2, r2);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2191 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2192
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2193 public void wrccr(Register rs1, int simm13) {
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19683
diff changeset
2194 op3(Wr, rs1, simm13, r2);
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2195 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
2196
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2197 public void xor(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2198 op3(Xor, rs1, rs2, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2199 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
2200
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2201 public void xor(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2202 op3(Xor, rs1, simm13, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2203 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2204
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2205 public void xorcc(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2206 op3(Xorcc, rs1, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2207 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2208
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2209 public void xorcc(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2210 op3(Xorcc, rs1, simm13, rd);
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2211 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
2212
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2213 public void xnor(Register rs1, Register rs2, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2214 op3(Xnor, rs1, rs2, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2215 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2216
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2217 public void xnor(Register rs1, int simm13, Register rd) {
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19681
diff changeset
2218 op3(Xnor, rs1, simm13, rd);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2219 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2220
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2221 /*
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2222 * Load/Store
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2223 */
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2224 protected void ld(Op3s op3, SPARCAddress addr, Register rd, Asi asi) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2225 Register rs1 = addr.getBase();
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2226 if (!addr.getIndex().equals(Register.None)) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2227 Register rs2 = addr.getIndex();
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2228 if (asi != null) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2229 int b = rs2.encoding;
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2230 b |= asi.value << 5;
22271
75b1506b0e7a [SPARC] Remove redundant Op enum from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22160
diff changeset
2231 fmt(op3.op.value, rd.encoding, op3.value, rs1.encoding, b);
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2232 } else {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2233 op3(op3, rs1, rs2, rd);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2234 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2235 } else {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2236 int imm = addr.getDisplacement();
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2237 op3(op3, rs1, imm, rd);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2238 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2239 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2240
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2241 protected void ld(Op3s op3, SPARCAddress addr, Register rd) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2242 ld(op3, addr, rd, null);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2243 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2244
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2245 public void lddf(SPARCAddress src, Register dst) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2246 assert isDoubleFloatRegister(dst) : dst;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2247 ld(Lddf, src, dst);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2248 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2249
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2250 public void ldf(SPARCAddress src, Register dst) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2251 assert isSingleFloatRegister(dst) : dst;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2252 ld(Ldf, src, dst);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2253 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2254
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2255 public void lduh(SPARCAddress src, Register dst) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2256 assert isCPURegister(dst) : dst;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2257 ld(Lduh, src, dst);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2258 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2259
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2260 public void ldsh(SPARCAddress src, Register dst) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2261 assert isCPURegister(dst) : dst;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2262 ld(Ldsh, src, dst);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2263 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2264
22410
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2265 public void ld(SPARCAddress src, Register dst, int bytes, boolean signExtend) {
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2266 if (SPARC.isCPURegister(dst)) {
22410
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2267 if (signExtend) {
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2268 switch (bytes) {
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2269 case 1:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2270 ld(Ldsb, src, dst);
22410
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2271 break;
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2272 case 2:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2273 ld(Ldsh, src, dst);
22410
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2274 break;
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2275 case 4:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2276 ld(Ldsw, src, dst);
22410
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2277 break;
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2278 case 8:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2279 ld(Ldx, src, dst);
22410
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2280 break;
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2281 default:
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2282 throw new InternalError();
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2283 }
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2284 } else {
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2285 switch (bytes) {
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2286 case 1:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2287 ld(Ldub, src, dst);
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2288 break;
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2289 case 2:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2290 ld(Lduh, src, dst);
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2291 break;
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2292 case 4:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2293 ld(Lduw, src, dst);
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2294 break;
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2295 case 8:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2296 ld(Ldx, src, dst);
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2297 break;
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2298 default:
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2299 throw new InternalError();
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2300 }
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2301 }
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2302 } else if (SPARC.isDoubleFloatRegister(dst) && bytes == 8) {
22410
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2303 assert !signExtend;
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2304 ld(Lddf, src, dst);
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2305 } else if (SPARC.isSingleFloatRegister(dst) && bytes == 4) {
22410
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2306 assert !signExtend;
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2307 ld(Ldf, src, dst);
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2308 } else {
22410
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2309 throw new InternalError(String.format("src: %s dst: %s bytes: %d signExtend: %b", src, dst, bytes, signExtend));
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2310 }
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2311 }
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2312
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2313 public void st(Register src, SPARCAddress dst, int bytes) {
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2314 if (SPARC.isCPURegister(src)) {
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2315 switch (bytes) {
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2316 case 1:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2317 st(Stb, src, dst);
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2318 break;
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2319 case 2:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2320 st(Sth, src, dst);
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2321 break;
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2322 case 4:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2323 st(Stw, src, dst);
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2324 break;
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2325 case 8:
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2326 st(Stx, src, dst);
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2327 break;
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2328 default:
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2329 throw new InternalError(Integer.toString(bytes));
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2330 }
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2331 } else if (SPARC.isDoubleFloatRegister(src) && bytes == 8) {
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2332 st(Stdf, src, dst);
22408
fe430002c001 [SPARC] Assembler: ld/st with size parameter
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22348
diff changeset
2333 } else if (SPARC.isSingleFloatRegister(src) && bytes == 4) {
22413
7bcafeafcb1c [SPARC] SPARCAssembler call directly ld/st with Op3
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22412
diff changeset
2334 st(Stf, src, dst);
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2335 } else {
22410
5cef8c333188 [SPARC] SPARCMove remove switching on Kind when generating code; use PlatformKind and byte counts defined by the target instead
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22408
diff changeset
2336 throw new InternalError(String.format("src: %s dst: %s bytes: %d", src, dst, bytes));
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2337 }
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2338 }
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22056
diff changeset
2339
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2340 public void ldub(SPARCAddress src, Register dst) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2341 assert isCPURegister(dst) : dst;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2342 ld(Ldub, src, dst);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2343 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2344
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2345 public void ldsb(SPARCAddress src, Register dst) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2346 assert isCPURegister(dst) : dst;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2347 ld(Ldsb, src, dst);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2348 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2349
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2350 public void lduw(SPARCAddress src, Register dst) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2351 assert isCPURegister(dst) : dst;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2352 ld(Lduw, src, dst);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2353 }
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2354
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2355 public void ldsw(SPARCAddress src, Register dst) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2356 assert isCPURegister(dst) : dst;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2357 ld(Ldsw, src, dst);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2358 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2359
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2360 public void ldx(SPARCAddress src, Register dst) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2361 assert isCPURegister(dst) : dst;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2362 ld(Ldx, src, dst);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2363 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2364
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2365 public void ldxa(Register rs1, Register rs2, Register rd, Asi asi) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2366 assert SPARC.isCPURegister(rs1, rs2, rd) : format("%s %s %s", rs1, rs2, rd);
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2367 ld(Ldxa, new SPARCAddress(rs1, rs2), rd, asi);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2368 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2369
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2370 public void lduwa(Register rs1, Register rs2, Register rd, Asi asi) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2371 assert SPARC.isCPURegister(rs1, rs2, rd) : format("%s %s %s", rs1, rs2, rd);
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2372 ld(Lduwa, new SPARCAddress(rs1, rs2), rd, asi);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2373 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2374
22468
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
2375 public void stxa(Register rd, Register rs1, Register rs2, Asi asi) {
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
2376 assert SPARC.isCPURegister(rs1, rs2, rd) : format("%s %s %s", rs1, rs2, rd);
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
2377 ld(Stxa, new SPARCAddress(rs1, rs2), rd, asi);
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
2378 }
cdd5ff710208 [SPARC] Add stxa
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22413
diff changeset
2379
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2380 protected void st(Op3s op3, Register rs1, SPARCAddress dest) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2381 ld(op3, dest, rs1);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2382 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2383
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2384 public void stdf(Register rd, SPARCAddress addr) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2385 assert isDoubleFloatRegister(rd) : rd;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2386 st(Stdf, rd, addr);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2387 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2388
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2389 public void stf(Register rd, SPARCAddress addr) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2390 assert isSingleFloatRegister(rd) : rd;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2391 st(Stf, rd, addr);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2392 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2393
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2394 public void stb(Register rd, SPARCAddress addr) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2395 assert isCPURegister(rd) : rd;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2396 st(Stb, rd, addr);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2397 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2398
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2399 public void sth(Register rd, SPARCAddress addr) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2400 assert isCPURegister(rd) : rd;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2401 st(Sth, rd, addr);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2402 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2403
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2404 public void stw(Register rd, SPARCAddress addr) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2405 assert isCPURegister(rd) : rd;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2406 st(Stw, rd, addr);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2407 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2408
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2409 public void stx(Register rd, SPARCAddress addr) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2410 assert isCPURegister(rd) : rd;
19690
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2411 st(Stx, rd, addr);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2412 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2413
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2414 public void membar(int barriers) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2415 op3(Membar, r15, barriers, g0);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2416 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2417
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2418 public void casa(Register rs1, Register rs2, Register rd, Asi asi) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2419 ld(Casa, new SPARCAddress(rs1, rs2), rd, asi);
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2420 }
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2421
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2422 public void casxa(Register rs1, Register rs2, Register rd, Asi asi) {
268f56a8ce55 [SPARC] Remove unused code from assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
2423 ld(Casxa, new SPARCAddress(rs1, rs2), rd, asi);
9695
a39e67ca883b partial SPARC assembler
Morris Meyer <morris.meyer@oracle.com>
parents: 8170
diff changeset
2424 }
20003
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2425
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2426 @Override
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2427 public InstructionCounter getInstructionCounter() {
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2428 return new SPARCInstructionCounter(this);
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2429 }
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2430
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2431 public void patchAddImmediate(int position, int simm13) {
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2432 int inst = getInt(position);
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2433 assert SPARCAssembler.isSimm13(simm13) : simm13;
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2434 assert (inst >>> 30) == 0b10 : String.format("0x%x", inst);
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2435 assert ((inst >>> 18) & 0b11_1111) == 0 : String.format("0x%x", inst);
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2436 assert (inst & (1 << 13)) != 0 : String.format("0x%x", inst);
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2437 inst = inst & (~((1 << 13) - 1));
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2438 inst |= simm13 & ((1 << 12) - 1);
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2439 emitInt(inst, position);
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19690
diff changeset
2440 }
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2441
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2442 public void fpadd32(Register rs1, Register rs2, Register rd) {
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2443 op3(Impdep1, Fpadd32, rs1, rs2, rd);
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20003
diff changeset
2444 }
22348
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2445
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2446 /**
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2447 * Does peephole optimization on code generated by this assembler. This method should be called
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2448 * at the end of code generation.
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2449 * <p>
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2450 * It searches for conditional branch instructions which has nop in the delay slot then looks at
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2451 * the instruction at branch target; if it is an arithmetic instruction, which does not throw an
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2452 * exception (e.g. division), it pulls this instruction into the delay slot and increments the
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2453 * displacement by 1.
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2454 */
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2455 public void peephole() {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2456 for (int i : delaySlotOptimizationPoints) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2457 optimizeDelaySlot(i);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2458 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2459 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2460
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2461 /**
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2462 * Optimizes branch instruction <i>b</t> which has a nop in the delay slot. It tries to stuff
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2463 * the instruction at <i>b</i>s branch target into the delay slot of <i>b</i>, set the annul
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2464 * flag and increments <i>b</i>s disp field by 1;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2465 * <p>
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2466 * If <i>b</i>s branch target instruction is an unconditional branch <i>t</i>, then it tries to
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2467 * put <i>t</i>s delayed instruction into the delay slot of <i>b</i> and add the <i>t</i>s disp
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2468 * field to <i>b</i>s disp field.
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2469 */
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2470 private void optimizeDelaySlot(int i) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2471 int delaySlotAbsolute = i + INSTRUCTION_SIZE;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2472 int nextInst = getInt(delaySlotAbsolute);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2473 SPARCOp nextOp = getSPARCOp(nextInst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2474 if (nextOp instanceof Sethi && ((Sethi) nextOp).isNop(nextInst)) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2475 int inst = getInt(i);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2476 SPARCOp op = getSPARCOp(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2477 if (op instanceof ControlTransferOp && ((ControlTransferOp) op).hasDelaySlot() && ((ControlTransferOp) op).isAnnulable(inst)) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2478 ControlTransferOp ctOp = (ControlTransferOp) op;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2479 int disp = ctOp.getDisp(inst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2480 int branchTargetAbsolute = i + disp * INSTRUCTION_SIZE;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2481 int branchTargetInst = getInt(branchTargetAbsolute);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2482 SPARCOp branchTargetOp = getSPARCOp(branchTargetInst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2483 if (branchTargetOp instanceof Op3Op) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2484 Op3s op3 = ((Op3Op) branchTargetOp).getOp3(branchTargetInst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2485 if (!op3.throwsException()) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2486 inst = ctOp.setDisp(inst, disp + 1); // Increment the offset
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2487 inst = ctOp.setAnnul(inst, true);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2488 emitInt(inst, i);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2489 emitInt(branchTargetInst, delaySlotAbsolute);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2490 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2491 } else if (branchTargetOp instanceof ControlTransferOp && !((ControlTransferOp) branchTargetOp).isConditional(branchTargetInst)) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2492 // If branchtarget is a unconditional branch
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2493 ControlTransferOp branchTargetOpBranch = (ControlTransferOp) branchTargetOp;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2494 int btDisp = branchTargetOpBranch.getDisp(branchTargetInst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2495 int newDisp = disp + btDisp;
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2496 if (ctOp.isValidDisp(newDisp)) { // Test if we don't exceed field size
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2497 int instAfter = ctOp.setDisp(inst, newDisp);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2498 instAfter = ctOp.setAnnul(instAfter, true);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2499 branchTargetInst = getInt(branchTargetAbsolute + INSTRUCTION_SIZE);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2500 branchTargetOp = getSPARCOp(branchTargetInst);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2501 if (branchTargetOp instanceof Op3Op && !((Op3Op) branchTargetOp).getOp3(branchTargetInst).throwsException()) {
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2502 emitInt(instAfter, i);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2503 emitInt(branchTargetInst, delaySlotAbsolute);
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2504 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2505 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2506 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2507 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2508 }
17b96d2fe8d6 [SPARC] Peephole optimization of empty delay slots
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22271
diff changeset
2509 }
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2510 }