//===-- SparcInstrAliases.td - Instruction Aliases for Sparc Target -------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file contains instruction aliases for Sparc. //===----------------------------------------------------------------------===// // Instruction aliases for conditional moves. // mov rs2, rd multiclass intcond_mov_alias { // mov (%icc|%xcc), rs2, rd def : InstAlias; // mov (%icc|%xcc), simm11, rd def : InstAlias; // fmovs (%icc|%xcc), $rs2, $rd def : InstAlias; // fmovd (%icc|%xcc), $rs2, $rd def : InstAlias; } // mov rs2, rd multiclass fpcond_mov_alias { // mov %fcc[0-3], rs2, rd def : InstAlias; // mov %fcc[0-3], simm11, rd def : InstAlias; // fmovs %fcc[0-3], $rs2, $rd def : InstAlias; // fmovd %fcc[0-3], $rs2, $rd def : InstAlias; } // Instruction aliases for integer conditional branches and moves. multiclass int_cond_alias { // b $imm def : InstAlias; // b,a $imm def : InstAlias; // b %icc, $imm def : InstAlias, Requires<[HasV9]>; // b,pt %icc, $imm def : InstAlias, Requires<[HasV9]>; // b,a %icc, $imm def : InstAlias, Requires<[HasV9]>; // b,a,pt %icc, $imm def : InstAlias, Requires<[HasV9]>; // b,pn %icc, $imm def : InstAlias, Requires<[HasV9]>; // b,a,pn %icc, $imm def : InstAlias, Requires<[HasV9]>; // b %xcc, $imm def : InstAlias, Requires<[Is64Bit]>; // b,pt %xcc, $imm def : InstAlias, Requires<[Is64Bit]>; // b,a %xcc, $imm def : InstAlias, Requires<[Is64Bit]>; // b,a,pt %xcc, $imm def : InstAlias, Requires<[Is64Bit]>; // b,pn %xcc, $imm def : InstAlias, Requires<[Is64Bit]>; // b,a,pn %xcc, $imm def : InstAlias, Requires<[Is64Bit]>; defm : intcond_mov_alias, Requires<[HasV9]>; defm : intcond_mov_alias, Requires<[Is64Bit]>; // fmovq (%icc|%xcc), $rs2, $rd def : InstAlias, Requires<[HasV9, HasHardQuad]>; def : InstAlias, Requires<[Is64Bit, HasHardQuad]>; // t %icc, rs1 + rs2 def : InstAlias, Requires<[HasV9]>; // t %icc, rs => t %icc, G0 + rs def : InstAlias, Requires<[HasV9]>; // t %xcc, rs1 + rs2 def : InstAlias, Requires<[HasV9]>; // t %xcc, rs => t %xcc, G0 + rs def : InstAlias, Requires<[HasV9]>; // t rs1 + rs2 => t %icc, rs1 + rs2 def : InstAlias; // t rs=> t %icc, G0 + rs2 def : InstAlias; // t %icc, rs1 + imm def : InstAlias, Requires<[HasV9]>; // t %icc, imm => t %icc, G0 + imm def : InstAlias, Requires<[HasV9]>; // t %xcc, rs1 + imm def : InstAlias, Requires<[HasV9]>; // t %xcc, imm => t %xcc, G0 + imm def : InstAlias, Requires<[HasV9]>; // t rs1 + imm => t %icc, rs1 + imm def : InstAlias; // t imm => t %icc, G0 + imm def : InstAlias; } // Instruction aliases for floating point conditional branches and moves. multiclass fp_cond_alias { // fb $imm def : InstAlias; // fb,a $imm def : InstAlias; // fb %fcc0, $imm def : InstAlias, Requires<[HasV9]>; // fb,pt %fcc0, $imm def : InstAlias, Requires<[HasV9]>; // fb,a %fcc0, $imm def : InstAlias, Requires<[HasV9]>; // fb,a,pt %fcc0, $imm def : InstAlias, Requires<[HasV9]>; // fb,pn %fcc0, $imm def : InstAlias, Requires<[HasV9]>; // fb,a,pn %fcc0, $imm def : InstAlias, Requires<[HasV9]>; defm : fpcond_mov_alias, Requires<[HasV9]>; // fmovq %fcc0, $rs2, $rd def : InstAlias, Requires<[HasV9, HasHardQuad]>; } defm : int_cond_alias<"a", 0b1000>; defm : int_cond_alias<"n", 0b0000>; defm : int_cond_alias<"ne", 0b1001>; defm : int_cond_alias<"nz", 0b1001>; // same as ne defm : int_cond_alias<"e", 0b0001>; defm : int_cond_alias<"z", 0b0001>; // same as e defm : int_cond_alias<"g", 0b1010>; defm : int_cond_alias<"le", 0b0010>; defm : int_cond_alias<"ge", 0b1011>; defm : int_cond_alias<"l", 0b0011>; defm : int_cond_alias<"gu", 0b1100>; defm : int_cond_alias<"leu", 0b0100>; defm : int_cond_alias<"cc", 0b1101>; defm : int_cond_alias<"geu", 0b1101>; // same as cc defm : int_cond_alias<"cs", 0b0101>; defm : int_cond_alias<"lu", 0b0101>; // same as cs defm : int_cond_alias<"pos", 0b1110>; defm : int_cond_alias<"neg", 0b0110>; defm : int_cond_alias<"vc", 0b1111>; defm : int_cond_alias<"vs", 0b0111>; defm : fp_cond_alias<"a", 0b0000>; defm : fp_cond_alias<"n", 0b1000>; defm : fp_cond_alias<"u", 0b0111>; defm : fp_cond_alias<"g", 0b0110>; defm : fp_cond_alias<"ug", 0b0101>; defm : fp_cond_alias<"l", 0b0100>; defm : fp_cond_alias<"ul", 0b0011>; defm : fp_cond_alias<"lg", 0b0010>; defm : fp_cond_alias<"ne", 0b0001>; defm : fp_cond_alias<"nz", 0b0001>; // same as ne defm : fp_cond_alias<"e", 0b1001>; defm : fp_cond_alias<"z", 0b1001>; // same as e defm : fp_cond_alias<"ue", 0b1010>; defm : fp_cond_alias<"ge", 0b1011>; defm : fp_cond_alias<"uge", 0b1100>; defm : fp_cond_alias<"le", 0b1101>; defm : fp_cond_alias<"ule", 0b1110>; defm : fp_cond_alias<"o", 0b1111>; // Instruction aliases for JMPL. // jmp addr -> jmpl addr, %g0 def : InstAlias<"jmp $addr", (JMPLrr G0, MEMrr:$addr), 0>; def : InstAlias<"jmp $addr", (JMPLri G0, MEMri:$addr), 0>; // call addr -> jmpl addr, %o7 def : InstAlias<"call $addr", (JMPLrr O7, MEMrr:$addr), 0>; def : InstAlias<"call $addr", (JMPLri O7, MEMri:$addr), 0>; // retl -> RETL 8 def : InstAlias<"retl", (RETL 8)>; // ret -> RET 8 def : InstAlias<"ret", (RET 8)>; // mov reg, rd -> or %g0, reg, rd def : InstAlias<"mov $rs2, $rd", (ORrr IntRegs:$rd, G0, IntRegs:$rs2)>; // mov simm13, rd -> or %g0, simm13, rd def : InstAlias<"mov $simm13, $rd", (ORri IntRegs:$rd, G0, i32imm:$simm13)>; // set value, rd // (turns into a sequence of sethi+or, depending on the value) // def : InstAlias<"set $val, $rd", (ORri IntRegs:$rd, (SETHIi (HI22 imm:$val)), (LO10 imm:$val))>; def SET : AsmPseudoInst<(outs IntRegs:$rd), (ins i32imm:$val), "set $val, $rd">; // restore -> restore %g0, %g0, %g0 def : InstAlias<"restore", (RESTORErr G0, G0, G0)>; def : MnemonicAlias<"return", "rett">, Requires<[HasV9]>; def : MnemonicAlias<"addc", "addx">, Requires<[HasV9]>; def : MnemonicAlias<"addccc", "addxcc">, Requires<[HasV9]>; def : MnemonicAlias<"subc", "subx">, Requires<[HasV9]>; def : MnemonicAlias<"subccc", "subxcc">, Requires<[HasV9]>; def : InstAlias<"fcmps $rs1, $rs2", (V9FCMPS FCC0, FPRegs:$rs1, FPRegs:$rs2)>; def : InstAlias<"fcmpd $rs1, $rs2", (V9FCMPD FCC0, DFPRegs:$rs1, DFPRegs:$rs2)>; def : InstAlias<"fcmpq $rs1, $rs2", (V9FCMPQ FCC0, QFPRegs:$rs1, QFPRegs:$rs2)>, Requires<[HasHardQuad]>; def : InstAlias<"fcmpes $rs1, $rs2", (V9FCMPES FCC0, FPRegs:$rs1, FPRegs:$rs2)>; def : InstAlias<"fcmped $rs1, $rs2", (V9FCMPED FCC0, DFPRegs:$rs1, DFPRegs:$rs2)>; def : InstAlias<"fcmpeq $rs1, $rs2", (V9FCMPEQ FCC0, QFPRegs:$rs1, QFPRegs:$rs2)>, Requires<[HasHardQuad]>;