annotate graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java @ 17144:44a96c7413a7

[SPARC] Gearing up with CBcond instruction
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Wed, 17 Sep 2014 17:05:18 -0700
parents 832c8c93c949
children 805a26002dc7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
1 /*
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
4 *
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
8 *
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
13 * accompanied this code).
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
14 *
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
18 *
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
21 * questions.
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
22 */
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.asm.sparc;
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
24
10686
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10468
diff changeset
25 import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
26 import static com.oracle.graal.sparc.SPARC.*;
9846
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
27
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
28 import com.oracle.graal.api.code.*;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
29 import com.oracle.graal.asm.*;
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
30
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
31 public class SPARCMacroAssembler extends SPARCAssembler {
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
32
10686
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10468
diff changeset
33 /**
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10468
diff changeset
34 * A sentinel value used as a place holder in an instruction stream for an address that will be
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10468
diff changeset
35 * patched.
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10468
diff changeset
36 */
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10468
diff changeset
37 private static final SPARCAddress Placeholder = new SPARCAddress(g0, 0);
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10468
diff changeset
38
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
39 public SPARCMacroAssembler(TargetDescription target, RegisterConfig registerConfig) {
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
40 super(target, registerConfig);
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
41 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
42
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
43 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
44 public void align(int modulus) {
17120
832c8c93c949 [SPARC] Now doing alignment bytewise and not instruction-wise (nop in AMD64 has one byte, nop in SPARC four bytes)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17089
diff changeset
45 while (position() % modulus != 0) {
832c8c93c949 [SPARC] Now doing alignment bytewise and not instruction-wise (nop in AMD64 has one byte, nop in SPARC four bytes)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17089
diff changeset
46 new Nop().emit(this);
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
47 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
48 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
49
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
50 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
51 public void jmp(Label l) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
52 new Bpa(l).emit(this);
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
53 new Nop().emit(this); // delay slot
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
54 }
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
55
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
56 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
57 protected final void patchJumpTarget(int branch, int branchTarget) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
58 final int disp = branchTarget - branch;
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: 14754
diff changeset
59 Fmt00 fmt = Fmt00.read(this, branch);
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: 14754
diff changeset
60 fmt.setImm(disp);
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
61 fmt.write(this, branch);
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
62 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
63
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
64 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
65 public AbstractAddress makeAddress(Register base, int displacement) {
10686
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10468
diff changeset
66 return new SPARCAddress(base, displacement);
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
67 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
68
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
69 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
70 public AbstractAddress getPlaceholder() {
10686
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10468
diff changeset
71 return Placeholder;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
72 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
73
14754
164903a50a9a make ensureUniquePC an abstract method of the base Assembler class
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14031
diff changeset
74 @Override
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
75 public final void ensureUniquePC() {
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
76 new Nop().emit(this);
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
77 }
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
78
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
79 public static class Bclr extends Andn {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
80
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
81 public Bclr(Register src, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
82 super(dst, src, dst);
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
83 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
84
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
85 public Bclr(int simm13, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
86 super(dst, simm13, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
87 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
88 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
89
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
90 public static class Bpgeu extends Bpcc {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
91
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
92 public Bpgeu(CC cc, int simm19) {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
93 super(cc, simm19);
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
94 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
95
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
96 public Bpgeu(CC cc, Label label) {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
97 super(cc, label);
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
98 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
99 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
100
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
101 public static class Bplu extends Bpcs {
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
102
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
103 public Bplu(CC cc, int simm19) {
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
104 super(cc, simm19);
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
105 }
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
106
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
107 public Bplu(CC cc, Label label) {
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
108 super(cc, label);
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
109 }
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
110 }
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
111
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
112 public static class Bset extends Or {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
113
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
114 public Bset(Register src, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
115 super(dst, src, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
116 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
117
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
118 public Bset(int simm13, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
119 super(dst, simm13, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
120 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
121 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
122
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
123 public static class Btst extends Andcc {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
124
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
125 public Btst(Register src1, Register src2) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
126 super(src1, src2, g0);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
127 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
128
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
129 public Btst(Register src1, int simm13) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
130 super(src1, simm13, g0);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
131 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
132 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
133
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
134 public static class Cas extends Casa {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
135
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
136 public Cas(Register src1, Register src2, Register dst) {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
137 super(src1, src2, dst, Asi.ASI_PRIMARY);
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
138 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
139 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
140
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
141 public static class Casx extends Casxa {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
142
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
143 public Casx(Register src1, Register src2, Register dst) {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
144 super(src1, src2, dst, Asi.ASI_PRIMARY);
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
145 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
146 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
147
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
148 public static class Clr extends Or {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
149
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
150 public Clr(Register dst) {
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
151 super(g0, g0, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
152 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
153 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
154
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
155 public static class Clrb extends Stb {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
156
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
157 public Clrb(SPARCAddress addr) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
158 super(g0, addr);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
159 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
160 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
161
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
162 public static class Clrh extends Sth {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
163
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
164 public Clrh(SPARCAddress addr) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
165 super(g0, addr);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
166 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
167 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
168
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
169 public static class Clrx extends Stx {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
170
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
171 public Clrx(SPARCAddress addr) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
172 super(g0, addr);
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
173 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
174 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
175
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
176 public static class Clruw extends Srl {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
177
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
178 public Clruw(Register src1, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
179 super(src1, g0, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
180 assert src1.encoding() != dst.encoding();
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
181 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
182
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
183 public Clruw(Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
184 super(dst, g0, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
185 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
186 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
187
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
188 public static class Cmp extends Subcc {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
189
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
190 public Cmp(Register a, Register b) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
191 super(a, b, g0);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
192 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
193
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
194 public Cmp(Register a, int simm13) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
195 super(a, simm13, g0);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
196 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
197 }
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
198
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
199 public static class Dec extends Sub {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
200
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
201 public Dec(Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
202 super(dst, 1, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
203 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
204
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
205 public Dec(int simm13, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
206 super(dst, simm13, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
207 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
208 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
209
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
210 public static class Deccc extends Subcc {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
211
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
212 public Deccc(Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
213 super(dst, 1, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
214 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
215
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
216 public Deccc(int simm13, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
217 super(dst, simm13, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
218 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
219 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
220
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
221 @SuppressWarnings("unused")
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
222 public static class Inc {
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
223
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
224 public Inc(Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
225 new Add(dst, 1, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
226 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
227
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
228 public Inc(int simm13, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
229 new Add(dst, simm13, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
230 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
231 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
232
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
233 @SuppressWarnings("unused")
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
234 public static class Inccc {
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
235
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
236 public Inccc(Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
237 new Addcc(dst, 1, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
238 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
239
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
240 public Inccc(int simm13, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
241 new Addcc(dst, simm13, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
242 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
243 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
244
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
245 public static class Jmp extends Jmpl {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
246
10468
cfbe4f978116 SPARC assembler enhancements and more fixes
twisti
parents: 10466
diff changeset
247 public Jmp(SPARCAddress address) {
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
248 super(address.getBase(), address.getDisplacement(), g0);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
249 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
250 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
251
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
252 public static class Neg extends Sub {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
253
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
254 public Neg(Register src2, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
255 super(g0, src2, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
256 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
257
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
258 public Neg(Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
259 super(g0, dst, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
260 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
261 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
262
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
263 public static class Mov extends Or {
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
264
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
265 public Mov(Register src1, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
266 super(g0, src1, dst);
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
267 assert src1.encoding() != dst.encoding();
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
268 }
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
269
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
270 public Mov(int simm13, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
271 super(g0, simm13, dst);
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
272 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
273 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
274
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
275 public static class Nop extends Sethi {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
276
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
277 public Nop() {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
278 super(0, r0);
9949
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
279 }
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
280 }
41511d78546a SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents: 9846
diff changeset
281
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
282 public static class Not extends Xnor {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
283
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
284 public Not(Register src1, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
285 super(src1, g0, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
286 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
287
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
288 public Not(Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
289 super(dst, g0, dst);
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
290 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
291 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
292
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
293 public static class RestoreWindow extends Restore {
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
294
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
295 public RestoreWindow() {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
296 super(g0, g0, g0);
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
297 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
298 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
299
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
300 public static class Ret extends Jmpl {
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
301
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
302 public Ret() {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
303 super(i7, 8, g0);
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
304 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
305 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
306
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
307 public static class SaveWindow extends Save {
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
308
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
309 public SaveWindow() {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
310 super(g0, g0, g0);
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
311 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
312 }
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
313
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
314 public static class Setuw {
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
315
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
316 private int value;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
317 private Register dst;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
318
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
319 public Setuw(int value, Register dst) {
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
320 this.value = value;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
321 this.dst = dst;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
322 }
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
323
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
324 public void emit(SPARCMacroAssembler masm) {
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
325 if (value == 0) {
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
326 new Clr(dst).emit(masm);
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: 16523
diff changeset
327 } else if (isSimm13(value)) {
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
328 new Or(g0, value, dst).emit(masm);
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
329 } else if (value >= 0 && ((value & 0x3FFF) == 0)) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
330 new Sethi(hi22(value), dst).emit(masm);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
331 } else {
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
332 new Sethi(hi22(value), dst).emit(masm);
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
333 new Or(dst, lo10(value), dst).emit(masm);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
334 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
335 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
336 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
337
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
338 /**
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
339 * This instruction is like sethi but for 64-bit values.
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
340 */
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
341 public static class Sethix {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
342
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
343 private static final int INSTRUCTION_SIZE = 7;
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
344
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
345 private long value;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
346 private Register dst;
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
347 private boolean forceRelocatable;
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
348
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
349 public Sethix(long value, Register dst, boolean forceRelocatable) {
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
350 this.value = value;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
351 this.dst = dst;
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
352 this.forceRelocatable = forceRelocatable;
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
353 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
354
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
355 public Sethix(long value, Register dst) {
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
356 this(value, dst, false);
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
357 }
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
358
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
359 public void emit(SPARCMacroAssembler masm) {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
360 int hi = (int) (value >> 32);
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
361 int lo = (int) (value & ~0);
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
362
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
363 // This is the same logic as MacroAssembler::internal_set.
14031
390c4b742890 made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents: 11233
diff changeset
364 final int startPc = masm.position();
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
365
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
366 if (hi == 0 && lo >= 0) {
10871
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
367 new Sethi(hi22(lo), dst).emit(masm);
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
368 } else if (hi == -1) {
10871
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
369 new Sethi(hi22(~lo), dst).emit(masm);
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
370 new Xor(dst, ~lo10(~0), dst).emit(masm);
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
371 } else {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
372 int shiftcnt = 0;
10871
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
373 new Sethi(hi22(hi), dst).emit(masm);
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
374 if ((hi & 0x3ff) != 0) { // Any bits?
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
375 new Or(dst, hi & 0x3ff, dst).emit(masm); // msb 32-bits are now in lsb 32
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
376 }
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
377 if ((lo & 0xFFFFFC00) != 0) { // done?
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
378 if (((lo >> 20) & 0xfff) != 0) { // Any bits set?
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
379 new Sllx(dst, 12, dst).emit(masm); // Make room for next 12 bits
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
380 new Or(dst, (lo >> 20) & 0xfff, dst).emit(masm); // Or in next 12
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
381 shiftcnt = 0; // We already shifted
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
382 } else {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
383 shiftcnt = 12;
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
384 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
385 if (((lo >> 10) & 0x3ff) != 0) {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
386 new Sllx(dst, shiftcnt + 10, dst).emit(masm); // Make room for last 10 bits
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
387 new Or(dst, (lo >> 10) & 0x3ff, dst).emit(masm); // Or in next 10
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
388 shiftcnt = 0;
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
389 } else {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
390 shiftcnt = 10;
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
391 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
392 new Sllx(dst, shiftcnt + 10, dst).emit(masm); // Shift leaving disp field 0'd
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
393 } else {
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
394 new Sllx(dst, 32, dst).emit(masm);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
395 }
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
396 }
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
397 // Pad out the instruction sequence so it can be patched later.
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
398 if (forceRelocatable) {
14031
390c4b742890 made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents: 11233
diff changeset
399 while (masm.position() < (startPc + (INSTRUCTION_SIZE * 4))) {
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
400 new Nop().emit(masm);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
401 }
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
402 }
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
403 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
404 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
405
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
406 public static class Setx {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
407
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
408 private long value;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
409 private Register dst;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
410 private boolean forceRelocatable;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
411
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
412 public Setx(long value, Register dst, boolean forceRelocatable) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
413 this.value = value;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
414 this.dst = dst;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
415 this.forceRelocatable = forceRelocatable;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
416 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
417
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
418 public Setx(long value, Register dst) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
419 this(value, dst, false);
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
420 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
421
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
422 public void emit(SPARCMacroAssembler masm) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
423 new Sethix(value, dst, forceRelocatable).emit(masm);
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
424 int lo = (int) (value & ~0);
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
425 if (lo10(lo) != 0 || forceRelocatable) {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
426 new Add(dst, lo10(lo), dst).emit(masm);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
427 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
428 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
429 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
430
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
431 public static class Signx extends Sra {
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
432
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
433 public Signx(Register src1, Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
434 super(src1, g0, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
435 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
436
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
437 public Signx(Register dst) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
438 super(dst, g0, dst);
9845
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
439 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
440 }
204e8f3209e9 SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents: 9844
diff changeset
441
9846
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
442 @SuppressWarnings("unused")
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
443 public static class Trap {
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
444
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
445 public Trap(SPARCAssembler asm, int trap) {
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
446 assert trap >= 0 && trap <= 0x7f;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9949
diff changeset
447 new Ta(asm, Icc, g0, trap);
9846
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
448 }
91a1041ec905 SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents: 9845
diff changeset
449 }
9844
2d1687e63484 SPARCMacroAssembler and synthetic instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
450 }