SparcInstrAliases.td revision 288943
1262261Sdim//===-- SparcInstrAliases.td - Instruction Aliases for Sparc Target -------===// 2262261Sdim// 3262261Sdim// The LLVM Compiler Infrastructure 4262261Sdim// 5262261Sdim// This file is distributed under the University of Illinois Open Source 6262261Sdim// License. See LICENSE.TXT for details. 7262261Sdim// 8262261Sdim//===----------------------------------------------------------------------===// 9262261Sdim// 10262261Sdim// This file contains instruction aliases for Sparc. 11262261Sdim//===----------------------------------------------------------------------===// 12262261Sdim 13262261Sdim// Instruction aliases for conditional moves. 14262261Sdim 15262261Sdim// mov<cond> <ccreg> rs2, rd 16276479Sdimmulticlass intcond_mov_alias<string cond, int condVal, string ccreg, 17262261Sdim Instruction movrr, Instruction movri, 18262261Sdim Instruction fmovs, Instruction fmovd> { 19262261Sdim 20276479Sdim // mov<cond> (%icc|%xcc), rs2, rd 21262261Sdim def : InstAlias<!strconcat(!strconcat(!strconcat("mov", cond), ccreg), 22262261Sdim ", $rs2, $rd"), 23262261Sdim (movrr IntRegs:$rd, IntRegs:$rs2, condVal)>; 24262261Sdim 25276479Sdim // mov<cond> (%icc|%xcc), simm11, rd 26262261Sdim def : InstAlias<!strconcat(!strconcat(!strconcat("mov", cond), ccreg), 27262261Sdim ", $simm11, $rd"), 28262261Sdim (movri IntRegs:$rd, i32imm:$simm11, condVal)>; 29262261Sdim 30276479Sdim // fmovs<cond> (%icc|%xcc), $rs2, $rd 31262261Sdim def : InstAlias<!strconcat(!strconcat(!strconcat("fmovs", cond), ccreg), 32262261Sdim ", $rs2, $rd"), 33262261Sdim (fmovs FPRegs:$rd, FPRegs:$rs2, condVal)>; 34262261Sdim 35276479Sdim // fmovd<cond> (%icc|%xcc), $rs2, $rd 36262261Sdim def : InstAlias<!strconcat(!strconcat(!strconcat("fmovd", cond), ccreg), 37262261Sdim ", $rs2, $rd"), 38262261Sdim (fmovd DFPRegs:$rd, DFPRegs:$rs2, condVal)>; 39262261Sdim} 40262261Sdim 41276479Sdim// mov<cond> <ccreg> rs2, rd 42276479Sdimmulticlass fpcond_mov_alias<string cond, int condVal, 43276479Sdim Instruction movrr, Instruction movri, 44276479Sdim Instruction fmovs, Instruction fmovd> { 45262261Sdim 46276479Sdim // mov<cond> %fcc[0-3], rs2, rd 47276479Sdim def : InstAlias<!strconcat(!strconcat("mov", cond), " $cc, $rs2, $rd"), 48276479Sdim (movrr IntRegs:$rd, FCCRegs:$cc, IntRegs:$rs2, condVal)>; 49276479Sdim 50276479Sdim // mov<cond> %fcc[0-3], simm11, rd 51276479Sdim def : InstAlias<!strconcat(!strconcat("mov", cond), " $cc, $simm11, $rd"), 52276479Sdim (movri IntRegs:$rd, FCCRegs:$cc, i32imm:$simm11, condVal)>; 53276479Sdim 54276479Sdim // fmovs<cond> %fcc[0-3], $rs2, $rd 55276479Sdim def : InstAlias<!strconcat(!strconcat("fmovs", cond), " $cc, $rs2, $rd"), 56276479Sdim (fmovs FPRegs:$rd, FCCRegs:$cc, FPRegs:$rs2, condVal)>; 57276479Sdim 58276479Sdim // fmovd<cond> %fcc[0-3], $rs2, $rd 59276479Sdim def : InstAlias<!strconcat(!strconcat("fmovd", cond), " $cc, $rs2, $rd"), 60276479Sdim (fmovd DFPRegs:$rd, FCCRegs:$cc, DFPRegs:$rs2, condVal)>; 61276479Sdim} 62276479Sdim 63262261Sdim// Instruction aliases for integer conditional branches and moves. 64262261Sdimmulticlass int_cond_alias<string cond, int condVal> { 65262261Sdim 66262261Sdim // b<cond> $imm 67262261Sdim def : InstAlias<!strconcat(!strconcat("b", cond), " $imm"), 68262261Sdim (BCOND brtarget:$imm, condVal)>; 69262261Sdim 70276479Sdim // b<cond>,a $imm 71276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",a $imm"), 72276479Sdim (BCONDA brtarget:$imm, condVal)>; 73276479Sdim 74276479Sdim // b<cond> %icc, $imm 75276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), " %icc, $imm"), 76276479Sdim (BPICC brtarget:$imm, condVal)>, Requires<[HasV9]>; 77276479Sdim 78276479Sdim // b<cond>,pt %icc, $imm 79276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",pt %icc, $imm"), 80276479Sdim (BPICC brtarget:$imm, condVal)>, Requires<[HasV9]>; 81276479Sdim 82276479Sdim // b<cond>,a %icc, $imm 83276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",a %icc, $imm"), 84276479Sdim (BPICCA brtarget:$imm, condVal)>, Requires<[HasV9]>; 85276479Sdim 86276479Sdim // b<cond>,a,pt %icc, $imm 87276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",a,pt %icc, $imm"), 88276479Sdim (BPICCA brtarget:$imm, condVal)>, Requires<[HasV9]>; 89276479Sdim 90276479Sdim // b<cond>,pn %icc, $imm 91276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",pn %icc, $imm"), 92276479Sdim (BPICCNT brtarget:$imm, condVal)>, Requires<[HasV9]>; 93276479Sdim 94276479Sdim // b<cond>,a,pn %icc, $imm 95276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",a,pn %icc, $imm"), 96276479Sdim (BPICCANT brtarget:$imm, condVal)>, Requires<[HasV9]>; 97276479Sdim 98262261Sdim // b<cond> %xcc, $imm 99262261Sdim def : InstAlias<!strconcat(!strconcat("b", cond), " %xcc, $imm"), 100262261Sdim (BPXCC brtarget:$imm, condVal)>, Requires<[Is64Bit]>; 101262261Sdim 102276479Sdim // b<cond>,pt %xcc, $imm 103276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",pt %xcc, $imm"), 104276479Sdim (BPXCC brtarget:$imm, condVal)>, Requires<[Is64Bit]>; 105276479Sdim 106276479Sdim // b<cond>,a %xcc, $imm 107276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",a %xcc, $imm"), 108276479Sdim (BPXCCA brtarget:$imm, condVal)>, Requires<[Is64Bit]>; 109276479Sdim 110276479Sdim // b<cond>,a,pt %xcc, $imm 111276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",a,pt %xcc, $imm"), 112276479Sdim (BPXCCA brtarget:$imm, condVal)>, Requires<[Is64Bit]>; 113276479Sdim 114276479Sdim // b<cond>,pn %xcc, $imm 115276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",pn %xcc, $imm"), 116276479Sdim (BPXCCNT brtarget:$imm, condVal)>, Requires<[Is64Bit]>; 117276479Sdim 118276479Sdim // b<cond>,a,pn %xcc, $imm 119276479Sdim def : InstAlias<!strconcat(!strconcat("b", cond), ",a,pn %xcc, $imm"), 120276479Sdim (BPXCCANT brtarget:$imm, condVal)>, Requires<[Is64Bit]>; 121276479Sdim 122276479Sdim 123276479Sdim defm : intcond_mov_alias<cond, condVal, " %icc", 124262261Sdim MOVICCrr, MOVICCri, 125262261Sdim FMOVS_ICC, FMOVD_ICC>, Requires<[HasV9]>; 126262261Sdim 127276479Sdim defm : intcond_mov_alias<cond, condVal, " %xcc", 128262261Sdim MOVXCCrr, MOVXCCri, 129262261Sdim FMOVS_XCC, FMOVD_XCC>, Requires<[Is64Bit]>; 130262261Sdim 131262261Sdim // fmovq<cond> (%icc|%xcc), $rs2, $rd 132262261Sdim def : InstAlias<!strconcat(!strconcat("fmovq", cond), " %icc, $rs2, $rd"), 133262261Sdim (FMOVQ_ICC QFPRegs:$rd, QFPRegs:$rs2, condVal)>, 134262261Sdim Requires<[HasV9, HasHardQuad]>; 135262261Sdim def : InstAlias<!strconcat(!strconcat("fmovq", cond), " %xcc, $rs2, $rd"), 136262261Sdim (FMOVQ_XCC QFPRegs:$rd, QFPRegs:$rs2, condVal)>, 137262261Sdim Requires<[Is64Bit, HasHardQuad]>; 138262261Sdim 139276479Sdim // t<cond> %icc, rs1 + rs2 140276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " %icc, $rs1 + $rs2"), 141276479Sdim (TICCrr IntRegs:$rs1, IntRegs:$rs2, condVal)>, 142276479Sdim Requires<[HasV9]>; 143276479Sdim 144276479Sdim // t<cond> %icc, rs => t<cond> %icc, G0 + rs 145276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " %icc, $rs2"), 146276479Sdim (TICCrr G0, IntRegs:$rs2, condVal)>, 147276479Sdim Requires<[HasV9]>; 148276479Sdim 149276479Sdim // t<cond> %xcc, rs1 + rs2 150276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " %xcc, $rs1 + $rs2"), 151276479Sdim (TXCCrr IntRegs:$rs1, IntRegs:$rs2, condVal)>, 152276479Sdim Requires<[HasV9]>; 153276479Sdim 154276479Sdim // t<cond> %xcc, rs => t<cond> %xcc, G0 + rs 155276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " %xcc, $rs2"), 156276479Sdim (TXCCrr G0, IntRegs:$rs2, condVal)>, 157276479Sdim Requires<[HasV9]>; 158276479Sdim 159276479Sdim // t<cond> rs1 + rs2 => t<cond> %icc, rs1 + rs2 160276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " $rs1 + $rs2"), 161276479Sdim (TICCrr IntRegs:$rs1, IntRegs:$rs2, condVal)>; 162276479Sdim 163276479Sdim // t<cond> rs=> t<cond> %icc, G0 + rs2 164276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " $rs2"), 165276479Sdim (TICCrr G0, IntRegs:$rs2, condVal)>; 166276479Sdim 167276479Sdim // t<cond> %icc, rs1 + imm 168276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " %icc, $rs1 + $imm"), 169276479Sdim (TICCri IntRegs:$rs1, i32imm:$imm, condVal)>, 170276479Sdim Requires<[HasV9]>; 171276479Sdim // t<cond> %icc, imm => t<cond> %icc, G0 + imm 172276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " %icc, $imm"), 173276479Sdim (TICCri G0, i32imm:$imm, condVal)>, 174276479Sdim Requires<[HasV9]>; 175276479Sdim // t<cond> %xcc, rs1 + imm 176276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " %xcc, $rs1 + $imm"), 177276479Sdim (TXCCri IntRegs:$rs1, i32imm:$imm, condVal)>, 178276479Sdim Requires<[HasV9]>; 179276479Sdim // t<cond> %xcc, imm => t<cond> %xcc, G0 + imm 180276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " %xcc, $imm"), 181276479Sdim (TXCCri G0, i32imm:$imm, condVal)>, 182276479Sdim Requires<[HasV9]>; 183276479Sdim 184276479Sdim // t<cond> rs1 + imm => t<cond> %icc, rs1 + imm 185276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " $rs1 + $imm"), 186276479Sdim (TICCri IntRegs:$rs1, i32imm:$imm, condVal)>; 187276479Sdim 188276479Sdim // t<cond> imm => t<cond> %icc, G0 + imm 189276479Sdim def : InstAlias<!strconcat(!strconcat("t", cond), " $imm"), 190276479Sdim (TICCri G0, i32imm:$imm, condVal)>; 191276479Sdim 192262261Sdim} 193262261Sdim 194262261Sdim 195262261Sdim// Instruction aliases for floating point conditional branches and moves. 196262261Sdimmulticlass fp_cond_alias<string cond, int condVal> { 197262261Sdim 198262261Sdim // fb<cond> $imm 199262261Sdim def : InstAlias<!strconcat(!strconcat("fb", cond), " $imm"), 200262261Sdim (FBCOND brtarget:$imm, condVal), 0>; 201262261Sdim 202276479Sdim // fb<cond>,a $imm 203276479Sdim def : InstAlias<!strconcat(!strconcat("fb", cond), ",a $imm"), 204276479Sdim (FBCONDA brtarget:$imm, condVal), 0>; 205262261Sdim 206276479Sdim // fb<cond> %fcc0, $imm 207276479Sdim def : InstAlias<!strconcat(!strconcat("fb", cond), " $cc, $imm"), 208276479Sdim (BPFCC brtarget:$imm, condVal, FCCRegs:$cc)>, 209276479Sdim Requires<[HasV9]>; 210276479Sdim 211276479Sdim // fb<cond>,pt %fcc0, $imm 212276479Sdim def : InstAlias<!strconcat(!strconcat("fb", cond), ",pt $cc, $imm"), 213276479Sdim (BPFCC brtarget:$imm, condVal, FCCRegs:$cc)>, 214276479Sdim Requires<[HasV9]>; 215276479Sdim 216276479Sdim // fb<cond>,a %fcc0, $imm 217276479Sdim def : InstAlias<!strconcat(!strconcat("fb", cond), ",a $cc, $imm"), 218276479Sdim (BPFCCA brtarget:$imm, condVal, FCCRegs:$cc)>, 219276479Sdim Requires<[HasV9]>; 220276479Sdim 221276479Sdim // fb<cond>,a,pt %fcc0, $imm 222276479Sdim def : InstAlias<!strconcat(!strconcat("fb", cond), ",a,pt $cc, $imm"), 223276479Sdim (BPFCCA brtarget:$imm, condVal, FCCRegs:$cc)>, 224276479Sdim Requires<[HasV9]>; 225276479Sdim 226276479Sdim // fb<cond>,pn %fcc0, $imm 227276479Sdim def : InstAlias<!strconcat(!strconcat("fb", cond), ",pn $cc, $imm"), 228276479Sdim (BPFCCNT brtarget:$imm, condVal, FCCRegs:$cc)>, 229276479Sdim Requires<[HasV9]>; 230276479Sdim 231276479Sdim // fb<cond>,a,pn %fcc0, $imm 232276479Sdim def : InstAlias<!strconcat(!strconcat("fb", cond), ",a,pn $cc, $imm"), 233276479Sdim (BPFCCANT brtarget:$imm, condVal, FCCRegs:$cc)>, 234276479Sdim Requires<[HasV9]>; 235276479Sdim 236276479Sdim defm : fpcond_mov_alias<cond, condVal, 237276479Sdim V9MOVFCCrr, V9MOVFCCri, 238276479Sdim V9FMOVS_FCC, V9FMOVD_FCC>, Requires<[HasV9]>; 239276479Sdim 240262261Sdim // fmovq<cond> %fcc0, $rs2, $rd 241276479Sdim def : InstAlias<!strconcat(!strconcat("fmovq", cond), " $cc, $rs2, $rd"), 242276479Sdim (V9FMOVQ_FCC QFPRegs:$rd, FCCRegs:$cc, QFPRegs:$rs2, 243276479Sdim condVal)>, 244262261Sdim Requires<[HasV9, HasHardQuad]>; 245262261Sdim} 246262261Sdim 247262261Sdimdefm : int_cond_alias<"a", 0b1000>; 248288943Sdimdefm : int_cond_alias<"", 0b1000>; // same as a; gnu asm, not in manual 249262261Sdimdefm : int_cond_alias<"n", 0b0000>; 250262261Sdimdefm : int_cond_alias<"ne", 0b1001>; 251288943Sdimdefm : int_cond_alias<"nz", 0b1001>; // same as ne 252262261Sdimdefm : int_cond_alias<"e", 0b0001>; 253288943Sdimdefm : int_cond_alias<"z", 0b0001>; // same as e 254262261Sdimdefm : int_cond_alias<"g", 0b1010>; 255262261Sdimdefm : int_cond_alias<"le", 0b0010>; 256262261Sdimdefm : int_cond_alias<"ge", 0b1011>; 257262261Sdimdefm : int_cond_alias<"l", 0b0011>; 258262261Sdimdefm : int_cond_alias<"gu", 0b1100>; 259262261Sdimdefm : int_cond_alias<"leu", 0b0100>; 260262261Sdimdefm : int_cond_alias<"cc", 0b1101>; 261288943Sdimdefm : int_cond_alias<"geu", 0b1101>; // same as cc 262262261Sdimdefm : int_cond_alias<"cs", 0b0101>; 263288943Sdimdefm : int_cond_alias<"lu", 0b0101>; // same as cs 264262261Sdimdefm : int_cond_alias<"pos", 0b1110>; 265262261Sdimdefm : int_cond_alias<"neg", 0b0110>; 266262261Sdimdefm : int_cond_alias<"vc", 0b1111>; 267262261Sdimdefm : int_cond_alias<"vs", 0b0111>; 268262261Sdim 269276479Sdimdefm : fp_cond_alias<"a", 0b0000>; 270288943Sdimdefm : fp_cond_alias<"", 0b0000>; // same as a; gnu asm, not in manual 271276479Sdimdefm : fp_cond_alias<"n", 0b1000>; 272262261Sdimdefm : fp_cond_alias<"u", 0b0111>; 273262261Sdimdefm : fp_cond_alias<"g", 0b0110>; 274262261Sdimdefm : fp_cond_alias<"ug", 0b0101>; 275262261Sdimdefm : fp_cond_alias<"l", 0b0100>; 276262261Sdimdefm : fp_cond_alias<"ul", 0b0011>; 277262261Sdimdefm : fp_cond_alias<"lg", 0b0010>; 278262261Sdimdefm : fp_cond_alias<"ne", 0b0001>; 279288943Sdimdefm : fp_cond_alias<"nz", 0b0001>; // same as ne 280262261Sdimdefm : fp_cond_alias<"e", 0b1001>; 281288943Sdimdefm : fp_cond_alias<"z", 0b1001>; // same as e 282262261Sdimdefm : fp_cond_alias<"ue", 0b1010>; 283262261Sdimdefm : fp_cond_alias<"ge", 0b1011>; 284262261Sdimdefm : fp_cond_alias<"uge", 0b1100>; 285262261Sdimdefm : fp_cond_alias<"le", 0b1101>; 286262261Sdimdefm : fp_cond_alias<"ule", 0b1110>; 287262261Sdimdefm : fp_cond_alias<"o", 0b1111>; 288262261Sdim 289288943Sdim// Section A.3 Synthetic Instructions 290262261Sdim 291288943Sdim// Most are marked as Emit=0, so that they are not used for disassembly. This is 292288943Sdim// an aesthetic issue, but the chosen policy is to typically prefer using the 293288943Sdim// non-alias form, except for the most obvious and clarifying aliases: cmp, jmp, 294288943Sdim// call, tst, ret, retl. 295288943Sdim 296288943Sdim// Note: cmp is handled in SparcInstrInfo. 297288943Sdim// jmp/call/ret/retl have special case handling for output in 298288943Sdim// SparcInstPrinter.cpp 299288943Sdim 300262261Sdim// jmp addr -> jmpl addr, %g0 301276479Sdimdef : InstAlias<"jmp $addr", (JMPLrr G0, MEMrr:$addr), 0>; 302276479Sdimdef : InstAlias<"jmp $addr", (JMPLri G0, MEMri:$addr), 0>; 303262261Sdim 304262261Sdim// call addr -> jmpl addr, %o7 305276479Sdimdef : InstAlias<"call $addr", (JMPLrr O7, MEMrr:$addr), 0>; 306276479Sdimdef : InstAlias<"call $addr", (JMPLri O7, MEMri:$addr), 0>; 307262261Sdim 308288943Sdim// tst reg -> orcc %g0, reg, %g0 309288943Sdimdef : InstAlias<"tst $rs2", (ORCCrr G0, IntRegs:$rs2, G0)>; 310262261Sdim 311288943Sdim// ret -> jmpl %i7+8, %g0 (aka RET 8) 312262261Sdimdef : InstAlias<"ret", (RET 8)>; 313262261Sdim 314288943Sdim// retl -> jmpl %o7+8, %g0 (aka RETL 8) 315288943Sdimdef : InstAlias<"retl", (RETL 8)>; 316262261Sdim 317276479Sdim// restore -> restore %g0, %g0, %g0 318276479Sdimdef : InstAlias<"restore", (RESTORErr G0, G0, G0)>; 319276479Sdim 320288943Sdim// save -> restore %g0, %g0, %g0 321288943Sdimdef : InstAlias<"save", (SAVErr G0, G0, G0)>; 322288943Sdim 323288943Sdim// set value, rd 324288943Sdim// (turns into a sequence of sethi+or, depending on the value) 325288943Sdim// def : InstAlias<"set $val, $rd", (ORri IntRegs:$rd, (SETHIi (HI22 imm:$val)), (LO10 imm:$val))>; 326288943Sdimdef SET : AsmPseudoInst<(outs IntRegs:$rd), (ins i32imm:$val), "set $val, $rd">; 327288943Sdim 328288943Sdim// not rd -> xnor rd, %g0, rd 329288943Sdimdef : InstAlias<"not $rd", (XNORrr IntRegs:$rd, IntRegs:$rd, G0), 0>; 330288943Sdim 331288943Sdim// not reg, rd -> xnor reg, %g0, rd 332288943Sdimdef : InstAlias<"not $rs1, $rd", (XNORrr IntRegs:$rd, IntRegs:$rs1, G0), 0>; 333288943Sdim 334288943Sdim// neg rd -> sub %g0, rd, rd 335288943Sdimdef : InstAlias<"neg $rd", (SUBrr IntRegs:$rd, G0, IntRegs:$rd), 0>; 336288943Sdim 337288943Sdim// neg reg, rd -> sub %g0, reg, rd 338288943Sdimdef : InstAlias<"neg $rs2, $rd", (SUBrr IntRegs:$rd, G0, IntRegs:$rs2), 0>; 339288943Sdim 340288943Sdim// inc rd -> add rd, 1, rd 341288943Sdimdef : InstAlias<"inc $rd", (ADDri IntRegs:$rd, IntRegs:$rd, 1), 0>; 342288943Sdim 343288943Sdim// inc simm13, rd -> add rd, simm13, rd 344288943Sdimdef : InstAlias<"inc $simm13, $rd", (ADDri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>; 345288943Sdim 346288943Sdim// inccc rd -> addcc rd, 1, rd 347288943Sdimdef : InstAlias<"inccc $rd", (ADDCCri IntRegs:$rd, IntRegs:$rd, 1), 0>; 348288943Sdim 349288943Sdim// inccc simm13, rd -> addcc rd, simm13, rd 350288943Sdimdef : InstAlias<"inccc $simm13, $rd", (ADDCCri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>; 351288943Sdim 352288943Sdim// dec rd -> sub rd, 1, rd 353288943Sdimdef : InstAlias<"dec $rd", (SUBri IntRegs:$rd, IntRegs:$rd, 1), 0>; 354288943Sdim 355288943Sdim// dec simm13, rd -> sub rd, simm13, rd 356288943Sdimdef : InstAlias<"dec $simm13, $rd", (SUBri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>; 357288943Sdim 358288943Sdim// deccc rd -> subcc rd, 1, rd 359288943Sdimdef : InstAlias<"deccc $rd", (SUBCCri IntRegs:$rd, IntRegs:$rd, 1), 0>; 360288943Sdim 361288943Sdim// deccc simm13, rd -> subcc rd, simm13, rd 362288943Sdimdef : InstAlias<"deccc $simm13, $rd", (SUBCCri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>; 363288943Sdim 364288943Sdim// btst reg_or_imm, reg -> andcc reg,reg_or_imm,%g0 365288943Sdimdef : InstAlias<"btst $rs2, $rs1", (ANDCCrr G0, IntRegs:$rs1, IntRegs:$rs2), 0>; 366288943Sdimdef : InstAlias<"btst $simm13, $rs1", (ANDCCri G0, IntRegs:$rs1, i32imm:$simm13), 0>; 367288943Sdim 368288943Sdim// bset reg_or_imm, rd -> or rd,reg_or_imm,rd 369288943Sdimdef : InstAlias<"bset $rs2, $rd", (ORrr IntRegs:$rd, IntRegs:$rd, IntRegs:$rs2), 0>; 370288943Sdimdef : InstAlias<"bset $simm13, $rd", (ORri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>; 371288943Sdim 372288943Sdim// bclr reg_or_imm, rd -> andn rd,reg_or_imm,rd 373288943Sdimdef : InstAlias<"bclr $rs2, $rd", (ANDNrr IntRegs:$rd, IntRegs:$rd, IntRegs:$rs2), 0>; 374288943Sdimdef : InstAlias<"bclr $simm13, $rd", (ANDNri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>; 375288943Sdim 376288943Sdim// btog reg_or_imm, rd -> xor rd,reg_or_imm,rd 377288943Sdimdef : InstAlias<"btog $rs2, $rd", (XORrr IntRegs:$rd, IntRegs:$rd, IntRegs:$rs2), 0>; 378288943Sdimdef : InstAlias<"btog $simm13, $rd", (XORri IntRegs:$rd, IntRegs:$rd, i32imm:$simm13), 0>; 379288943Sdim 380288943Sdim 381288943Sdim// clr rd -> or %g0, %g0, rd 382288943Sdimdef : InstAlias<"clr $rd", (ORrr IntRegs:$rd, G0, G0), 0>; 383288943Sdim 384288943Sdim// clr{b,h,} [addr] -> st{b,h,} %g0, [addr] 385288943Sdimdef : InstAlias<"clrb [$addr]", (STBrr MEMrr:$addr, G0), 0>; 386288943Sdimdef : InstAlias<"clrb [$addr]", (STBri MEMri:$addr, G0), 0>; 387288943Sdimdef : InstAlias<"clrh [$addr]", (STHrr MEMrr:$addr, G0), 0>; 388288943Sdimdef : InstAlias<"clrh [$addr]", (STHri MEMri:$addr, G0), 0>; 389288943Sdimdef : InstAlias<"clr [$addr]", (STrr MEMrr:$addr, G0), 0>; 390288943Sdimdef : InstAlias<"clr [$addr]", (STri MEMri:$addr, G0), 0>; 391288943Sdim 392288943Sdim 393288943Sdim// mov reg_or_imm, rd -> or %g0, reg_or_imm, rd 394288943Sdimdef : InstAlias<"mov $rs2, $rd", (ORrr IntRegs:$rd, G0, IntRegs:$rs2)>; 395288943Sdimdef : InstAlias<"mov $simm13, $rd", (ORri IntRegs:$rd, G0, i32imm:$simm13)>; 396288943Sdim 397288943Sdim// mov specialreg, rd -> rd specialreg, rd 398288943Sdimdef : InstAlias<"mov $asr, $rd", (RDASR IntRegs:$rd, ASRRegs:$asr), 0>; 399288943Sdimdef : InstAlias<"mov %psr, $rd", (RDPSR IntRegs:$rd), 0>; 400288943Sdimdef : InstAlias<"mov %wim, $rd", (RDWIM IntRegs:$rd), 0>; 401288943Sdimdef : InstAlias<"mov %tbr, $rd", (RDTBR IntRegs:$rd), 0>; 402288943Sdim 403288943Sdim// mov reg_or_imm, specialreg -> wr %g0, reg_or_imm, specialreg 404288943Sdimdef : InstAlias<"mov $rs2, $asr", (WRASRrr ASRRegs:$asr, G0, IntRegs:$rs2), 0>; 405288943Sdimdef : InstAlias<"mov $simm13, $asr", (WRASRri ASRRegs:$asr, G0, i32imm:$simm13), 0>; 406288943Sdimdef : InstAlias<"mov $rs2, %psr", (WRPSRrr G0, IntRegs:$rs2), 0>; 407288943Sdimdef : InstAlias<"mov $simm13, %psr", (WRPSRri G0, i32imm:$simm13), 0>; 408288943Sdimdef : InstAlias<"mov $rs2, %wim", (WRWIMrr G0, IntRegs:$rs2), 0>; 409288943Sdimdef : InstAlias<"mov $simm13, %wim", (WRWIMri G0, i32imm:$simm13), 0>; 410288943Sdimdef : InstAlias<"mov $rs2, %tbr", (WRTBRrr G0, IntRegs:$rs2), 0>; 411288943Sdimdef : InstAlias<"mov $simm13, %tbr", (WRTBRri G0, i32imm:$simm13), 0>; 412288943Sdim 413288943Sdim// End of Section A.3 414288943Sdim 415288943Sdim// wr reg_or_imm, specialreg -> wr %g0, reg_or_imm, specialreg 416288943Sdim// (aka: omit the first arg when it's g0. This is not in the manual, but is 417288943Sdim// supported by gnu and solaris as) 418288943Sdimdef : InstAlias<"wr $rs2, $asr", (WRASRrr ASRRegs:$asr, G0, IntRegs:$rs2), 0>; 419288943Sdimdef : InstAlias<"wr $simm13, $asr", (WRASRri ASRRegs:$asr, G0, i32imm:$simm13), 0>; 420288943Sdimdef : InstAlias<"wr $rs2, %psr", (WRPSRrr G0, IntRegs:$rs2), 0>; 421288943Sdimdef : InstAlias<"wr $simm13, %psr", (WRPSRri G0, i32imm:$simm13), 0>; 422288943Sdimdef : InstAlias<"wr $rs2, %wim", (WRWIMrr G0, IntRegs:$rs2), 0>; 423288943Sdimdef : InstAlias<"wr $simm13, %wim", (WRWIMri G0, i32imm:$simm13), 0>; 424288943Sdimdef : InstAlias<"wr $rs2, %tbr", (WRTBRrr G0, IntRegs:$rs2), 0>; 425288943Sdimdef : InstAlias<"wr $simm13, %tbr", (WRTBRri G0, i32imm:$simm13), 0>; 426288943Sdim 427288943Sdim 428288943Sdim// flush -> flush %g0 429288943Sdimdef : InstAlias<"flush", (FLUSH), 0>; 430288943Sdim 431288943Sdim 432276479Sdimdef : MnemonicAlias<"return", "rett">, Requires<[HasV9]>; 433276479Sdim 434276479Sdimdef : MnemonicAlias<"addc", "addx">, Requires<[HasV9]>; 435276479Sdimdef : MnemonicAlias<"addccc", "addxcc">, Requires<[HasV9]>; 436276479Sdim 437276479Sdimdef : MnemonicAlias<"subc", "subx">, Requires<[HasV9]>; 438276479Sdimdef : MnemonicAlias<"subccc", "subxcc">, Requires<[HasV9]>; 439276479Sdim 440276479Sdim 441276479Sdimdef : InstAlias<"fcmps $rs1, $rs2", (V9FCMPS FCC0, FPRegs:$rs1, FPRegs:$rs2)>; 442276479Sdimdef : InstAlias<"fcmpd $rs1, $rs2", (V9FCMPD FCC0, DFPRegs:$rs1, DFPRegs:$rs2)>; 443276479Sdimdef : InstAlias<"fcmpq $rs1, $rs2", (V9FCMPQ FCC0, QFPRegs:$rs1, QFPRegs:$rs2)>, 444276479Sdim Requires<[HasHardQuad]>; 445276479Sdim 446276479Sdimdef : InstAlias<"fcmpes $rs1, $rs2", (V9FCMPES FCC0, FPRegs:$rs1, FPRegs:$rs2)>; 447276479Sdimdef : InstAlias<"fcmped $rs1, $rs2", (V9FCMPED FCC0, DFPRegs:$rs1, 448276479Sdim DFPRegs:$rs2)>; 449276479Sdimdef : InstAlias<"fcmpeq $rs1, $rs2", (V9FCMPEQ FCC0, QFPRegs:$rs1, 450276479Sdim QFPRegs:$rs2)>, 451276479Sdim Requires<[HasHardQuad]>; 452288943Sdim 453