1 //===-- SparcInstrAliases.td - Instruction Aliases for Sparc Target -------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file contains instruction aliases for Sparc.
10 //===----------------------------------------------------------------------===//
12 // Instruction aliases for conditional moves.
14 // mov<cond> <ccreg> rs2, rd
15 multiclass intcond_mov_alias<string cond, int condVal, string ccreg,
16 Instruction movrr, Instruction movri,
17 Instruction fmovs, Instruction fmovd> {
19 // mov<cond> (%icc|%xcc), rs2, rd
20 def : InstAlias<!strconcat(!strconcat(!strconcat("mov", cond), ccreg),
22 (movrr IntRegs:$rd, IntRegs:$rs2, condVal)>;
24 // mov<cond> (%icc|%xcc), simm11, rd
25 def : InstAlias<!strconcat(!strconcat(!strconcat("mov", cond), ccreg),
27 (movri IntRegs:$rd, i32imm:$simm11, condVal)>;
29 // fmovs<cond> (%icc|%xcc), $rs2, $rd
30 def : InstAlias<!strconcat(!strconcat(!strconcat("fmovs", cond), ccreg),
32 (fmovs FPRegs:$rd, FPRegs:$rs2, condVal)>;
34 // fmovd<cond> (%icc|%xcc), $rs2, $rd
35 def : InstAlias<!strconcat(!strconcat(!strconcat("fmovd", cond), ccreg),
37 (fmovd DFPRegs:$rd, DFPRegs:$rs2, condVal)>;
40 // mov<cond> <ccreg> rs2, rd
41 multiclass fpcond_mov_alias<string cond, int condVal,
42 Instruction movrr, Instruction movri,
43 Instruction fmovs, Instruction fmovd> {
45 // mov<cond> %fcc[0-3], rs2, rd
46 def : InstAlias<!strconcat(!strconcat("mov", cond), " $cc, $rs2, $rd"),
47 (movrr IntRegs:$rd, FCCRegs:$cc, IntRegs:$rs2, condVal)>;
49 // mov<cond> %fcc[0-3], simm11, rd
50 def : InstAlias<!strconcat(!strconcat("mov", cond), " $cc, $simm11, $rd"),
51 (movri IntRegs:$rd, FCCRegs:$cc, i32imm:$simm11, condVal)>;
53 // fmovs<cond> %fcc[0-3], $rs2, $rd
54 def : InstAlias<!strconcat(!strconcat("fmovs", cond), " $cc, $rs2, $rd"),
55 (fmovs FPRegs:$rd, FCCRegs:$cc, FPRegs:$rs2, condVal)>;
57 // fmovd<cond> %fcc[0-3], $rs2, $rd
58 def : InstAlias<!strconcat(!strconcat("fmovd", cond), " $cc, $rs2, $rd"),
59 (fmovd DFPRegs:$rd, FCCRegs:$cc, DFPRegs:$rs2, condVal)>;
62 // Instruction aliases for integer conditional branches and moves.
63 multiclass int_cond_alias<string cond, int condVal> {
66 def : InstAlias<!strconcat(!strconcat("b", cond), " $imm"),
67 (BCOND brtarget:$imm, condVal)>;
70 def : InstAlias<!strconcat(!strconcat("b", cond), ",a $imm"),
71 (BCONDA brtarget:$imm, condVal)>;
74 def : InstAlias<!strconcat(!strconcat("b", cond), " %icc, $imm"),
75 (BPICC brtarget:$imm, condVal)>, Requires<[HasV9]>;
77 // b<cond>,pt %icc, $imm
78 def : InstAlias<!strconcat(!strconcat("b", cond), ",pt %icc, $imm"),
79 (BPICC brtarget:$imm, condVal)>, Requires<[HasV9]>;
81 // b<cond>,a %icc, $imm
82 def : InstAlias<!strconcat(!strconcat("b", cond), ",a %icc, $imm"),
83 (BPICCA brtarget:$imm, condVal)>, Requires<[HasV9]>;
85 // b<cond>,a,pt %icc, $imm
86 def : InstAlias<!strconcat(!strconcat("b", cond), ",a,pt %icc, $imm"),
87 (BPICCA brtarget:$imm, condVal)>, Requires<[HasV9]>;
89 // b<cond>,pn %icc, $imm
90 def : InstAlias<!strconcat(!strconcat("b", cond), ",pn %icc, $imm"),
91 (BPICCNT brtarget:$imm, condVal)>, Requires<[HasV9]>;
93 // b<cond>,a,pn %icc, $imm
94 def : InstAlias<!strconcat(!strconcat("b", cond), ",a,pn %icc, $imm"),
95 (BPICCANT brtarget:$imm, condVal)>, Requires<[HasV9]>;
98 def : InstAlias<!strconcat(!strconcat("b", cond), " %xcc, $imm"),
99 (BPXCC brtarget:$imm, condVal)>, Requires<[Is64Bit]>;
101 // b<cond>,pt %xcc, $imm
102 def : InstAlias<!strconcat(!strconcat("b", cond), ",pt %xcc, $imm"),
103 (BPXCC brtarget:$imm, condVal)>, Requires<[Is64Bit]>;
105 // b<cond>,a %xcc, $imm
106 def : InstAlias<!strconcat(!strconcat("b", cond), ",a %xcc, $imm"),
107 (BPXCCA brtarget:$imm, condVal)>, Requires<[Is64Bit]>;
109 // b<cond>,a,pt %xcc, $imm
110 def : InstAlias<!strconcat(!strconcat("b", cond), ",a,pt %xcc, $imm"),
111 (BPXCCA brtarget:$imm, condVal)>, Requires<[Is64Bit]>;
113 // b<cond>,pn %xcc, $imm
114 def : InstAlias<!strconcat(!strconcat("b", cond), ",pn %xcc, $imm"),
115 (BPXCCNT brtarget:$imm, condVal)>, Requires<[Is64Bit]>;
117 // b<cond>,a,pn %xcc, $imm
118 def : InstAlias<!strconcat(!strconcat("b", cond), ",a,pn %xcc, $imm"),
119 (BPXCCANT brtarget:$imm, condVal)>, Requires<[Is64Bit]>;
122 defm : intcond_mov_alias<cond, condVal, " %icc",
124 FMOVS_ICC, FMOVD_ICC>, Requires<[HasV9]>;
126 defm : intcond_mov_alias<cond, condVal, " %xcc",
128 FMOVS_XCC, FMOVD_XCC>, Requires<[Is64Bit]>;
130 // fmovq<cond> (%icc|%xcc), $rs2, $rd
131 def : InstAlias<!strconcat(!strconcat("fmovq", cond), " %icc, $rs2, $rd"),
132 (FMOVQ_ICC QFPRegs:$rd, QFPRegs:$rs2, condVal)>,
133 Requires<[HasV9, HasHardQuad]>;
134 def : InstAlias<!strconcat(!strconcat("fmovq", cond), " %xcc, $rs2, $rd"),
135 (FMOVQ_XCC QFPRegs:$rd, QFPRegs:$rs2, condVal)>,
136 Requires<[Is64Bit, HasHardQuad]>;
138 // t<cond> %icc, rs => t<cond> %icc, G0 + rs
139 def : InstAlias<!strconcat(!strconcat("t", cond), " %icc, $rs2"),
140 (TICCrr G0, IntRegs:$rs2, condVal)>,
142 // t<cond> %icc, rs1 + rs2
143 def : InstAlias<!strconcat(!strconcat("t", cond), " %icc, $rs1 + $rs2"),
144 (TICCrr IntRegs:$rs1, IntRegs:$rs2, condVal)>,
148 // t<cond> %xcc, rs => t<cond> %xcc, G0 + rs
149 def : InstAlias<!strconcat(!strconcat("t", cond), " %xcc, $rs2"),
150 (TXCCrr G0, IntRegs:$rs2, condVal)>,
152 // t<cond> %xcc, rs1 + rs2
153 def : InstAlias<!strconcat(!strconcat("t", cond), " %xcc, $rs1 + $rs2"),
154 (TXCCrr IntRegs:$rs1, IntRegs:$rs2, condVal)>,
158 // t<cond> rs=> t<cond> %icc, G0 + rs2
159 //def : InstAlias<!strconcat(!strconcat("t", cond), " $rs2"),
160 // (TICCrr G0, IntRegs:$rs2, condVal)>,
161 // Requires<[HasV9]>;
163 // t<cond> rs1 + rs2 => t<cond> %icc, rs1 + rs2
164 //def : InstAlias<!strconcat(!strconcat("t", cond), " $rs1 + $rs2"),
165 // (TICCrr IntRegs:$rs1, IntRegs:$rs2, condVal)>,
166 // Requires<[HasV9]>;
168 // t<cond> %icc, imm => t<cond> %icc, G0 + imm
169 def : InstAlias<!strconcat(!strconcat("t", cond), " %icc, $imm"),
170 (TICCri G0, i32imm:$imm, condVal)>,
172 // t<cond> %icc, rs1 + imm
173 def : InstAlias<!strconcat(!strconcat("t", cond), " %icc, $rs1 + $imm"),
174 (TICCri IntRegs:$rs1, i32imm:$imm, condVal)>,
176 // t<cond> %xcc, imm => t<cond> %xcc, G0 + imm
177 def : InstAlias<!strconcat(!strconcat("t", cond), " %xcc, $imm"),
178 (TXCCri G0, i32imm:$imm, condVal)>,
180 // t<cond> %xcc, rs1 + imm
181 def : InstAlias<!strconcat(!strconcat("t", cond), " %xcc, $rs1 + $imm"),
182 (TXCCri IntRegs:$rs1, i32imm:$imm, condVal)>,
185 // t<cond> imm => t<cond> G0 + imm
186 def : InstAlias<!strconcat(!strconcat("t", cond), " $imm"),
187 (TRAPri G0, i32imm:$imm, condVal)>;
189 // t<cond> rs1 + imm => t<cond> rs1 + imm
190 def : InstAlias<!strconcat(!strconcat("t", cond), " $rs1 + $imm"),
191 (TRAPri IntRegs:$rs1, i32imm:$imm, condVal)>;
193 // t<cond> rs1 => t<cond> G0 + rs1
194 def : InstAlias<!strconcat(!strconcat("t", cond), " $rs1"),
195 (TRAPrr G0, IntRegs:$rs1, condVal)>;
198 def : InstAlias<!strconcat(!strconcat("t", cond), " $rs1 + $rs2"),
199 (TRAPrr IntRegs:$rs1, IntRegs:$rs2, condVal)>;
203 // Instruction aliases for floating point conditional branches and moves.
204 multiclass fp_cond_alias<string cond, int condVal> {
207 def : InstAlias<!strconcat(!strconcat("fb", cond), " $imm"),
208 (FBCOND brtarget:$imm, condVal), 0>;
211 def : InstAlias<!strconcat(!strconcat("fb", cond), ",a $imm"),
212 (FBCONDA brtarget:$imm, condVal), 0>;
214 // fb<cond> %fcc0, $imm
215 def : InstAlias<!strconcat(!strconcat("fb", cond), " $cc, $imm"),
216 (BPFCC brtarget:$imm, condVal, FCCRegs:$cc)>,
219 // fb<cond>,pt %fcc0, $imm
220 def : InstAlias<!strconcat(!strconcat("fb", cond), ",pt $cc, $imm"),
221 (BPFCC brtarget:$imm, condVal, FCCRegs:$cc)>,
224 // fb<cond>,a %fcc0, $imm
225 def : InstAlias<!strconcat(!strconcat("fb", cond), ",a $cc, $imm"),
226 (BPFCCA brtarget:$imm, condVal, FCCRegs:$cc)>,
229 // fb<cond>,a,pt %fcc0, $imm
230 def : InstAlias<!strconcat(!strconcat("fb", cond), ",a,pt $cc, $imm"),
231 (BPFCCA brtarget:$imm, condVal, FCCRegs:$cc)>,
234 // fb<cond>,pn %fcc0, $imm
235 def : InstAlias<!strconcat(!strconcat("fb", cond), ",pn $cc, $imm"),
236 (BPFCCNT brtarget:$imm, condVal, FCCRegs:$cc)>,
239 // fb<cond>,a,pn %fcc0, $imm
240 def : InstAlias<!strconcat(!strconcat("fb", cond), ",a,pn $cc, $imm"),
241 (BPFCCANT brtarget:$imm, condVal, FCCRegs:$cc)>,
244 defm : fpcond_mov_alias<cond, condVal,
245 V9MOVFCCrr, V9MOVFCCri,
246 V9FMOVS_FCC, V9FMOVD_FCC>, Requires<[HasV9]>;
248 // fmovq<cond> %fcc0, $rs2, $rd
249 def : InstAlias<!strconcat(!strconcat("fmovq", cond), " $cc, $rs2, $rd"),
250 (V9FMOVQ_FCC QFPRegs:$rd, FCCRegs:$cc, QFPRegs:$rs2,
252 Requires<[HasV9, HasHardQuad]>;
256 // Instruction aliases for co-processor conditional branches.
257 multiclass cp_cond_alias<string cond, int condVal> {
260 def : InstAlias<!strconcat(!strconcat("cb", cond), " $imm"),
261 (CBCOND brtarget:$imm, condVal), 0>;
264 def : InstAlias<!strconcat(!strconcat("cb", cond), ",a $imm"),
265 (CBCONDA brtarget:$imm, condVal), 0>;
268 defm : int_cond_alias<"a", 0b1000>;
269 defm : int_cond_alias<"n", 0b0000>;
270 defm : int_cond_alias<"ne", 0b1001>;
271 defm : int_cond_alias<"e", 0b0001>;
272 defm : int_cond_alias<"g", 0b1010>;
273 defm : int_cond_alias<"le", 0b0010>;
274 defm : int_cond_alias<"ge", 0b1011>;
275 defm : int_cond_alias<"l", 0b0011>;
276 defm : int_cond_alias<"gu", 0b1100>;
277 defm : int_cond_alias<"leu", 0b0100>;
278 defm : int_cond_alias<"cc", 0b1101>;
279 defm : int_cond_alias<"cs", 0b0101>;
280 defm : int_cond_alias<"pos", 0b1110>;
281 defm : int_cond_alias<"neg", 0b0110>;
282 defm : int_cond_alias<"vc", 0b1111>;
283 defm : int_cond_alias<"vs", 0b0111>;
284 let EmitPriority = 0 in
286 defm : int_cond_alias<"", 0b1000>; // same as a; gnu asm, not in manual
287 defm : int_cond_alias<"nz", 0b1001>; // same as ne
288 defm : int_cond_alias<"eq", 0b0001>; // same as e
289 defm : int_cond_alias<"z", 0b0001>; // same as e
290 defm : int_cond_alias<"geu", 0b1101>; // same as cc
291 defm : int_cond_alias<"lu", 0b0101>; // same as cs
293 defm : fp_cond_alias<"a", 0b1000>;
294 defm : fp_cond_alias<"n", 0b0000>;
295 defm : fp_cond_alias<"u", 0b0111>;
296 defm : fp_cond_alias<"g", 0b0110>;
297 defm : fp_cond_alias<"ug", 0b0101>;
298 defm : fp_cond_alias<"l", 0b0100>;
299 defm : fp_cond_alias<"ul", 0b0011>;
300 defm : fp_cond_alias<"lg", 0b0010>;
301 defm : fp_cond_alias<"ne", 0b0001>;
302 defm : fp_cond_alias<"e", 0b1001>;
303 defm : fp_cond_alias<"ue", 0b1010>;
304 defm : fp_cond_alias<"ge", 0b1011>;
305 defm : fp_cond_alias<"uge", 0b1100>;
306 defm : fp_cond_alias<"le", 0b1101>;
307 defm : fp_cond_alias<"ule", 0b1110>;
308 defm : fp_cond_alias<"o", 0b1111>;
309 let EmitPriority = 0 in
311 defm : fp_cond_alias<"", 0b1000>; // same as a; gnu asm, not in manual
312 defm : fp_cond_alias<"nz", 0b0001>; // same as ne
313 defm : fp_cond_alias<"z", 0b1001>; // same as e
316 defm : cp_cond_alias<"a", 0b1000>;
317 defm : cp_cond_alias<"n", 0b0000>;
318 defm : cp_cond_alias<"3", 0b0111>;
319 defm : cp_cond_alias<"2", 0b0110>;
320 defm : cp_cond_alias<"23", 0b0101>;
321 defm : cp_cond_alias<"1", 0b0100>;
322 defm : cp_cond_alias<"13", 0b0011>;
323 defm : cp_cond_alias<"12", 0b0010>;
324 defm : cp_cond_alias<"123", 0b0001>;
325 defm : cp_cond_alias<"0", 0b1001>;
326 defm : cp_cond_alias<"03", 0b1010>;
327 defm : cp_cond_alias<"02", 0b1011>;
328 defm : cp_cond_alias<"023", 0b1100>;
329 defm : cp_cond_alias<"01", 0b1101>;
330 defm : cp_cond_alias<"013", 0b1110>;
331 defm : cp_cond_alias<"012", 0b1111>;
332 let EmitPriority = 0 in defm : cp_cond_alias<"", 0b1000>; // same as a; gnu asm, not in manual
334 // Section A.3 Synthetic Instructions
336 // Most are marked as Emit=0, so that they are not used for disassembly. This is
337 // an aesthetic issue, but the chosen policy is to typically prefer using the
338 // non-alias form, except for the most obvious and clarifying aliases: cmp, jmp,
339 // call, tst, ret, retl.
341 // Note: cmp is handled in SparcInstrInfo.
342 // jmp/call/ret/retl have special case handling for output in
343 // SparcInstPrinter.cpp
345 // jmp addr -> jmpl addr, %g0
346 def : InstAlias<"jmp $addr", (JMPLrr G0, MEMrr:$addr), 0>;
347 def : InstAlias<"jmp $addr", (JMPLri G0, MEMri:$addr), 0>;
349 // call addr -> jmpl addr, %o7
350 def : InstAlias<"call $addr", (JMPLrr O7, MEMrr:$addr), 0>;
351 def : InstAlias<"call $addr", (JMPLri O7, MEMri:$addr), 0>;
353 // tst reg -> orcc %g0, reg, %g0
354 def : InstAlias<"tst $rs2", (ORCCrr G0, IntRegs:$rs2, G0)>;
356 // ret -> jmpl %i7+8, %g0 (aka RET 8)
357 def : InstAlias<"ret", (RET 8)>;
359 // retl -> jmpl %o7+8, %g0 (aka RETL 8)
360 def : InstAlias<"retl", (RETL 8)>;
362 // restore -> restore %g0, %g0, %g0
363 def : InstAlias<"restore", (RESTORErr G0, G0, G0)>;
365 // save -> restore %g0, %g0, %g0
366 def : InstAlias<"save", (SAVErr G0, G0, G0)>;
369 // (turns into a sequence of sethi+or, depending on the value)
370 // def : InstAlias<"set $val, $rd", (ORri IntRegs:$rd, (SETHIi (HI22 imm:$val)), (LO10 imm:$val))>;
371 def SET : AsmPseudoInst<(outs IntRegs:$rd), (ins i32imm:$val), "set $val, $rd">;
373 // not rd -> xnor rd, %g0, rd
374 def : InstAlias<"not $rd", (XNORrr IntRegs:$rd, IntRegs:$rd, G0), 0>;
376 // not reg, rd -> xnor reg, %g0, rd
377 def : InstAlias<"not $rs1, $rd", (XNORrr IntRegs:$rd, IntRegs:$rs1, G0), 0>;
379 // neg rd -> sub %g0, rd, rd
380 def : InstAlias<"neg $rd", (SUBrr IntRegs:$rd, G0, IntRegs:$rd), 0>;
382 // neg reg, rd -> sub %g0, reg, rd
383 def : InstAlias<"neg $rs2, $rd", (SUBrr IntRegs:$rd, G0, IntRegs:$rs2), 0>;
385 // inc rd -> add rd, 1, rd
386 def : InstAlias<"inc $rd", (ADDri IntRegs:$rd, IntRegs:$rd, 1), 0>;
388 // inc simm13, rd -> add rd, simm13, rd
389 def : InstAlias<"inc $simm13, $rd", (ADDri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>;
391 // inccc rd -> addcc rd, 1, rd
392 def : InstAlias<"inccc $rd", (ADDCCri IntRegs:$rd, IntRegs:$rd, 1), 0>;
394 // inccc simm13, rd -> addcc rd, simm13, rd
395 def : InstAlias<"inccc $simm13, $rd", (ADDCCri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>;
397 // dec rd -> sub rd, 1, rd
398 def : InstAlias<"dec $rd", (SUBri IntRegs:$rd, IntRegs:$rd, 1), 0>;
400 // dec simm13, rd -> sub rd, simm13, rd
401 def : InstAlias<"dec $simm13, $rd", (SUBri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>;
403 // deccc rd -> subcc rd, 1, rd
404 def : InstAlias<"deccc $rd", (SUBCCri IntRegs:$rd, IntRegs:$rd, 1), 0>;
406 // deccc simm13, rd -> subcc rd, simm13, rd
407 def : InstAlias<"deccc $simm13, $rd", (SUBCCri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>;
409 // btst reg_or_imm, reg -> andcc reg,reg_or_imm,%g0
410 def : InstAlias<"btst $rs2, $rs1", (ANDCCrr G0, IntRegs:$rs1, IntRegs:$rs2), 0>;
411 def : InstAlias<"btst $simm13, $rs1", (ANDCCri G0, IntRegs:$rs1, i32imm:$simm13), 0>;
413 // bset reg_or_imm, rd -> or rd,reg_or_imm,rd
414 def : InstAlias<"bset $rs2, $rd", (ORrr IntRegs:$rd, IntRegs:$rd, IntRegs:$rs2), 0>;
415 def : InstAlias<"bset $simm13, $rd", (ORri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>;
417 // bclr reg_or_imm, rd -> andn rd,reg_or_imm,rd
418 def : InstAlias<"bclr $rs2, $rd", (ANDNrr IntRegs:$rd, IntRegs:$rd, IntRegs:$rs2), 0>;
419 def : InstAlias<"bclr $simm13, $rd", (ANDNri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>;
421 // btog reg_or_imm, rd -> xor rd,reg_or_imm,rd
422 def : InstAlias<"btog $rs2, $rd", (XORrr IntRegs:$rd, IntRegs:$rd, IntRegs:$rs2), 0>;
423 def : InstAlias<"btog $simm13, $rd", (XORri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>;
426 // clr rd -> or %g0, %g0, rd
427 def : InstAlias<"clr $rd", (ORrr IntRegs:$rd, G0, G0), 0>;
429 // clr{b,h,} [addr] -> st{b,h,} %g0, [addr]
430 def : InstAlias<"clrb [$addr]", (STBrr MEMrr:$addr, G0), 0>;
431 def : InstAlias<"clrb [$addr]", (STBri MEMri:$addr, G0), 0>;
432 def : InstAlias<"clrh [$addr]", (STHrr MEMrr:$addr, G0), 0>;
433 def : InstAlias<"clrh [$addr]", (STHri MEMri:$addr, G0), 0>;
434 def : InstAlias<"clr [$addr]", (STrr MEMrr:$addr, G0), 0>;
435 def : InstAlias<"clr [$addr]", (STri MEMri:$addr, G0), 0>;
438 // mov reg_or_imm, rd -> or %g0, reg_or_imm, rd
439 def : InstAlias<"mov $rs2, $rd", (ORrr IntRegs:$rd, G0, IntRegs:$rs2)>;
440 def : InstAlias<"mov $simm13, $rd", (ORri IntRegs:$rd, G0, i32imm:$simm13)>;
442 // mov specialreg, rd -> rd specialreg, rd
443 def : InstAlias<"mov $asr, $rd", (RDASR IntRegs:$rd, ASRRegs:$asr), 0>;
444 def : InstAlias<"mov %psr, $rd", (RDPSR IntRegs:$rd), 0>;
445 def : InstAlias<"mov %wim, $rd", (RDWIM IntRegs:$rd), 0>;
446 def : InstAlias<"mov %tbr, $rd", (RDTBR IntRegs:$rd), 0>;
448 // mov reg_or_imm, specialreg -> wr %g0, reg_or_imm, specialreg
449 def : InstAlias<"mov $rs2, $asr", (WRASRrr ASRRegs:$asr, G0, IntRegs:$rs2), 0>;
450 def : InstAlias<"mov $simm13, $asr", (WRASRri ASRRegs:$asr, G0, i32imm:$simm13), 0>;
451 def : InstAlias<"mov $rs2, %psr", (WRPSRrr G0, IntRegs:$rs2), 0>;
452 def : InstAlias<"mov $simm13, %psr", (WRPSRri G0, i32imm:$simm13), 0>;
453 def : InstAlias<"mov $rs2, %wim", (WRWIMrr G0, IntRegs:$rs2), 0>;
454 def : InstAlias<"mov $simm13, %wim", (WRWIMri G0, i32imm:$simm13), 0>;
455 def : InstAlias<"mov $rs2, %tbr", (WRTBRrr G0, IntRegs:$rs2), 0>;
456 def : InstAlias<"mov $simm13, %tbr", (WRTBRri G0, i32imm:$simm13), 0>;
458 // End of Section A.3
460 // wr reg_or_imm, specialreg -> wr %g0, reg_or_imm, specialreg
461 // (aka: omit the first arg when it's g0. This is not in the manual, but is
462 // supported by gnu and solaris as)
463 def : InstAlias<"wr $rs2, $asr", (WRASRrr ASRRegs:$asr, G0, IntRegs:$rs2), 0>;
464 def : InstAlias<"wr $simm13, $asr", (WRASRri ASRRegs:$asr, G0, i32imm:$simm13), 0>;
465 def : InstAlias<"wr $rs2, %psr", (WRPSRrr G0, IntRegs:$rs2), 0>;
466 def : InstAlias<"wr $simm13, %psr", (WRPSRri G0, i32imm:$simm13), 0>;
467 def : InstAlias<"wr $rs2, %wim", (WRWIMrr G0, IntRegs:$rs2), 0>;
468 def : InstAlias<"wr $simm13, %wim", (WRWIMri G0, i32imm:$simm13), 0>;
469 def : InstAlias<"wr $rs2, %tbr", (WRTBRrr G0, IntRegs:$rs2), 0>;
470 def : InstAlias<"wr $simm13, %tbr", (WRTBRri G0, i32imm:$simm13), 0>;
472 def : InstAlias<"pwr $rs2, %psr", (PWRPSRrr G0, IntRegs:$rs2), 0>;
473 def : InstAlias<"pwr $simm13, %psr", (PWRPSRri G0, i32imm:$simm13), 0>;
475 // flush -> flush %g0
476 def : InstAlias<"flush", (FLUSH), 0>;
479 def : InstAlias<"unimp", (UNIMP 0), 0>;
481 def : MnemonicAlias<"iflush", "flush">;
483 def : MnemonicAlias<"stub", "stb">;
484 def : MnemonicAlias<"stsb", "stb">;
486 def : MnemonicAlias<"stuba", "stba">;
487 def : MnemonicAlias<"stsba", "stba">;
489 def : MnemonicAlias<"stuh", "sth">;
490 def : MnemonicAlias<"stsh", "sth">;
492 def : MnemonicAlias<"stuha", "stha">;
493 def : MnemonicAlias<"stsha", "stha">;
495 def : MnemonicAlias<"lduw", "ld">, Requires<[HasV9]>;
496 def : MnemonicAlias<"lduwa", "lda">, Requires<[HasV9]>;
498 def : MnemonicAlias<"return", "rett">, Requires<[HasV9]>;
500 def : MnemonicAlias<"addc", "addx">, Requires<[HasV9]>;
501 def : MnemonicAlias<"addccc", "addxcc">, Requires<[HasV9]>;
503 def : MnemonicAlias<"subc", "subx">, Requires<[HasV9]>;
504 def : MnemonicAlias<"subccc", "subxcc">, Requires<[HasV9]>;
507 def : InstAlias<"fcmps $rs1, $rs2", (V9FCMPS FCC0, FPRegs:$rs1, FPRegs:$rs2)>;
508 def : InstAlias<"fcmpd $rs1, $rs2", (V9FCMPD FCC0, DFPRegs:$rs1, DFPRegs:$rs2)>;
509 def : InstAlias<"fcmpq $rs1, $rs2", (V9FCMPQ FCC0, QFPRegs:$rs1, QFPRegs:$rs2)>,
510 Requires<[HasHardQuad]>;
512 def : InstAlias<"fcmpes $rs1, $rs2", (V9FCMPES FCC0, FPRegs:$rs1, FPRegs:$rs2)>;
513 def : InstAlias<"fcmped $rs1, $rs2", (V9FCMPED FCC0, DFPRegs:$rs1,
515 def : InstAlias<"fcmpeq $rs1, $rs2", (V9FCMPEQ FCC0, QFPRegs:$rs1,
517 Requires<[HasHardQuad]>;
519 // signx rd -> sra rd, %g0, rd
520 def : InstAlias<"signx $rd", (SRArr IntRegs:$rd, IntRegs:$rd, G0), 0>, Requires<[HasV9]>;
522 // signx reg, rd -> sra reg, %g0, rd
523 def : InstAlias<"signx $rs1, $rd", (SRArr IntRegs:$rd, IntRegs:$rs1, G0), 0>, Requires<[HasV9]>;