1//===-- SparcInstrInfo.td - Target Description for Sparc Target -----------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file describes the Sparc instructions in TableGen format. 11// 12//===----------------------------------------------------------------------===// 13 14//===----------------------------------------------------------------------===// 15// Instruction format superclass 16//===----------------------------------------------------------------------===// 17 18include "SparcInstrFormats.td" 19 20//===----------------------------------------------------------------------===// 21// Feature predicates. 22//===----------------------------------------------------------------------===// 23 24// True when generating 32-bit code. 25def Is32Bit : Predicate<"!Subtarget.is64Bit()">; 26 27// True when generating 64-bit code. This also implies HasV9. 28def Is64Bit : Predicate<"Subtarget.is64Bit()">; 29 30// HasV9 - This predicate is true when the target processor supports V9 31// instructions. Note that the machine may be running in 32-bit mode. 32def HasV9 : Predicate<"Subtarget.isV9()">; 33 34// HasNoV9 - This predicate is true when the target doesn't have V9 35// instructions. Use of this is just a hack for the isel not having proper 36// costs for V8 instructions that are more expensive than their V9 ones. 37def HasNoV9 : Predicate<"!Subtarget.isV9()">; 38 39// HasVIS - This is true when the target processor has VIS extensions. 40def HasVIS : Predicate<"Subtarget.isVIS()">; 41 42// HasHardQuad - This is true when the target processor supports quad floating 43// point instructions. 44def HasHardQuad : Predicate<"Subtarget.hasHardQuad()">; 45 46// UseDeprecatedInsts - This predicate is true when the target processor is a 47// V8, or when it is V9 but the V8 deprecated instructions are efficient enough 48// to use when appropriate. In either of these cases, the instruction selector 49// will pick deprecated instructions. 50def UseDeprecatedInsts : Predicate<"Subtarget.useDeprecatedV8Instructions()">; 51 52//===----------------------------------------------------------------------===// 53// Instruction Pattern Stuff 54//===----------------------------------------------------------------------===// 55 56def simm11 : PatLeaf<(imm), [{ return isInt<11>(N->getSExtValue()); }]>; 57 58def simm13 : PatLeaf<(imm), [{ return isInt<13>(N->getSExtValue()); }]>; 59 60def LO10 : SDNodeXForm<imm, [{ 61 return CurDAG->getTargetConstant((unsigned)N->getZExtValue() & 1023, 62 MVT::i32); 63}]>; 64 65def HI22 : SDNodeXForm<imm, [{ 66 // Transformation function: shift the immediate value down into the low bits. 67 return CurDAG->getTargetConstant((unsigned)N->getZExtValue() >> 10, MVT::i32); 68}]>; 69 70def SETHIimm : PatLeaf<(imm), [{ 71 return isShiftedUInt<22, 10>(N->getZExtValue()); 72}], HI22>; 73 74// Addressing modes. 75def ADDRrr : ComplexPattern<iPTR, 2, "SelectADDRrr", [], []>; 76def ADDRri : ComplexPattern<iPTR, 2, "SelectADDRri", [frameindex], []>; 77 78// Address operands
|
79def SparcMEMrrAsmOperand : AsmOperandClass { 80 let Name = "MEMrr"; 81 let ParserMethod = "parseMEMOperand"; 82} 83 84def SparcMEMriAsmOperand : AsmOperandClass { 85 let Name = "MEMri"; 86 let ParserMethod = "parseMEMOperand"; 87} 88 |
89def MEMrr : Operand<iPTR> { 90 let PrintMethod = "printMemOperand"; 91 let MIOperandInfo = (ops ptr_rc, ptr_rc);
|
92 let ParserMatchClass = SparcMEMrrAsmOperand; |
93} 94def MEMri : Operand<iPTR> { 95 let PrintMethod = "printMemOperand"; 96 let MIOperandInfo = (ops ptr_rc, i32imm);
|
97 let ParserMatchClass = SparcMEMriAsmOperand; |
98} 99 100def TLSSym : Operand<iPTR>; 101 102// Branch targets have OtherVT type.
|
91def brtarget : Operand<OtherVT>;
92def calltarget : Operand<i32>;
|
103def brtarget : Operand<OtherVT> { 104 let EncoderMethod = "getBranchTargetOpValue"; 105} |
106
|
107def calltarget : Operand<i32> { 108 let EncoderMethod = "getCallTargetOpValue"; 109} 110 |
111// Operand for printing out a condition code. 112let PrintMethod = "printCCOperand" in 113 def CCOp : Operand<i32>; 114 115def SDTSPcmpicc : 116SDTypeProfile<0, 2, [SDTCisInt<0>, SDTCisSameAs<0, 1>]>; 117def SDTSPcmpfcc : 118SDTypeProfile<0, 2, [SDTCisFP<0>, SDTCisSameAs<0, 1>]>; 119def SDTSPbrcc : 120SDTypeProfile<0, 2, [SDTCisVT<0, OtherVT>, SDTCisVT<1, i32>]>; 121def SDTSPselectcc : 122SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, SDTCisVT<3, i32>]>; 123def SDTSPFTOI : 124SDTypeProfile<1, 1, [SDTCisVT<0, f32>, SDTCisFP<1>]>; 125def SDTSPITOF : 126SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f32>]>; 127def SDTSPFTOX : 128SDTypeProfile<1, 1, [SDTCisVT<0, f64>, SDTCisFP<1>]>; 129def SDTSPXTOF : 130SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f64>]>; 131 132def SDTSPtlsadd : 133SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>; 134def SDTSPtlsld : 135SDTypeProfile<1, 2, [SDTCisPtrTy<0>, SDTCisPtrTy<1>]>; 136 137def SPcmpicc : SDNode<"SPISD::CMPICC", SDTSPcmpicc, [SDNPOutGlue]>; 138def SPcmpfcc : SDNode<"SPISD::CMPFCC", SDTSPcmpfcc, [SDNPOutGlue]>; 139def SPbricc : SDNode<"SPISD::BRICC", SDTSPbrcc, [SDNPHasChain, SDNPInGlue]>; 140def SPbrxcc : SDNode<"SPISD::BRXCC", SDTSPbrcc, [SDNPHasChain, SDNPInGlue]>; 141def SPbrfcc : SDNode<"SPISD::BRFCC", SDTSPbrcc, [SDNPHasChain, SDNPInGlue]>; 142 143def SPhi : SDNode<"SPISD::Hi", SDTIntUnaryOp>; 144def SPlo : SDNode<"SPISD::Lo", SDTIntUnaryOp>; 145 146def SPftoi : SDNode<"SPISD::FTOI", SDTSPFTOI>; 147def SPitof : SDNode<"SPISD::ITOF", SDTSPITOF>; 148def SPftox : SDNode<"SPISD::FTOX", SDTSPFTOX>; 149def SPxtof : SDNode<"SPISD::XTOF", SDTSPXTOF>; 150 151def SPselecticc : SDNode<"SPISD::SELECT_ICC", SDTSPselectcc, [SDNPInGlue]>; 152def SPselectxcc : SDNode<"SPISD::SELECT_XCC", SDTSPselectcc, [SDNPInGlue]>; 153def SPselectfcc : SDNode<"SPISD::SELECT_FCC", SDTSPselectcc, [SDNPInGlue]>; 154 155// These are target-independent nodes, but have target-specific formats. 156def SDT_SPCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>; 157def SDT_SPCallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>, 158 SDTCisVT<1, i32> ]>; 159 160def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_SPCallSeqStart, 161 [SDNPHasChain, SDNPOutGlue]>; 162def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_SPCallSeqEnd, 163 [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>; 164 165def SDT_SPCall : SDTypeProfile<0, -1, [SDTCisVT<0, i32>]>; 166def call : SDNode<"SPISD::CALL", SDT_SPCall, 167 [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue, 168 SDNPVariadic]>; 169 170def SDT_SPRet : SDTypeProfile<0, 1, [SDTCisVT<0, i32>]>; 171def retflag : SDNode<"SPISD::RET_FLAG", SDT_SPRet, 172 [SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>; 173 174def flushw : SDNode<"SPISD::FLUSHW", SDTNone, 175 [SDNPHasChain, SDNPSideEffect, SDNPMayStore]>; 176 177def tlsadd : SDNode<"SPISD::TLS_ADD", SDTSPtlsadd>; 178def tlsld : SDNode<"SPISD::TLS_LD", SDTSPtlsld>; 179def tlscall : SDNode<"SPISD::TLS_CALL", SDT_SPCall, 180 [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue, 181 SDNPVariadic]>; 182
|
166def getPCX : Operand<i32> {
|
183def getPCX : Operand<iPTR> { |
184 let PrintMethod = "printGetPCX"; 185} 186 187//===----------------------------------------------------------------------===// 188// SPARC Flag Conditions 189//===----------------------------------------------------------------------===// 190 191// Note that these values must be kept in sync with the CCOp::CondCode enum 192// values. 193class ICC_VAL<int N> : PatLeaf<(i32 N)>; 194def ICC_NE : ICC_VAL< 9>; // Not Equal 195def ICC_E : ICC_VAL< 1>; // Equal 196def ICC_G : ICC_VAL<10>; // Greater 197def ICC_LE : ICC_VAL< 2>; // Less or Equal 198def ICC_GE : ICC_VAL<11>; // Greater or Equal 199def ICC_L : ICC_VAL< 3>; // Less 200def ICC_GU : ICC_VAL<12>; // Greater Unsigned 201def ICC_LEU : ICC_VAL< 4>; // Less or Equal Unsigned 202def ICC_CC : ICC_VAL<13>; // Carry Clear/Great or Equal Unsigned 203def ICC_CS : ICC_VAL< 5>; // Carry Set/Less Unsigned 204def ICC_POS : ICC_VAL<14>; // Positive 205def ICC_NEG : ICC_VAL< 6>; // Negative 206def ICC_VC : ICC_VAL<15>; // Overflow Clear 207def ICC_VS : ICC_VAL< 7>; // Overflow Set 208 209class FCC_VAL<int N> : PatLeaf<(i32 N)>; 210def FCC_U : FCC_VAL<23>; // Unordered 211def FCC_G : FCC_VAL<22>; // Greater 212def FCC_UG : FCC_VAL<21>; // Unordered or Greater 213def FCC_L : FCC_VAL<20>; // Less 214def FCC_UL : FCC_VAL<19>; // Unordered or Less 215def FCC_LG : FCC_VAL<18>; // Less or Greater 216def FCC_NE : FCC_VAL<17>; // Not Equal 217def FCC_E : FCC_VAL<25>; // Equal 218def FCC_UE : FCC_VAL<24>; // Unordered or Equal 219def FCC_GE : FCC_VAL<25>; // Greater or Equal 220def FCC_UGE : FCC_VAL<26>; // Unordered or Greater or Equal 221def FCC_LE : FCC_VAL<27>; // Less or Equal 222def FCC_ULE : FCC_VAL<28>; // Unordered or Less or Equal 223def FCC_O : FCC_VAL<29>; // Ordered 224 225//===----------------------------------------------------------------------===// 226// Instruction Class Templates 227//===----------------------------------------------------------------------===// 228 229/// F3_12 multiclass - Define a normal F3_1/F3_2 pattern in one shot.
|
213multiclass F3_12<string OpcStr, bits<6> Op3Val, SDNode OpNode> {
|
230multiclass F3_12<string OpcStr, bits<6> Op3Val, SDNode OpNode, 231 RegisterClass RC, ValueType Ty, Operand immOp> { |
232 def rr : F3_1<2, Op3Val,
|
215 (outs IntRegs:$dst), (ins IntRegs:$b, IntRegs:$c),
216 !strconcat(OpcStr, " $b, $c, $dst"),
217 [(set i32:$dst, (OpNode i32:$b, i32:$c))]>;
|
233 (outs RC:$rd), (ins RC:$rs1, RC:$rs2), 234 !strconcat(OpcStr, " $rs1, $rs2, $rd"), 235 [(set Ty:$rd, (OpNode Ty:$rs1, Ty:$rs2))]>; |
236 def ri : F3_2<2, Op3Val,
|
219 (outs IntRegs:$dst), (ins IntRegs:$b, i32imm:$c),
220 !strconcat(OpcStr, " $b, $c, $dst"),
221 [(set i32:$dst, (OpNode i32:$b, (i32 simm13:$c)))]>;
|
237 (outs RC:$rd), (ins RC:$rs1, immOp:$simm13), 238 !strconcat(OpcStr, " $rs1, $simm13, $rd"), 239 [(set Ty:$rd, (OpNode Ty:$rs1, (Ty simm13:$simm13)))]>; |
240} 241 242/// F3_12np multiclass - Define a normal F3_1/F3_2 pattern in one shot, with no 243/// pattern. 244multiclass F3_12np<string OpcStr, bits<6> Op3Val> { 245 def rr : F3_1<2, Op3Val,
|
228 (outs IntRegs:$dst), (ins IntRegs:$b, IntRegs:$c),
229 !strconcat(OpcStr, " $b, $c, $dst"), []>;
|
246 (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2), 247 !strconcat(OpcStr, " $rs1, $rs2, $rd"), []>; |
248 def ri : F3_2<2, Op3Val,
|
231 (outs IntRegs:$dst), (ins IntRegs:$b, i32imm:$c),
232 !strconcat(OpcStr, " $b, $c, $dst"), []>;
|
249 (outs IntRegs:$rd), (ins IntRegs:$rs1, i32imm:$simm13), 250 !strconcat(OpcStr, " $rs1, $simm13, $rd"), []>; |
251} 252
|
253// Load multiclass - Define both Reg+Reg/Reg+Imm patterns in one shot. 254multiclass Load<string OpcStr, bits<6> Op3Val, SDPatternOperator OpNode, 255 RegisterClass RC, ValueType Ty> { 256 def rr : F3_1<3, Op3Val, 257 (outs RC:$dst), (ins MEMrr:$addr), 258 !strconcat(OpcStr, " [$addr], $dst"), 259 [(set Ty:$dst, (OpNode ADDRrr:$addr))]>; 260 def ri : F3_2<3, Op3Val, 261 (outs RC:$dst), (ins MEMri:$addr), 262 !strconcat(OpcStr, " [$addr], $dst"), 263 [(set Ty:$dst, (OpNode ADDRri:$addr))]>; 264} 265 266// Store multiclass - Define both Reg+Reg/Reg+Imm patterns in one shot. 267multiclass Store<string OpcStr, bits<6> Op3Val, SDPatternOperator OpNode, 268 RegisterClass RC, ValueType Ty> { 269 def rr : F3_1<3, Op3Val, 270 (outs), (ins MEMrr:$addr, RC:$rd), 271 !strconcat(OpcStr, " $rd, [$addr]"), 272 [(OpNode Ty:$rd, ADDRrr:$addr)]>; 273 def ri : F3_2<3, Op3Val, 274 (outs), (ins MEMri:$addr, RC:$rd), 275 !strconcat(OpcStr, " $rd, [$addr]"), 276 [(OpNode Ty:$rd, ADDRri:$addr)]>; 277} 278 |
279//===----------------------------------------------------------------------===// 280// Instructions 281//===----------------------------------------------------------------------===// 282 283// Pseudo instructions. 284class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern>
|
241 : InstSP<outs, ins, asmstr, pattern>;
|
285 : InstSP<outs, ins, asmstr, pattern> { 286 let isCodeGenOnly = 1; 287 let isPseudo = 1; 288} |
289 290// GETPCX for PIC 291let Defs = [O7] in { 292 def GETPCX : Pseudo<(outs getPCX:$getpcseq), (ins), "$getpcseq", [] >; 293} 294 295let Defs = [O6], Uses = [O6] in { 296def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i32imm:$amt), 297 "!ADJCALLSTACKDOWN $amt", 298 [(callseq_start timm:$amt)]>; 299def ADJCALLSTACKUP : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2), 300 "!ADJCALLSTACKUP $amt1", 301 [(callseq_end timm:$amt1, timm:$amt2)]>; 302} 303 304let hasSideEffects = 1, mayStore = 1 in { 305 let rd = 0, rs1 = 0, rs2 = 0 in 306 def FLUSHW : F3_1<0b10, 0b101011, (outs), (ins), 307 "flushw", 308 [(flushw)]>, Requires<[HasV9]>; 309 let rd = 0, rs1 = 1, simm13 = 3 in 310 def TA3 : F3_2<0b10, 0b111010, (outs), (ins), 311 "ta 3", 312 [(flushw)]>; 313} 314
|
315let isBarrier = 1, isTerminator = 1, rd = 0b1000, rs1 = 0, simm13 = 5 in 316 def TA5 : F3_2<0b10, 0b111010, (outs), (ins), "ta 5", [(trap)]>; 317 |
318let rd = 0 in 319 def UNIMP : F2_1<0b000, (outs), (ins i32imm:$val), 320 "unimp $val", []>; 321 322// SELECT_CC_* - Used to implement the SELECT_CC DAG operation. Expanded after 323// instruction selection into a branch sequence. This has to handle all 324// permutations of selection between i32/f32/f64 on ICC and FCC. 325// Expanded after instruction selection. 326let Uses = [ICC], usesCustomInserter = 1 in { 327 def SELECT_CC_Int_ICC 328 : Pseudo<(outs IntRegs:$dst), (ins IntRegs:$T, IntRegs:$F, i32imm:$Cond), 329 "; SELECT_CC_Int_ICC PSEUDO!", 330 [(set i32:$dst, (SPselecticc i32:$T, i32:$F, imm:$Cond))]>; 331 def SELECT_CC_FP_ICC 332 : Pseudo<(outs FPRegs:$dst), (ins FPRegs:$T, FPRegs:$F, i32imm:$Cond), 333 "; SELECT_CC_FP_ICC PSEUDO!", 334 [(set f32:$dst, (SPselecticc f32:$T, f32:$F, imm:$Cond))]>; 335 336 def SELECT_CC_DFP_ICC 337 : Pseudo<(outs DFPRegs:$dst), (ins DFPRegs:$T, DFPRegs:$F, i32imm:$Cond), 338 "; SELECT_CC_DFP_ICC PSEUDO!", 339 [(set f64:$dst, (SPselecticc f64:$T, f64:$F, imm:$Cond))]>; 340 341 def SELECT_CC_QFP_ICC 342 : Pseudo<(outs QFPRegs:$dst), (ins QFPRegs:$T, QFPRegs:$F, i32imm:$Cond), 343 "; SELECT_CC_QFP_ICC PSEUDO!", 344 [(set f128:$dst, (SPselecticc f128:$T, f128:$F, imm:$Cond))]>; 345} 346 347let usesCustomInserter = 1, Uses = [FCC] in { 348 349 def SELECT_CC_Int_FCC 350 : Pseudo<(outs IntRegs:$dst), (ins IntRegs:$T, IntRegs:$F, i32imm:$Cond), 351 "; SELECT_CC_Int_FCC PSEUDO!", 352 [(set i32:$dst, (SPselectfcc i32:$T, i32:$F, imm:$Cond))]>; 353 354 def SELECT_CC_FP_FCC 355 : Pseudo<(outs FPRegs:$dst), (ins FPRegs:$T, FPRegs:$F, i32imm:$Cond), 356 "; SELECT_CC_FP_FCC PSEUDO!", 357 [(set f32:$dst, (SPselectfcc f32:$T, f32:$F, imm:$Cond))]>; 358 def SELECT_CC_DFP_FCC 359 : Pseudo<(outs DFPRegs:$dst), (ins DFPRegs:$T, DFPRegs:$F, i32imm:$Cond), 360 "; SELECT_CC_DFP_FCC PSEUDO!", 361 [(set f64:$dst, (SPselectfcc f64:$T, f64:$F, imm:$Cond))]>; 362 def SELECT_CC_QFP_FCC 363 : Pseudo<(outs QFPRegs:$dst), (ins QFPRegs:$T, QFPRegs:$F, i32imm:$Cond), 364 "; SELECT_CC_QFP_FCC PSEUDO!", 365 [(set f128:$dst, (SPselectfcc f128:$T, f128:$F, imm:$Cond))]>; 366} 367
|
368// JMPL Instruction. 369let isTerminator = 1, hasDelaySlot = 1, isBarrier = 1 in { 370 def JMPLrr: F3_1<2, 0b111000, (outs IntRegs:$dst), (ins MEMrr:$addr), 371 "jmpl $addr, $dst", []>; 372 def JMPLri: F3_2<2, 0b111000, (outs IntRegs:$dst), (ins MEMri:$addr), 373 "jmpl $addr, $dst", []>; 374} |
375 376// Section A.3 - Synthetic Instructions, p. 85 377// special cases of JMPL:
|
321let isReturn = 1, isTerminator = 1, hasDelaySlot = 1, isBarrier = 1 in {
|
378let isReturn = 1, isTerminator = 1, hasDelaySlot = 1, isBarrier = 1, 379 isCodeGenOnly = 1 in { |
380 let rd = 0, rs1 = 15 in 381 def RETL: F3_2<2, 0b111000, (outs), (ins i32imm:$val), 382 "jmp %o7+$val", [(retflag simm13:$val)]>; 383 384 let rd = 0, rs1 = 31 in 385 def RET: F3_2<2, 0b111000, (outs), (ins i32imm:$val), 386 "jmp %i7+$val", []>; 387} 388 389// Section B.1 - Load Integer Instructions, p. 90
|
332def LDSBrr : F3_1<3, 0b001001,
333 (outs IntRegs:$dst), (ins MEMrr:$addr),
334 "ldsb [$addr], $dst",
335 [(set i32:$dst, (sextloadi8 ADDRrr:$addr))]>;
336def LDSBri : F3_2<3, 0b001001,
337 (outs IntRegs:$dst), (ins MEMri:$addr),
338 "ldsb [$addr], $dst",
339 [(set i32:$dst, (sextloadi8 ADDRri:$addr))]>;
340def LDSHrr : F3_1<3, 0b001010,
341 (outs IntRegs:$dst), (ins MEMrr:$addr),
342 "ldsh [$addr], $dst",
343 [(set i32:$dst, (sextloadi16 ADDRrr:$addr))]>;
344def LDSHri : F3_2<3, 0b001010,
345 (outs IntRegs:$dst), (ins MEMri:$addr),
346 "ldsh [$addr], $dst",
347 [(set i32:$dst, (sextloadi16 ADDRri:$addr))]>;
348def LDUBrr : F3_1<3, 0b000001,
349 (outs IntRegs:$dst), (ins MEMrr:$addr),
350 "ldub [$addr], $dst",
351 [(set i32:$dst, (zextloadi8 ADDRrr:$addr))]>;
352def LDUBri : F3_2<3, 0b000001,
353 (outs IntRegs:$dst), (ins MEMri:$addr),
354 "ldub [$addr], $dst",
355 [(set i32:$dst, (zextloadi8 ADDRri:$addr))]>;
356def LDUHrr : F3_1<3, 0b000010,
357 (outs IntRegs:$dst), (ins MEMrr:$addr),
358 "lduh [$addr], $dst",
359 [(set i32:$dst, (zextloadi16 ADDRrr:$addr))]>;
360def LDUHri : F3_2<3, 0b000010,
361 (outs IntRegs:$dst), (ins MEMri:$addr),
362 "lduh [$addr], $dst",
363 [(set i32:$dst, (zextloadi16 ADDRri:$addr))]>;
364def LDrr : F3_1<3, 0b000000,
365 (outs IntRegs:$dst), (ins MEMrr:$addr),
366 "ld [$addr], $dst",
367 [(set i32:$dst, (load ADDRrr:$addr))]>;
368def LDri : F3_2<3, 0b000000,
369 (outs IntRegs:$dst), (ins MEMri:$addr),
370 "ld [$addr], $dst",
371 [(set i32:$dst, (load ADDRri:$addr))]>;
|
390defm LDSB : Load<"ldsb", 0b001001, sextloadi8, IntRegs, i32>; 391defm LDSH : Load<"ldsh", 0b001010, sextloadi16, IntRegs, i32>; 392defm LDUB : Load<"ldub", 0b000001, zextloadi8, IntRegs, i32>; 393defm LDUH : Load<"lduh", 0b000010, zextloadi16, IntRegs, i32>; 394defm LD : Load<"ld", 0b000000, load, IntRegs, i32>; |
395 396// Section B.2 - Load Floating-point Instructions, p. 92
|
374def LDFrr : F3_1<3, 0b100000,
375 (outs FPRegs:$dst), (ins MEMrr:$addr),
376 "ld [$addr], $dst",
377 [(set f32:$dst, (load ADDRrr:$addr))]>;
378def LDFri : F3_2<3, 0b100000,
379 (outs FPRegs:$dst), (ins MEMri:$addr),
380 "ld [$addr], $dst",
381 [(set f32:$dst, (load ADDRri:$addr))]>;
382def LDDFrr : F3_1<3, 0b100011,
383 (outs DFPRegs:$dst), (ins MEMrr:$addr),
384 "ldd [$addr], $dst",
385 [(set f64:$dst, (load ADDRrr:$addr))]>;
386def LDDFri : F3_2<3, 0b100011,
387 (outs DFPRegs:$dst), (ins MEMri:$addr),
388 "ldd [$addr], $dst",
389 [(set f64:$dst, (load ADDRri:$addr))]>;
390def LDQFrr : F3_1<3, 0b100010,
391 (outs QFPRegs:$dst), (ins MEMrr:$addr),
392 "ldq [$addr], $dst",
393 [(set f128:$dst, (load ADDRrr:$addr))]>,
394 Requires<[HasV9, HasHardQuad]>;
395def LDQFri : F3_2<3, 0b100010,
396 (outs QFPRegs:$dst), (ins MEMri:$addr),
397 "ldq [$addr], $dst",
398 [(set f128:$dst, (load ADDRri:$addr))]>,
399 Requires<[HasV9, HasHardQuad]>;
|
397defm LDF : Load<"ld", 0b100000, load, FPRegs, f32>; 398defm LDDF : Load<"ldd", 0b100011, load, DFPRegs, f64>; 399defm LDQF : Load<"ldq", 0b100010, load, QFPRegs, f128>, 400 Requires<[HasV9, HasHardQuad]>; |
401 402// Section B.4 - Store Integer Instructions, p. 95
|
402def STBrr : F3_1<3, 0b000101,
403 (outs), (ins MEMrr:$addr, IntRegs:$rd),
404 "stb $rd, [$addr]",
405 [(truncstorei8 i32:$rd, ADDRrr:$addr)]>;
406def STBri : F3_2<3, 0b000101,
407 (outs), (ins MEMri:$addr, IntRegs:$rd),
408 "stb $rd, [$addr]",
409 [(truncstorei8 i32:$rd, ADDRri:$addr)]>;
410def STHrr : F3_1<3, 0b000110,
411 (outs), (ins MEMrr:$addr, IntRegs:$rd),
412 "sth $rd, [$addr]",
413 [(truncstorei16 i32:$rd, ADDRrr:$addr)]>;
414def STHri : F3_2<3, 0b000110,
415 (outs), (ins MEMri:$addr, IntRegs:$rd),
416 "sth $rd, [$addr]",
417 [(truncstorei16 i32:$rd, ADDRri:$addr)]>;
418def STrr : F3_1<3, 0b000100,
419 (outs), (ins MEMrr:$addr, IntRegs:$rd),
420 "st $rd, [$addr]",
421 [(store i32:$rd, ADDRrr:$addr)]>;
422def STri : F3_2<3, 0b000100,
423 (outs), (ins MEMri:$addr, IntRegs:$rd),
424 "st $rd, [$addr]",
425 [(store i32:$rd, ADDRri:$addr)]>;
|
403defm STB : Store<"stb", 0b000101, truncstorei8, IntRegs, i32>; 404defm STH : Store<"sth", 0b000110, truncstorei16, IntRegs, i32>; 405defm ST : Store<"st", 0b000100, store, IntRegs, i32>; |
406 407// Section B.5 - Store Floating-point Instructions, p. 97
|
428def STFrr : F3_1<3, 0b100100,
429 (outs), (ins MEMrr:$addr, FPRegs:$rd),
430 "st $rd, [$addr]",
431 [(store f32:$rd, ADDRrr:$addr)]>;
432def STFri : F3_2<3, 0b100100,
433 (outs), (ins MEMri:$addr, FPRegs:$rd),
434 "st $rd, [$addr]",
435 [(store f32:$rd, ADDRri:$addr)]>;
436def STDFrr : F3_1<3, 0b100111,
437 (outs), (ins MEMrr:$addr, DFPRegs:$rd),
438 "std $rd, [$addr]",
439 [(store f64:$rd, ADDRrr:$addr)]>;
440def STDFri : F3_2<3, 0b100111,
441 (outs), (ins MEMri:$addr, DFPRegs:$rd),
442 "std $rd, [$addr]",
443 [(store f64:$rd, ADDRri:$addr)]>;
444def STQFrr : F3_1<3, 0b100110,
445 (outs), (ins MEMrr:$addr, QFPRegs:$rd),
446 "stq $rd, [$addr]",
447 [(store f128:$rd, ADDRrr:$addr)]>,
448 Requires<[HasV9, HasHardQuad]>;
449def STQFri : F3_2<3, 0b100110,
450 (outs), (ins MEMri:$addr, QFPRegs:$rd),
451 "stq $rd, [$addr]",
452 [(store f128:$rd, ADDRri:$addr)]>,
453 Requires<[HasV9, HasHardQuad]>;
|
408defm STF : Store<"st", 0b100100, store, FPRegs, f32>; 409defm STDF : Store<"std", 0b100111, store, DFPRegs, f64>; 410defm STQF : Store<"stq", 0b100110, store, QFPRegs, f128>, 411 Requires<[HasV9, HasHardQuad]>; |
412 413// Section B.9 - SETHI Instruction, p. 104 414def SETHIi: F2_1<0b100, 415 (outs IntRegs:$rd), (ins i32imm:$imm22), 416 "sethi $imm22, $rd", 417 [(set i32:$rd, SETHIimm:$imm22)]>; 418 419// Section B.10 - NOP Instruction, p. 105 420// (It's a special case of SETHI) 421let rd = 0, imm22 = 0 in 422 def NOP : F2_1<0b100, (outs), (ins), "nop", []>; 423 424// Section B.11 - Logical Instructions, p. 106
|
467defm AND : F3_12<"and", 0b000001, and>;
|
425defm AND : F3_12<"and", 0b000001, and, IntRegs, i32, i32imm>; |
426 427def ANDNrr : F3_1<2, 0b000101,
|
470 (outs IntRegs:$dst), (ins IntRegs:$b, IntRegs:$c),
471 "andn $b, $c, $dst",
472 [(set i32:$dst, (and i32:$b, (not i32:$c)))]>;
|
428 (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2), 429 "andn $rs1, $rs2, $rd", 430 [(set i32:$rd, (and i32:$rs1, (not i32:$rs2)))]>; |
431def ANDNri : F3_2<2, 0b000101,
|
474 (outs IntRegs:$dst), (ins IntRegs:$b, i32imm:$c),
475 "andn $b, $c, $dst", []>;
|
432 (outs IntRegs:$rd), (ins IntRegs:$rs1, i32imm:$simm13), 433 "andn $rs1, $simm13, $rd", []>; |
434
|
477defm OR : F3_12<"or", 0b000010, or>;
|
435defm OR : F3_12<"or", 0b000010, or, IntRegs, i32, i32imm>; |
436 437def ORNrr : F3_1<2, 0b000110,
|
480 (outs IntRegs:$dst), (ins IntRegs:$b, IntRegs:$c),
481 "orn $b, $c, $dst",
482 [(set i32:$dst, (or i32:$b, (not i32:$c)))]>;
|
438 (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2), 439 "orn $rs1, $rs2, $rd", 440 [(set i32:$rd, (or i32:$rs1, (not i32:$rs2)))]>; |
441def ORNri : F3_2<2, 0b000110,
|
484 (outs IntRegs:$dst), (ins IntRegs:$b, i32imm:$c),
485 "orn $b, $c, $dst", []>;
486defm XOR : F3_12<"xor", 0b000011, xor>;
|
442 (outs IntRegs:$rd), (ins IntRegs:$rs1, i32imm:$simm13), 443 "orn $rs1, $simm13, $rd", []>; 444defm XOR : F3_12<"xor", 0b000011, xor, IntRegs, i32, i32imm>; |
445 446def XNORrr : F3_1<2, 0b000111,
|
489 (outs IntRegs:$dst), (ins IntRegs:$b, IntRegs:$c),
490 "xnor $b, $c, $dst",
491 [(set i32:$dst, (not (xor i32:$b, i32:$c)))]>;
|
447 (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2), 448 "xnor $rs1, $rs2, $rd", 449 [(set i32:$rd, (not (xor i32:$rs1, i32:$rs2)))]>; |
450def XNORri : F3_2<2, 0b000111,
|
493 (outs IntRegs:$dst), (ins IntRegs:$b, i32imm:$c),
494 "xnor $b, $c, $dst", []>;
|
451 (outs IntRegs:$rd), (ins IntRegs:$rs1, i32imm:$simm13), 452 "xnor $rs1, $simm13, $rd", []>; |
453 454// Section B.12 - Shift Instructions, p. 107
|
497defm SLL : F3_12<"sll", 0b100101, shl>;
498defm SRL : F3_12<"srl", 0b100110, srl>;
499defm SRA : F3_12<"sra", 0b100111, sra>;
|
455defm SLL : F3_12<"sll", 0b100101, shl, IntRegs, i32, i32imm>; 456defm SRL : F3_12<"srl", 0b100110, srl, IntRegs, i32, i32imm>; 457defm SRA : F3_12<"sra", 0b100111, sra, IntRegs, i32, i32imm>; |
458 459// Section B.13 - Add Instructions, p. 108
|
502defm ADD : F3_12<"add", 0b000000, add>;
|
460defm ADD : F3_12<"add", 0b000000, add, IntRegs, i32, i32imm>; |
461 462// "LEA" forms of add (patterns to make tblgen happy)
|
505let Predicates = [Is32Bit] in
|
463let Predicates = [Is32Bit], isCodeGenOnly = 1 in |
464 def LEA_ADDri : F3_2<2, 0b000000, 465 (outs IntRegs:$dst), (ins MEMri:$addr), 466 "add ${addr:arith}, $dst", 467 [(set iPTR:$dst, ADDRri:$addr)]>; 468 469let Defs = [ICC] in
|
512 defm ADDCC : F3_12<"addcc", 0b010000, addc>;
|
470 defm ADDCC : F3_12<"addcc", 0b010000, addc, IntRegs, i32, i32imm>; |
471 472let Uses = [ICC], Defs = [ICC] in
|
515 defm ADDX : F3_12<"addxcc", 0b011000, adde>;
|
473 defm ADDE : F3_12<"addxcc", 0b011000, adde, IntRegs, i32, i32imm>; |
474 475// Section B.15 - Subtract Instructions, p. 110
|
518defm SUB : F3_12 <"sub" , 0b000100, sub>;
|
476defm SUB : F3_12 <"sub" , 0b000100, sub, IntRegs, i32, i32imm>; |
477let Uses = [ICC], Defs = [ICC] in
|
520 defm SUBX : F3_12 <"subxcc" , 0b011100, sube>;
|
478 defm SUBE : F3_12 <"subxcc" , 0b011100, sube, IntRegs, i32, i32imm>; |
479 480let Defs = [ICC] in
|
523 defm SUBCC : F3_12 <"subcc", 0b010100, subc>;
|
481 defm SUBCC : F3_12 <"subcc", 0b010100, subc, IntRegs, i32, i32imm>; |
482 483let Defs = [ICC], rd = 0 in { 484 def CMPrr : F3_1<2, 0b010100,
|
527 (outs), (ins IntRegs:$b, IntRegs:$c),
528 "cmp $b, $c",
529 [(SPcmpicc i32:$b, i32:$c)]>;
|
485 (outs), (ins IntRegs:$rs1, IntRegs:$rs2), 486 "cmp $rs1, $rs2", 487 [(SPcmpicc i32:$rs1, i32:$rs2)]>; |
488 def CMPri : F3_2<2, 0b010100,
|
531 (outs), (ins IntRegs:$b, i32imm:$c),
532 "cmp $b, $c",
533 [(SPcmpicc i32:$b, (i32 simm13:$c))]>;
|
489 (outs), (ins IntRegs:$rs1, i32imm:$simm13), 490 "cmp $rs1, $simm13", 491 [(SPcmpicc i32:$rs1, (i32 simm13:$simm13))]>; |
492} 493
|
536let Uses = [ICC], Defs = [ICC] in
537 def SUBXCCrr: F3_1<2, 0b011100,
538 (outs IntRegs:$dst), (ins IntRegs:$b, IntRegs:$c),
539 "subxcc $b, $c, $dst", []>;
540
541
|
494// Section B.18 - Multiply Instructions, p. 113 495let Defs = [Y] in { 496 defm UMUL : F3_12np<"umul", 0b001010>;
|
545 defm SMUL : F3_12 <"smul", 0b001011, mul>;
|
497 defm SMUL : F3_12 <"smul", 0b001011, mul, IntRegs, i32, i32imm>; |
498} 499 500// Section B.19 - Divide Instructions, p. 115 501let Defs = [Y] in { 502 defm UDIV : F3_12np<"udiv", 0b001110>; 503 defm SDIV : F3_12np<"sdiv", 0b001111>; 504} 505 506// Section B.20 - SAVE and RESTORE, p. 117 507defm SAVE : F3_12np<"save" , 0b111100>; 508defm RESTORE : F3_12np<"restore", 0b111101>; 509 510// Section B.21 - Branch on Integer Condition Codes Instructions, p. 119 511 512// unconditional branch class. 513class BranchAlways<dag ins, string asmstr, list<dag> pattern> 514 : F2_2<0b010, (outs), ins, asmstr, pattern> { 515 let isBranch = 1; 516 let isTerminator = 1; 517 let hasDelaySlot = 1; 518 let isBarrier = 1; 519} 520 521let cond = 8 in 522 def BA : BranchAlways<(ins brtarget:$imm22), "ba $imm22", [(br bb:$imm22)]>; 523 524// conditional branch class: 525class BranchSP<dag ins, string asmstr, list<dag> pattern> 526 : F2_2<0b010, (outs), ins, asmstr, pattern> { 527 let isBranch = 1; 528 let isTerminator = 1; 529 let hasDelaySlot = 1; 530} 531 532// Indirect branch instructions.
|
581let isTerminator = 1, isBarrier = 1,
582 hasDelaySlot = 1, isBranch =1,
583 isIndirectBranch = 1, rd = 0 in {
|
533let isTerminator = 1, isBarrier = 1, hasDelaySlot = 1, isBranch =1, 534 isIndirectBranch = 1, rd = 0, isCodeGenOnly = 1 in { |
535 def BINDrr : F3_1<2, 0b111000, 536 (outs), (ins MEMrr:$ptr), 537 "jmp $ptr", 538 [(brind ADDRrr:$ptr)]>; 539 def BINDri : F3_2<2, 0b111000, 540 (outs), (ins MEMri:$ptr), 541 "jmp $ptr", 542 [(brind ADDRri:$ptr)]>; 543} 544 545let Uses = [ICC] in 546 def BCOND : BranchSP<(ins brtarget:$imm22, CCOp:$cond), 547 "b$cond $imm22", 548 [(SPbricc bb:$imm22, imm:$cond)]>; 549 550// Section B.22 - Branch on Floating-point Condition Codes Instructions, p. 121 551 552// floating-point conditional branch class: 553class FPBranchSP<dag ins, string asmstr, list<dag> pattern> 554 : F2_2<0b110, (outs), ins, asmstr, pattern> { 555 let isBranch = 1; 556 let isTerminator = 1; 557 let hasDelaySlot = 1; 558} 559 560let Uses = [FCC] in 561 def FBCOND : FPBranchSP<(ins brtarget:$imm22, CCOp:$cond), 562 "fb$cond $imm22", 563 [(SPbrfcc bb:$imm22, imm:$cond)]>; 564 565 566// Section B.24 - Call and Link Instruction, p. 125 567// This is the only Format 1 instruction 568let Uses = [O6], 569 hasDelaySlot = 1, isCall = 1 in { 570 def CALL : InstSP<(outs), (ins calltarget:$dst, variable_ops), 571 "call $dst", []> { 572 bits<30> disp; 573 let op = 1; 574 let Inst{29-0} = disp; 575 } 576
|
626 // indirect calls
627 def JMPLrr : F3_1<2, 0b111000,
628 (outs), (ins MEMrr:$ptr, variable_ops),
629 "call $ptr",
630 [(call ADDRrr:$ptr)]> { let rd = 15; }
631 def JMPLri : F3_2<2, 0b111000,
632 (outs), (ins MEMri:$ptr, variable_ops),
633 "call $ptr",
634 [(call ADDRri:$ptr)]> { let rd = 15; }
|
577 // indirect calls: special cases of JMPL. 578 let isCodeGenOnly = 1, rd = 15 in { 579 def CALLrr : F3_1<2, 0b111000, 580 (outs), (ins MEMrr:$ptr, variable_ops), 581 "call $ptr", 582 [(call ADDRrr:$ptr)]>; 583 def CALLri : F3_2<2, 0b111000, 584 (outs), (ins MEMri:$ptr, variable_ops), 585 "call $ptr", 586 [(call ADDRri:$ptr)]>; 587 } |
588} 589 590// Section B.28 - Read State Register Instructions 591let Uses = [Y], rs1 = 0, rs2 = 0 in 592 def RDY : F3_1<2, 0b101000, 593 (outs IntRegs:$dst), (ins), 594 "rd %y, $dst", []>; 595 596// Section B.29 - Write State Register Instructions 597let Defs = [Y], rd = 0 in { 598 def WRYrr : F3_1<2, 0b110000, 599 (outs), (ins IntRegs:$b, IntRegs:$c), 600 "wr $b, $c, %y", []>; 601 def WRYri : F3_2<2, 0b110000, 602 (outs), (ins IntRegs:$b, i32imm:$c), 603 "wr $b, $c, %y", []>; 604} 605// Convert Integer to Floating-point Instructions, p. 141 606def FITOS : F3_3u<2, 0b110100, 0b011000100,
|
654 (outs FPRegs:$dst), (ins FPRegs:$src),
655 "fitos $src, $dst",
656 [(set FPRegs:$dst, (SPitof FPRegs:$src))]>;
|
607 (outs FPRegs:$rd), (ins FPRegs:$rs2), 608 "fitos $rs2, $rd", 609 [(set FPRegs:$rd, (SPitof FPRegs:$rs2))]>; |
610def FITOD : F3_3u<2, 0b110100, 0b011001000,
|
658 (outs DFPRegs:$dst), (ins FPRegs:$src),
659 "fitod $src, $dst",
660 [(set DFPRegs:$dst, (SPitof FPRegs:$src))]>;
|
611 (outs DFPRegs:$rd), (ins FPRegs:$rs2), 612 "fitod $rs2, $rd", 613 [(set DFPRegs:$rd, (SPitof FPRegs:$rs2))]>; |
614def FITOQ : F3_3u<2, 0b110100, 0b011001100,
|
662 (outs QFPRegs:$dst), (ins FPRegs:$src),
663 "fitoq $src, $dst",
664 [(set QFPRegs:$dst, (SPitof FPRegs:$src))]>,
|
615 (outs QFPRegs:$rd), (ins FPRegs:$rs2), 616 "fitoq $rs2, $rd", 617 [(set QFPRegs:$rd, (SPitof FPRegs:$rs2))]>, |
618 Requires<[HasHardQuad]>; 619 620// Convert Floating-point to Integer Instructions, p. 142 621def FSTOI : F3_3u<2, 0b110100, 0b011010001,
|
669 (outs FPRegs:$dst), (ins FPRegs:$src),
670 "fstoi $src, $dst",
671 [(set FPRegs:$dst, (SPftoi FPRegs:$src))]>;
|
622 (outs FPRegs:$rd), (ins FPRegs:$rs2), 623 "fstoi $rs2, $rd", 624 [(set FPRegs:$rd, (SPftoi FPRegs:$rs2))]>; |
625def FDTOI : F3_3u<2, 0b110100, 0b011010010,
|
673 (outs FPRegs:$dst), (ins DFPRegs:$src),
674 "fdtoi $src, $dst",
675 [(set FPRegs:$dst, (SPftoi DFPRegs:$src))]>;
|
626 (outs FPRegs:$rd), (ins DFPRegs:$rs2), 627 "fdtoi $rs2, $rd", 628 [(set FPRegs:$rd, (SPftoi DFPRegs:$rs2))]>; |
629def FQTOI : F3_3u<2, 0b110100, 0b011010011,
|
677 (outs FPRegs:$dst), (ins QFPRegs:$src),
678 "fqtoi $src, $dst",
679 [(set FPRegs:$dst, (SPftoi QFPRegs:$src))]>,
|
630 (outs FPRegs:$rd), (ins QFPRegs:$rs2), 631 "fqtoi $rs2, $rd", 632 [(set FPRegs:$rd, (SPftoi QFPRegs:$rs2))]>, |
633 Requires<[HasHardQuad]>; 634 635// Convert between Floating-point Formats Instructions, p. 143 636def FSTOD : F3_3u<2, 0b110100, 0b011001001,
|
684 (outs DFPRegs:$dst), (ins FPRegs:$src),
685 "fstod $src, $dst",
686 [(set f64:$dst, (fextend f32:$src))]>;
|
637 (outs DFPRegs:$rd), (ins FPRegs:$rs2), 638 "fstod $rs2, $rd", 639 [(set f64:$rd, (fextend f32:$rs2))]>; |
640def FSTOQ : F3_3u<2, 0b110100, 0b011001101,
|
688 (outs QFPRegs:$dst), (ins FPRegs:$src),
689 "fstoq $src, $dst",
690 [(set f128:$dst, (fextend f32:$src))]>,
|
641 (outs QFPRegs:$rd), (ins FPRegs:$rs2), 642 "fstoq $rs2, $rd", 643 [(set f128:$rd, (fextend f32:$rs2))]>, |
644 Requires<[HasHardQuad]>; 645def FDTOS : F3_3u<2, 0b110100, 0b011000110,
|
693 (outs FPRegs:$dst), (ins DFPRegs:$src),
694 "fdtos $src, $dst",
695 [(set f32:$dst, (fround f64:$src))]>;
696def FDTOQ : F3_3u<2, 0b110100, 0b01101110,
697 (outs QFPRegs:$dst), (ins DFPRegs:$src),
698 "fdtoq $src, $dst",
699 [(set f128:$dst, (fextend f64:$src))]>,
|
646 (outs FPRegs:$rd), (ins DFPRegs:$rs2), 647 "fdtos $rs2, $rd", 648 [(set f32:$rd, (fround f64:$rs2))]>; 649def FDTOQ : F3_3u<2, 0b110100, 0b011001110, 650 (outs QFPRegs:$rd), (ins DFPRegs:$rs2), 651 "fdtoq $rs2, $rd", 652 [(set f128:$rd, (fextend f64:$rs2))]>, |
653 Requires<[HasHardQuad]>; 654def FQTOS : F3_3u<2, 0b110100, 0b011000111,
|
702 (outs FPRegs:$dst), (ins QFPRegs:$src),
703 "fqtos $src, $dst",
704 [(set f32:$dst, (fround f128:$src))]>,
|
655 (outs FPRegs:$rd), (ins QFPRegs:$rs2), 656 "fqtos $rs2, $rd", 657 [(set f32:$rd, (fround f128:$rs2))]>, |
658 Requires<[HasHardQuad]>; 659def FQTOD : F3_3u<2, 0b110100, 0b011001011,
|
707 (outs DFPRegs:$dst), (ins QFPRegs:$src),
708 "fqtod $src, $dst",
709 [(set f64:$dst, (fround f128:$src))]>,
|
660 (outs DFPRegs:$rd), (ins QFPRegs:$rs2), 661 "fqtod $rs2, $rd", 662 [(set f64:$rd, (fround f128:$rs2))]>, |
663 Requires<[HasHardQuad]>; 664 665// Floating-point Move Instructions, p. 144 666def FMOVS : F3_3u<2, 0b110100, 0b000000001,
|
714 (outs FPRegs:$dst), (ins FPRegs:$src),
715 "fmovs $src, $dst", []>;
|
667 (outs FPRegs:$rd), (ins FPRegs:$rs2), 668 "fmovs $rs2, $rd", []>; |
669def FNEGS : F3_3u<2, 0b110100, 0b000000101,
|
717 (outs FPRegs:$dst), (ins FPRegs:$src),
718 "fnegs $src, $dst",
719 [(set f32:$dst, (fneg f32:$src))]>;
|
670 (outs FPRegs:$rd), (ins FPRegs:$rs2), 671 "fnegs $rs2, $rd", 672 [(set f32:$rd, (fneg f32:$rs2))]>; |
673def FABSS : F3_3u<2, 0b110100, 0b000001001,
|
721 (outs FPRegs:$dst), (ins FPRegs:$src),
722 "fabss $src, $dst",
723 [(set f32:$dst, (fabs f32:$src))]>;
|
674 (outs FPRegs:$rd), (ins FPRegs:$rs2), 675 "fabss $rs2, $rd", 676 [(set f32:$rd, (fabs f32:$rs2))]>; |
677 678 679// Floating-point Square Root Instructions, p.145 680def FSQRTS : F3_3u<2, 0b110100, 0b000101001,
|
728 (outs FPRegs:$dst), (ins FPRegs:$src),
729 "fsqrts $src, $dst",
730 [(set f32:$dst, (fsqrt f32:$src))]>;
|
681 (outs FPRegs:$rd), (ins FPRegs:$rs2), 682 "fsqrts $rs2, $rd", 683 [(set f32:$rd, (fsqrt f32:$rs2))]>; |
684def FSQRTD : F3_3u<2, 0b110100, 0b000101010,
|
732 (outs DFPRegs:$dst), (ins DFPRegs:$src),
733 "fsqrtd $src, $dst",
734 [(set f64:$dst, (fsqrt f64:$src))]>;
|
685 (outs DFPRegs:$rd), (ins DFPRegs:$rs2), 686 "fsqrtd $rs2, $rd", 687 [(set f64:$rd, (fsqrt f64:$rs2))]>; |
688def FSQRTQ : F3_3u<2, 0b110100, 0b000101011,
|
736 (outs QFPRegs:$dst), (ins QFPRegs:$src),
737 "fsqrtq $src, $dst",
738 [(set f128:$dst, (fsqrt f128:$src))]>,
|
689 (outs QFPRegs:$rd), (ins QFPRegs:$rs2), 690 "fsqrtq $rs2, $rd", 691 [(set f128:$rd, (fsqrt f128:$rs2))]>, |
692 Requires<[HasHardQuad]>; 693 694 695 696// Floating-point Add and Subtract Instructions, p. 146 697def FADDS : F3_3<2, 0b110100, 0b001000001,
|
745 (outs FPRegs:$dst), (ins FPRegs:$src1, FPRegs:$src2),
746 "fadds $src1, $src2, $dst",
747 [(set f32:$dst, (fadd f32:$src1, f32:$src2))]>;
|
698 (outs FPRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2), 699 "fadds $rs1, $rs2, $rd", 700 [(set f32:$rd, (fadd f32:$rs1, f32:$rs2))]>; |
701def FADDD : F3_3<2, 0b110100, 0b001000010,
|
749 (outs DFPRegs:$dst), (ins DFPRegs:$src1, DFPRegs:$src2),
750 "faddd $src1, $src2, $dst",
751 [(set f64:$dst, (fadd f64:$src1, f64:$src2))]>;
|
702 (outs DFPRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2), 703 "faddd $rs1, $rs2, $rd", 704 [(set f64:$rd, (fadd f64:$rs1, f64:$rs2))]>; |
705def FADDQ : F3_3<2, 0b110100, 0b001000011,
|
753 (outs QFPRegs:$dst), (ins QFPRegs:$src1, QFPRegs:$src2),
754 "faddq $src1, $src2, $dst",
755 [(set f128:$dst, (fadd f128:$src1, f128:$src2))]>,
|
706 (outs QFPRegs:$rd), (ins QFPRegs:$rs1, QFPRegs:$rs2), 707 "faddq $rs1, $rs2, $rd", 708 [(set f128:$rd, (fadd f128:$rs1, f128:$rs2))]>, |
709 Requires<[HasHardQuad]>; 710 711def FSUBS : F3_3<2, 0b110100, 0b001000101,
|
759 (outs FPRegs:$dst), (ins FPRegs:$src1, FPRegs:$src2),
760 "fsubs $src1, $src2, $dst",
761 [(set f32:$dst, (fsub f32:$src1, f32:$src2))]>;
|
712 (outs FPRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2), 713 "fsubs $rs1, $rs2, $rd", 714 [(set f32:$rd, (fsub f32:$rs1, f32:$rs2))]>; |
715def FSUBD : F3_3<2, 0b110100, 0b001000110,
|
763 (outs DFPRegs:$dst), (ins DFPRegs:$src1, DFPRegs:$src2),
764 "fsubd $src1, $src2, $dst",
765 [(set f64:$dst, (fsub f64:$src1, f64:$src2))]>;
|
716 (outs DFPRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2), 717 "fsubd $rs1, $rs2, $rd", 718 [(set f64:$rd, (fsub f64:$rs1, f64:$rs2))]>; |
719def FSUBQ : F3_3<2, 0b110100, 0b001000111,
|
767 (outs QFPRegs:$dst), (ins QFPRegs:$src1, QFPRegs:$src2),
768 "fsubq $src1, $src2, $dst",
769 [(set f128:$dst, (fsub f128:$src1, f128:$src2))]>,
|
720 (outs QFPRegs:$rd), (ins QFPRegs:$rs1, QFPRegs:$rs2), 721 "fsubq $rs1, $rs2, $rd", 722 [(set f128:$rd, (fsub f128:$rs1, f128:$rs2))]>, |
723 Requires<[HasHardQuad]>; 724 725 726// Floating-point Multiply and Divide Instructions, p. 147 727def FMULS : F3_3<2, 0b110100, 0b001001001,
|
775 (outs FPRegs:$dst), (ins FPRegs:$src1, FPRegs:$src2),
776 "fmuls $src1, $src2, $dst",
777 [(set f32:$dst, (fmul f32:$src1, f32:$src2))]>;
|
728 (outs FPRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2), 729 "fmuls $rs1, $rs2, $rd", 730 [(set f32:$rd, (fmul f32:$rs1, f32:$rs2))]>; |
731def FMULD : F3_3<2, 0b110100, 0b001001010,
|
779 (outs DFPRegs:$dst), (ins DFPRegs:$src1, DFPRegs:$src2),
780 "fmuld $src1, $src2, $dst",
781 [(set f64:$dst, (fmul f64:$src1, f64:$src2))]>;
|
732 (outs DFPRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2), 733 "fmuld $rs1, $rs2, $rd", 734 [(set f64:$rd, (fmul f64:$rs1, f64:$rs2))]>; |
735def FMULQ : F3_3<2, 0b110100, 0b001001011,
|
783 (outs QFPRegs:$dst), (ins QFPRegs:$src1, QFPRegs:$src2),
784 "fmulq $src1, $src2, $dst",
785 [(set f128:$dst, (fmul f128:$src1, f128:$src2))]>,
|
736 (outs QFPRegs:$rd), (ins QFPRegs:$rs1, QFPRegs:$rs2), 737 "fmulq $rs1, $rs2, $rd", 738 [(set f128:$rd, (fmul f128:$rs1, f128:$rs2))]>, |
739 Requires<[HasHardQuad]>; 740 741def FSMULD : F3_3<2, 0b110100, 0b001101001,
|
789 (outs DFPRegs:$dst), (ins FPRegs:$src1, FPRegs:$src2),
790 "fsmuld $src1, $src2, $dst",
791 [(set f64:$dst, (fmul (fextend f32:$src1),
792 (fextend f32:$src2)))]>;
|
742 (outs DFPRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2), 743 "fsmuld $rs1, $rs2, $rd", 744 [(set f64:$rd, (fmul (fextend f32:$rs1), 745 (fextend f32:$rs2)))]>; |
746def FDMULQ : F3_3<2, 0b110100, 0b001101110,
|
794 (outs QFPRegs:$dst), (ins DFPRegs:$src1, DFPRegs:$src2),
795 "fdmulq $src1, $src2, $dst",
796 [(set f128:$dst, (fmul (fextend f64:$src1),
797 (fextend f64:$src2)))]>,
|
747 (outs QFPRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2), 748 "fdmulq $rs1, $rs2, $rd", 749 [(set f128:$rd, (fmul (fextend f64:$rs1), 750 (fextend f64:$rs2)))]>, |
751 Requires<[HasHardQuad]>; 752 753def FDIVS : F3_3<2, 0b110100, 0b001001101,
|
801 (outs FPRegs:$dst), (ins FPRegs:$src1, FPRegs:$src2),
802 "fdivs $src1, $src2, $dst",
803 [(set f32:$dst, (fdiv f32:$src1, f32:$src2))]>;
|
754 (outs FPRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2), 755 "fdivs $rs1, $rs2, $rd", 756 [(set f32:$rd, (fdiv f32:$rs1, f32:$rs2))]>; |
757def FDIVD : F3_3<2, 0b110100, 0b001001110,
|
805 (outs DFPRegs:$dst), (ins DFPRegs:$src1, DFPRegs:$src2),
806 "fdivd $src1, $src2, $dst",
807 [(set f64:$dst, (fdiv f64:$src1, f64:$src2))]>;
|
758 (outs DFPRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2), 759 "fdivd $rs1, $rs2, $rd", 760 [(set f64:$rd, (fdiv f64:$rs1, f64:$rs2))]>; |
761def FDIVQ : F3_3<2, 0b110100, 0b001001111,
|
809 (outs QFPRegs:$dst), (ins QFPRegs:$src1, QFPRegs:$src2),
810 "fdivq $src1, $src2, $dst",
811 [(set f128:$dst, (fdiv f128:$src1, f128:$src2))]>,
|
762 (outs QFPRegs:$rd), (ins QFPRegs:$rs1, QFPRegs:$rs2), 763 "fdivq $rs1, $rs2, $rd", 764 [(set f128:$rd, (fdiv f128:$rs1, f128:$rs2))]>, |
765 Requires<[HasHardQuad]>; 766 767// Floating-point Compare Instructions, p. 148 768// Note: the 2nd template arg is different for these guys. 769// Note 2: the result of a FCMP is not available until the 2nd cycle 770// after the instr is retired, but there is no interlock in Sparc V8. 771// This behavior is modeled with a forced noop after the instruction in 772// DelaySlotFiller. 773 774let Defs = [FCC] in { 775 def FCMPS : F3_3c<2, 0b110101, 0b001010001,
|
823 (outs), (ins FPRegs:$src1, FPRegs:$src2),
824 "fcmps $src1, $src2",
825 [(SPcmpfcc f32:$src1, f32:$src2)]>;
|
776 (outs), (ins FPRegs:$rs1, FPRegs:$rs2), 777 "fcmps $rs1, $rs2", 778 [(SPcmpfcc f32:$rs1, f32:$rs2)]>; |
779 def FCMPD : F3_3c<2, 0b110101, 0b001010010,
|
827 (outs), (ins DFPRegs:$src1, DFPRegs:$src2),
828 "fcmpd $src1, $src2",
829 [(SPcmpfcc f64:$src1, f64:$src2)]>;
|
780 (outs), (ins DFPRegs:$rs1, DFPRegs:$rs2), 781 "fcmpd $rs1, $rs2", 782 [(SPcmpfcc f64:$rs1, f64:$rs2)]>; |
783 def FCMPQ : F3_3c<2, 0b110101, 0b001010011,
|
831 (outs), (ins QFPRegs:$src1, QFPRegs:$src2),
832 "fcmpq $src1, $src2",
833 [(SPcmpfcc f128:$src1, f128:$src2)]>,
|
784 (outs), (ins QFPRegs:$rs1, QFPRegs:$rs2), 785 "fcmpq $rs1, $rs2", 786 [(SPcmpfcc f128:$rs1, f128:$rs2)]>, |
787 Requires<[HasHardQuad]>; 788} 789 790//===----------------------------------------------------------------------===// 791// Instructions for Thread Local Storage(TLS). 792//===----------------------------------------------------------------------===//
|
840
|
793let isCodeGenOnly = 1, isAsmParserOnly = 1 in { |
794def TLS_ADDrr : F3_1<2, 0b000000, 795 (outs IntRegs:$rd), 796 (ins IntRegs:$rs1, IntRegs:$rs2, TLSSym:$sym), 797 "add $rs1, $rs2, $rd, $sym", 798 [(set i32:$rd, 799 (tlsadd i32:$rs1, i32:$rs2, tglobaltlsaddr:$sym))]>; 800 801let mayLoad = 1 in 802 def TLS_LDrr : F3_1<3, 0b000000, 803 (outs IntRegs:$dst), (ins MEMrr:$addr, TLSSym:$sym), 804 "ld [$addr], $dst, $sym", 805 [(set i32:$dst, 806 (tlsld ADDRrr:$addr, tglobaltlsaddr:$sym))]>; 807 808let Uses = [O6], isCall = 1, hasDelaySlot = 1 in 809 def TLS_CALL : InstSP<(outs), 810 (ins calltarget:$disp, TLSSym:$sym, variable_ops), 811 "call $disp, $sym", 812 [(tlscall texternalsym:$disp, tglobaltlsaddr:$sym)]> { 813 bits<30> disp; 814 let op = 1; 815 let Inst{29-0} = disp; 816}
|
817} |
818 819//===----------------------------------------------------------------------===// 820// V9 Instructions 821//===----------------------------------------------------------------------===// 822 823// V9 Conditional Moves. 824let Predicates = [HasV9], Constraints = "$f = $rd" in { 825 // Move Integer Register on Condition (MOVcc) p. 194 of the V9 manual. 826 let Uses = [ICC], cc = 0b100 in { 827 def MOVICCrr 828 : F4_1<0b101100, (outs IntRegs:$rd), 829 (ins IntRegs:$rs2, IntRegs:$f, CCOp:$cond), 830 "mov$cond %icc, $rs2, $rd", 831 [(set i32:$rd, (SPselecticc i32:$rs2, i32:$f, imm:$cond))]>; 832 833 def MOVICCri 834 : F4_2<0b101100, (outs IntRegs:$rd), 835 (ins i32imm:$simm11, IntRegs:$f, CCOp:$cond), 836 "mov$cond %icc, $simm11, $rd", 837 [(set i32:$rd, 838 (SPselecticc simm11:$simm11, i32:$f, imm:$cond))]>; 839 } 840 841 let Uses = [FCC], cc = 0b000 in { 842 def MOVFCCrr 843 : F4_1<0b101100, (outs IntRegs:$rd), 844 (ins IntRegs:$rs2, IntRegs:$f, CCOp:$cond), 845 "mov$cond %fcc0, $rs2, $rd", 846 [(set i32:$rd, (SPselectfcc i32:$rs2, i32:$f, imm:$cond))]>; 847 def MOVFCCri 848 : F4_2<0b101100, (outs IntRegs:$rd), 849 (ins i32imm:$simm11, IntRegs:$f, CCOp:$cond), 850 "mov$cond %fcc0, $simm11, $rd", 851 [(set i32:$rd, 852 (SPselectfcc simm11:$simm11, i32:$f, imm:$cond))]>; 853 } 854 855 let Uses = [ICC], opf_cc = 0b100 in { 856 def FMOVS_ICC 857 : F4_3<0b110101, 0b000001, (outs FPRegs:$rd), 858 (ins FPRegs:$rs2, FPRegs:$f, CCOp:$cond), 859 "fmovs$cond %icc, $rs2, $rd", 860 [(set f32:$rd, (SPselecticc f32:$rs2, f32:$f, imm:$cond))]>; 861 def FMOVD_ICC 862 : F4_3<0b110101, 0b000010, (outs DFPRegs:$rd), 863 (ins DFPRegs:$rs2, DFPRegs:$f, CCOp:$cond), 864 "fmovd$cond %icc, $rs2, $rd", 865 [(set f64:$rd, (SPselecticc f64:$rs2, f64:$f, imm:$cond))]>; 866 def FMOVQ_ICC 867 : F4_3<0b110101, 0b000011, (outs QFPRegs:$rd), 868 (ins QFPRegs:$rs2, QFPRegs:$f, CCOp:$cond),
|
915 "fmovd$cond %icc, $rs2, $rd",
916 [(set f128:$rd, (SPselecticc f128:$rs2, f128:$f, imm:$cond))]>;
|
869 "fmovq$cond %icc, $rs2, $rd", 870 [(set f128:$rd, (SPselecticc f128:$rs2, f128:$f, imm:$cond))]>, 871 Requires<[HasHardQuad]>; |
872 } 873 874 let Uses = [FCC], opf_cc = 0b000 in { 875 def FMOVS_FCC 876 : F4_3<0b110101, 0b000001, (outs FPRegs:$rd), 877 (ins FPRegs:$rs2, FPRegs:$f, CCOp:$cond), 878 "fmovs$cond %fcc0, $rs2, $rd", 879 [(set f32:$rd, (SPselectfcc f32:$rs2, f32:$f, imm:$cond))]>; 880 def FMOVD_FCC 881 : F4_3<0b110101, 0b000010, (outs DFPRegs:$rd), 882 (ins DFPRegs:$rs2, DFPRegs:$f, CCOp:$cond), 883 "fmovd$cond %fcc0, $rs2, $rd", 884 [(set f64:$rd, (SPselectfcc f64:$rs2, f64:$f, imm:$cond))]>; 885 def FMOVQ_FCC 886 : F4_3<0b110101, 0b000011, (outs QFPRegs:$rd), 887 (ins QFPRegs:$rs2, QFPRegs:$f, CCOp:$cond),
|
933 "fmovd$cond %fcc0, $rs2, $rd",
934 [(set f128:$rd, (SPselectfcc f128:$rs2, f128:$f, imm:$cond))]>;
|
888 "fmovq$cond %fcc0, $rs2, $rd", 889 [(set f128:$rd, (SPselectfcc f128:$rs2, f128:$f, imm:$cond))]>, 890 Requires<[HasHardQuad]>; |
891 } 892 893} 894 895// Floating-Point Move Instructions, p. 164 of the V9 manual. 896let Predicates = [HasV9] in { 897 def FMOVD : F3_3u<2, 0b110100, 0b000000010,
|
942 (outs DFPRegs:$dst), (ins DFPRegs:$src),
943 "fmovd $src, $dst", []>;
|
898 (outs DFPRegs:$rd), (ins DFPRegs:$rs2), 899 "fmovd $rs2, $rd", []>; |
900 def FMOVQ : F3_3u<2, 0b110100, 0b000000011,
|
945 (outs QFPRegs:$dst), (ins QFPRegs:$src),
946 "fmovq $src, $dst", []>,
|
901 (outs QFPRegs:$rd), (ins QFPRegs:$rs2), 902 "fmovq $rs2, $rd", []>, |
903 Requires<[HasHardQuad]>; 904 def FNEGD : F3_3u<2, 0b110100, 0b000000110,
|
949 (outs DFPRegs:$dst), (ins DFPRegs:$src),
950 "fnegd $src, $dst",
951 [(set f64:$dst, (fneg f64:$src))]>;
|
905 (outs DFPRegs:$rd), (ins DFPRegs:$rs2), 906 "fnegd $rs2, $rd", 907 [(set f64:$rd, (fneg f64:$rs2))]>; |
908 def FNEGQ : F3_3u<2, 0b110100, 0b000000111,
|
953 (outs QFPRegs:$dst), (ins QFPRegs:$src),
954 "fnegq $src, $dst",
955 [(set f128:$dst, (fneg f128:$src))]>,
|
909 (outs QFPRegs:$rd), (ins QFPRegs:$rs2), 910 "fnegq $rs2, $rd", 911 [(set f128:$rd, (fneg f128:$rs2))]>, |
912 Requires<[HasHardQuad]>; 913 def FABSD : F3_3u<2, 0b110100, 0b000001010,
|
958 (outs DFPRegs:$dst), (ins DFPRegs:$src),
959 "fabsd $src, $dst",
960 [(set f64:$dst, (fabs f64:$src))]>;
|
914 (outs DFPRegs:$rd), (ins DFPRegs:$rs2), 915 "fabsd $rs2, $rd", 916 [(set f64:$rd, (fabs f64:$rs2))]>; |
917 def FABSQ : F3_3u<2, 0b110100, 0b000001011,
|
962 (outs QFPRegs:$dst), (ins QFPRegs:$src),
963 "fabsq $src, $dst",
964 [(set f128:$dst, (fabs f128:$src))]>,
|
918 (outs QFPRegs:$rd), (ins QFPRegs:$rs2), 919 "fabsq $rs2, $rd", 920 [(set f128:$rd, (fabs f128:$rs2))]>, |
921 Requires<[HasHardQuad]>; 922} 923 924// POPCrr - This does a ctpop of a 64-bit register. As such, we have to clear
|
969// the top 32-bits before using it. To do this clearing, we use a SLLri X,0.
|
925// the top 32-bits before using it. To do this clearing, we use a SRLri X,0. |
926let rs1 = 0 in 927 def POPCrr : F3_1<2, 0b101110, 928 (outs IntRegs:$dst), (ins IntRegs:$src), 929 "popc $src, $dst", []>, Requires<[HasV9]>; 930def : Pat<(ctpop i32:$src),
|
975 (POPCrr (SLLri $src, 0))>;
|
931 (POPCrr (SRLri $src, 0))>; |
932
|
933// Atomic swap. 934let hasSideEffects =1, rd = 0, rs1 = 0b01111, rs2 = 0 in 935 def STBAR : F3_1<2, 0b101000, (outs), (ins), "stbar", []>; 936 937let Predicates = [HasV9], hasSideEffects = 1, rd = 0, rs1 = 0b01111 in 938 def MEMBARi : F3_2<2, 0b101000, (outs), (ins i32imm:$simm13), 939 "membar $simm13", []>; 940 941let Constraints = "$val = $dst" in { 942 def SWAPrr : F3_1<3, 0b001111, 943 (outs IntRegs:$dst), (ins MEMrr:$addr, IntRegs:$val), 944 "swap [$addr], $dst", 945 [(set i32:$dst, (atomic_swap_32 ADDRrr:$addr, i32:$val))]>; 946 def SWAPri : F3_2<3, 0b001111, 947 (outs IntRegs:$dst), (ins MEMri:$addr, IntRegs:$val), 948 "swap [$addr], $dst", 949 [(set i32:$dst, (atomic_swap_32 ADDRri:$addr, i32:$val))]>; 950} 951 952let Predicates = [HasV9], Constraints = "$swap = $rd" in 953 def CASrr: F3_1_asi<3, 0b111100, 0b10000000, 954 (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2, 955 IntRegs:$swap), 956 "cas [$rs1], $rs2, $rd", 957 [(set i32:$rd, 958 (atomic_cmp_swap iPTR:$rs1, i32:$rs2, i32:$swap))]>; 959 |
960//===----------------------------------------------------------------------===// 961// Non-Instruction Patterns 962//===----------------------------------------------------------------------===// 963 964// Small immediates. 965def : Pat<(i32 simm13:$val), 966 (ORri (i32 G0), imm:$val)>; 967// Arbitrary immediates. 968def : Pat<(i32 imm:$val), 969 (ORri (SETHIi (HI22 imm:$val)), (LO10 imm:$val))>; 970 971 972// Global addresses, constant pool entries
|
973let Predicates = [Is32Bit] in { 974 |
975def : Pat<(SPhi tglobaladdr:$in), (SETHIi tglobaladdr:$in)>; 976def : Pat<(SPlo tglobaladdr:$in), (ORri (i32 G0), tglobaladdr:$in)>; 977def : Pat<(SPhi tconstpool:$in), (SETHIi tconstpool:$in)>; 978def : Pat<(SPlo tconstpool:$in), (ORri (i32 G0), tconstpool:$in)>; 979 980// GlobalTLS addresses 981def : Pat<(SPhi tglobaltlsaddr:$in), (SETHIi tglobaltlsaddr:$in)>; 982def : Pat<(SPlo tglobaltlsaddr:$in), (ORri (i32 G0), tglobaltlsaddr:$in)>; 983def : Pat<(add (SPhi tglobaltlsaddr:$in1), (SPlo tglobaltlsaddr:$in2)), 984 (ADDri (SETHIi tglobaltlsaddr:$in1), (tglobaltlsaddr:$in2))>; 985def : Pat<(xor (SPhi tglobaltlsaddr:$in1), (SPlo tglobaltlsaddr:$in2)), 986 (XORri (SETHIi tglobaltlsaddr:$in1), (tglobaltlsaddr:$in2))>; 987 988// Blockaddress 989def : Pat<(SPhi tblockaddress:$in), (SETHIi tblockaddress:$in)>; 990def : Pat<(SPlo tblockaddress:$in), (ORri (i32 G0), tblockaddress:$in)>; 991 992// Add reg, lo. This is used when taking the addr of a global/constpool entry. 993def : Pat<(add iPTR:$r, (SPlo tglobaladdr:$in)), (ADDri $r, tglobaladdr:$in)>; 994def : Pat<(add iPTR:$r, (SPlo tconstpool:$in)), (ADDri $r, tconstpool:$in)>; 995def : Pat<(add iPTR:$r, (SPlo tblockaddress:$in)), 996 (ADDri $r, tblockaddress:$in)>;
|
997} |
998 999// Calls: 1000def : Pat<(call tglobaladdr:$dst), 1001 (CALL tglobaladdr:$dst)>; 1002def : Pat<(call texternalsym:$dst), 1003 (CALL texternalsym:$dst)>; 1004 1005// Map integer extload's to zextloads. 1006def : Pat<(i32 (extloadi1 ADDRrr:$src)), (LDUBrr ADDRrr:$src)>; 1007def : Pat<(i32 (extloadi1 ADDRri:$src)), (LDUBri ADDRri:$src)>; 1008def : Pat<(i32 (extloadi8 ADDRrr:$src)), (LDUBrr ADDRrr:$src)>; 1009def : Pat<(i32 (extloadi8 ADDRri:$src)), (LDUBri ADDRri:$src)>; 1010def : Pat<(i32 (extloadi16 ADDRrr:$src)), (LDUHrr ADDRrr:$src)>; 1011def : Pat<(i32 (extloadi16 ADDRri:$src)), (LDUHri ADDRri:$src)>; 1012 1013// zextload bool -> zextload byte 1014def : Pat<(i32 (zextloadi1 ADDRrr:$src)), (LDUBrr ADDRrr:$src)>; 1015def : Pat<(i32 (zextloadi1 ADDRri:$src)), (LDUBri ADDRri:$src)>; 1016 1017// store 0, addr -> store %g0, addr 1018def : Pat<(store (i32 0), ADDRrr:$dst), (STrr ADDRrr:$dst, (i32 G0))>; 1019def : Pat<(store (i32 0), ADDRri:$dst), (STri ADDRri:$dst, (i32 G0))>; 1020
|
1021// store bar for all atomic_fence in V8. 1022let Predicates = [HasNoV9] in 1023 def : Pat<(atomic_fence imm, imm), (STBAR)>; 1024 1025// atomic_load_32 addr -> load addr 1026def : Pat<(i32 (atomic_load ADDRrr:$src)), (LDrr ADDRrr:$src)>; 1027def : Pat<(i32 (atomic_load ADDRri:$src)), (LDri ADDRri:$src)>; 1028 1029// atomic_store_32 val, addr -> store val, addr 1030def : Pat<(atomic_store ADDRrr:$dst, i32:$val), (STrr ADDRrr:$dst, $val)>; 1031def : Pat<(atomic_store ADDRri:$dst, i32:$val), (STri ADDRri:$dst, $val)>; 1032 1033 |
1034include "SparcInstr64Bit.td"
|
1035include "SparcInstrAliases.td" |
|