]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Sparc/SparcInstrInfo.td
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / Sparc / SparcInstrInfo.td
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
18 include "SparcInstrFormats.td"
19
20 //===----------------------------------------------------------------------===//
21 // Feature predicates.
22 //===----------------------------------------------------------------------===//
23
24 // True when generating 32-bit code.
25 def Is32Bit : Predicate<"!Subtarget->is64Bit()">;
26
27 // True when generating 64-bit code. This also implies HasV9.
28 def Is64Bit : Predicate<"Subtarget->is64Bit()">;
29
30 def UseSoftMulDiv : Predicate<"Subtarget->useSoftMulDiv()">,
31               AssemblerPredicate<"FeatureSoftMulDiv">;
32
33 // HasV9 - This predicate is true when the target processor supports V9
34 // instructions.  Note that the machine may be running in 32-bit mode.
35 def HasV9   : Predicate<"Subtarget->isV9()">,
36               AssemblerPredicate<"FeatureV9">;
37
38 // HasNoV9 - This predicate is true when the target doesn't have V9
39 // instructions.  Use of this is just a hack for the isel not having proper
40 // costs for V8 instructions that are more expensive than their V9 ones.
41 def HasNoV9 : Predicate<"!Subtarget->isV9()">;
42
43 // HasVIS - This is true when the target processor has VIS extensions.
44 def HasVIS : Predicate<"Subtarget->isVIS()">,
45              AssemblerPredicate<"FeatureVIS">;
46 def HasVIS2 : Predicate<"Subtarget->isVIS2()">,
47              AssemblerPredicate<"FeatureVIS2">;
48 def HasVIS3 : Predicate<"Subtarget->isVIS3()">,
49              AssemblerPredicate<"FeatureVIS3">;
50
51 // HasHardQuad - This is true when the target processor supports quad floating
52 // point instructions.
53 def HasHardQuad : Predicate<"Subtarget->hasHardQuad()">;
54
55 // HasLeonCASA - This is true when the target processor supports the CASA
56 // instruction
57 def HasLeonCASA : Predicate<"Subtarget->hasLeonCasa()">;
58
59 // HasPWRPSR - This is true when the target processor supports partial
60 // writes to the PSR register that only affects the ET field.
61 def HasPWRPSR : Predicate<"Subtarget->hasPWRPSR()">,
62                 AssemblerPredicate<"FeaturePWRPSR">;
63
64 // HasUMAC_SMAC - This is true when the target processor supports the
65 // UMAC and SMAC instructions
66 def HasUMAC_SMAC : Predicate<"Subtarget->hasUmacSmac()">;
67
68 def HasNoFdivSqrtFix : Predicate<"!Subtarget->fixAllFDIVSQRT()">;
69 def HasFMULS : Predicate<"!Subtarget->hasNoFMULS()">;
70 def HasFSMULD : Predicate<"!Subtarget->hasNoFSMULD()">;
71
72 // UseDeprecatedInsts - This predicate is true when the target processor is a
73 // V8, or when it is V9 but the V8 deprecated instructions are efficient enough
74 // to use when appropriate.  In either of these cases, the instruction selector
75 // will pick deprecated instructions.
76 def UseDeprecatedInsts : Predicate<"Subtarget->useDeprecatedV8Instructions()">;
77
78 //===----------------------------------------------------------------------===//
79 // Instruction Pattern Stuff
80 //===----------------------------------------------------------------------===//
81
82 def simm11  : PatLeaf<(imm), [{ return isInt<11>(N->getSExtValue()); }]>;
83
84 def simm13  : PatLeaf<(imm), [{ return isInt<13>(N->getSExtValue()); }]>;
85
86 def LO10 : SDNodeXForm<imm, [{
87   return CurDAG->getTargetConstant((unsigned)N->getZExtValue() & 1023, SDLoc(N),
88                                    MVT::i32);
89 }]>;
90
91 def HI22 : SDNodeXForm<imm, [{
92   // Transformation function: shift the immediate value down into the low bits.
93   return CurDAG->getTargetConstant((unsigned)N->getZExtValue() >> 10, SDLoc(N),
94                                    MVT::i32);
95 }]>;
96
97 // Return the complement of a HI22 immediate value.
98 def HI22_not : SDNodeXForm<imm, [{
99   return CurDAG->getTargetConstant(~(unsigned)N->getZExtValue() >> 10, SDLoc(N),
100                                    MVT::i32);
101 }]>;
102
103 def SETHIimm : PatLeaf<(imm), [{
104   return isShiftedUInt<22, 10>(N->getZExtValue());
105 }], HI22>;
106
107 // The N->hasOneUse() prevents the immediate from being instantiated in both
108 // normal and complement form.
109 def SETHIimm_not : PatLeaf<(i32 imm), [{
110   return N->hasOneUse() && isShiftedUInt<22, 10>(~(unsigned)N->getZExtValue());
111 }], HI22_not>;
112
113 // Addressing modes.
114 def ADDRrr : ComplexPattern<iPTR, 2, "SelectADDRrr", [], []>;
115 def ADDRri : ComplexPattern<iPTR, 2, "SelectADDRri", [frameindex], []>;
116
117 // Address operands
118 def SparcMEMrrAsmOperand : AsmOperandClass {
119   let Name = "MEMrr";
120   let ParserMethod = "parseMEMOperand";
121 }
122
123 def SparcMEMriAsmOperand : AsmOperandClass {
124   let Name = "MEMri";
125   let ParserMethod = "parseMEMOperand";
126 }
127
128 def MEMrr : Operand<iPTR> {
129   let PrintMethod = "printMemOperand";
130   let MIOperandInfo = (ops ptr_rc, ptr_rc);
131   let ParserMatchClass = SparcMEMrrAsmOperand;
132 }
133 def MEMri : Operand<iPTR> {
134   let PrintMethod = "printMemOperand";
135   let MIOperandInfo = (ops ptr_rc, i32imm);
136   let ParserMatchClass = SparcMEMriAsmOperand;
137 }
138
139 def TLSSym : Operand<iPTR>;
140
141 def SparcMembarTagAsmOperand : AsmOperandClass {
142   let Name = "MembarTag";
143   let ParserMethod = "parseMembarTag";
144 }
145
146 def MembarTag : Operand<i32> {
147   let PrintMethod = "printMembarTag";
148   let ParserMatchClass = SparcMembarTagAsmOperand;
149 }
150
151 // Branch targets have OtherVT type.
152 def brtarget : Operand<OtherVT> {
153   let EncoderMethod = "getBranchTargetOpValue";
154 }
155
156 def bprtarget : Operand<OtherVT> {
157   let EncoderMethod = "getBranchPredTargetOpValue";
158 }
159
160 def bprtarget16 : Operand<OtherVT> {
161   let EncoderMethod = "getBranchOnRegTargetOpValue";
162 }
163
164 def calltarget : Operand<i32> {
165   let EncoderMethod = "getCallTargetOpValue";
166   let DecoderMethod = "DecodeCall";
167 }
168
169 def simm13Op : Operand<i32> {
170   let DecoderMethod = "DecodeSIMM13";
171 }
172
173 // Operand for printing out a condition code.
174 let PrintMethod = "printCCOperand" in
175   def CCOp : Operand<i32>;
176
177 def SDTSPcmpicc :
178 SDTypeProfile<0, 2, [SDTCisInt<0>, SDTCisSameAs<0, 1>]>;
179 def SDTSPcmpfcc :
180 SDTypeProfile<0, 2, [SDTCisFP<0>, SDTCisSameAs<0, 1>]>;
181 def SDTSPbrcc :
182 SDTypeProfile<0, 2, [SDTCisVT<0, OtherVT>, SDTCisVT<1, i32>]>;
183 def SDTSPselectcc :
184 SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, SDTCisVT<3, i32>]>;
185 def SDTSPFTOI :
186 SDTypeProfile<1, 1, [SDTCisVT<0, f32>, SDTCisFP<1>]>;
187 def SDTSPITOF :
188 SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f32>]>;
189 def SDTSPFTOX :
190 SDTypeProfile<1, 1, [SDTCisVT<0, f64>, SDTCisFP<1>]>;
191 def SDTSPXTOF :
192 SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f64>]>;
193
194 def SDTSPtlsadd :
195 SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>;
196 def SDTSPtlsld :
197 SDTypeProfile<1, 2, [SDTCisPtrTy<0>, SDTCisPtrTy<1>]>;
198
199 def SPcmpicc : SDNode<"SPISD::CMPICC", SDTSPcmpicc, [SDNPOutGlue]>;
200 def SPcmpfcc : SDNode<"SPISD::CMPFCC", SDTSPcmpfcc, [SDNPOutGlue]>;
201 def SPbricc : SDNode<"SPISD::BRICC", SDTSPbrcc, [SDNPHasChain, SDNPInGlue]>;
202 def SPbrxcc : SDNode<"SPISD::BRXCC", SDTSPbrcc, [SDNPHasChain, SDNPInGlue]>;
203 def SPbrfcc : SDNode<"SPISD::BRFCC", SDTSPbrcc, [SDNPHasChain, SDNPInGlue]>;
204
205 def SPhi    : SDNode<"SPISD::Hi", SDTIntUnaryOp>;
206 def SPlo    : SDNode<"SPISD::Lo", SDTIntUnaryOp>;
207
208 def SPftoi  : SDNode<"SPISD::FTOI", SDTSPFTOI>;
209 def SPitof  : SDNode<"SPISD::ITOF", SDTSPITOF>;
210 def SPftox  : SDNode<"SPISD::FTOX", SDTSPFTOX>;
211 def SPxtof  : SDNode<"SPISD::XTOF", SDTSPXTOF>;
212
213 def SPselecticc : SDNode<"SPISD::SELECT_ICC", SDTSPselectcc, [SDNPInGlue]>;
214 def SPselectxcc : SDNode<"SPISD::SELECT_XCC", SDTSPselectcc, [SDNPInGlue]>;
215 def SPselectfcc : SDNode<"SPISD::SELECT_FCC", SDTSPselectcc, [SDNPInGlue]>;
216
217 //  These are target-independent nodes, but have target-specific formats.
218 def SDT_SPCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32>,
219                                           SDTCisVT<1, i32> ]>;
220 def SDT_SPCallSeqEnd   : SDCallSeqEnd<[ SDTCisVT<0, i32>,
221                                         SDTCisVT<1, i32> ]>;
222
223 def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_SPCallSeqStart,
224                            [SDNPHasChain, SDNPOutGlue]>;
225 def callseq_end   : SDNode<"ISD::CALLSEQ_END",   SDT_SPCallSeqEnd,
226                            [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
227
228 def SDT_SPCall    : SDTypeProfile<0, -1, [SDTCisVT<0, i32>]>;
229 def call          : SDNode<"SPISD::CALL", SDT_SPCall,
230                            [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
231                             SDNPVariadic]>;
232
233 def SDT_SPRet     : SDTypeProfile<0, 1, [SDTCisVT<0, i32>]>;
234 def retflag       : SDNode<"SPISD::RET_FLAG", SDT_SPRet,
235                            [SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>;
236
237 def flushw        : SDNode<"SPISD::FLUSHW", SDTNone,
238                            [SDNPHasChain, SDNPSideEffect, SDNPMayStore]>;
239
240 def tlsadd        : SDNode<"SPISD::TLS_ADD", SDTSPtlsadd>;
241 def tlsld         : SDNode<"SPISD::TLS_LD",  SDTSPtlsld>;
242 def tlscall       : SDNode<"SPISD::TLS_CALL", SDT_SPCall,
243                             [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
244                              SDNPVariadic]>;
245
246 def getPCX        : Operand<iPTR> {
247   let PrintMethod = "printGetPCX";
248 }
249
250 //===----------------------------------------------------------------------===//
251 // SPARC Flag Conditions
252 //===----------------------------------------------------------------------===//
253
254 // Note that these values must be kept in sync with the CCOp::CondCode enum
255 // values.
256 class ICC_VAL<int N> : PatLeaf<(i32 N)>;
257 def ICC_NE  : ICC_VAL< 9>;  // Not Equal
258 def ICC_E   : ICC_VAL< 1>;  // Equal
259 def ICC_G   : ICC_VAL<10>;  // Greater
260 def ICC_LE  : ICC_VAL< 2>;  // Less or Equal
261 def ICC_GE  : ICC_VAL<11>;  // Greater or Equal
262 def ICC_L   : ICC_VAL< 3>;  // Less
263 def ICC_GU  : ICC_VAL<12>;  // Greater Unsigned
264 def ICC_LEU : ICC_VAL< 4>;  // Less or Equal Unsigned
265 def ICC_CC  : ICC_VAL<13>;  // Carry Clear/Great or Equal Unsigned
266 def ICC_CS  : ICC_VAL< 5>;  // Carry Set/Less Unsigned
267 def ICC_POS : ICC_VAL<14>;  // Positive
268 def ICC_NEG : ICC_VAL< 6>;  // Negative
269 def ICC_VC  : ICC_VAL<15>;  // Overflow Clear
270 def ICC_VS  : ICC_VAL< 7>;  // Overflow Set
271
272 class FCC_VAL<int N> : PatLeaf<(i32 N)>;
273 def FCC_U   : FCC_VAL<23>;  // Unordered
274 def FCC_G   : FCC_VAL<22>;  // Greater
275 def FCC_UG  : FCC_VAL<21>;  // Unordered or Greater
276 def FCC_L   : FCC_VAL<20>;  // Less
277 def FCC_UL  : FCC_VAL<19>;  // Unordered or Less
278 def FCC_LG  : FCC_VAL<18>;  // Less or Greater
279 def FCC_NE  : FCC_VAL<17>;  // Not Equal
280 def FCC_E   : FCC_VAL<25>;  // Equal
281 def FCC_UE  : FCC_VAL<26>;  // Unordered or Equal
282 def FCC_GE  : FCC_VAL<27>;  // Greater or Equal
283 def FCC_UGE : FCC_VAL<28>;  // Unordered or Greater or Equal
284 def FCC_LE  : FCC_VAL<29>;  // Less or Equal
285 def FCC_ULE : FCC_VAL<30>;  // Unordered or Less or Equal
286 def FCC_O   : FCC_VAL<31>;  // Ordered
287
288 class CPCC_VAL<int N> : PatLeaf<(i32 N)>;
289 def CPCC_3   : CPCC_VAL<39>;  // 3
290 def CPCC_2   : CPCC_VAL<38>;  // 2
291 def CPCC_23  : CPCC_VAL<37>;  // 2 or 3
292 def CPCC_1   : CPCC_VAL<36>;  // 1
293 def CPCC_13  : CPCC_VAL<35>;  // 1 or 3
294 def CPCC_12  : CPCC_VAL<34>;  // 1 or 2
295 def CPCC_123 : CPCC_VAL<33>;  // 1 or 2 or 3
296 def CPCC_0   : CPCC_VAL<41>;  // 0
297 def CPCC_03  : CPCC_VAL<42>;  // 0 or 3
298 def CPCC_02  : CPCC_VAL<43>;  // 0 or 2
299 def CPCC_023 : CPCC_VAL<44>;  // 0 or 2 or 3
300 def CPCC_01  : CPCC_VAL<45>;  // 0 or 1
301 def CPCC_013 : CPCC_VAL<46>;  // 0 or 1 or 3
302 def CPCC_012 : CPCC_VAL<47>;  // 0 or 1 or 2
303
304 //===----------------------------------------------------------------------===//
305 // Instruction Class Templates
306 //===----------------------------------------------------------------------===//
307
308 /// F3_12 multiclass - Define a normal F3_1/F3_2 pattern in one shot.
309 multiclass F3_12<string OpcStr, bits<6> Op3Val, SDNode OpNode,
310                  RegisterClass RC, ValueType Ty, Operand immOp,
311                  InstrItinClass itin = IIC_iu_instr> {
312   def rr  : F3_1<2, Op3Val,
313                  (outs RC:$rd), (ins RC:$rs1, RC:$rs2),
314                  !strconcat(OpcStr, " $rs1, $rs2, $rd"),
315                  [(set Ty:$rd, (OpNode Ty:$rs1, Ty:$rs2))],
316                  itin>;
317   def ri  : F3_2<2, Op3Val,
318                  (outs RC:$rd), (ins RC:$rs1, immOp:$simm13),
319                  !strconcat(OpcStr, " $rs1, $simm13, $rd"),
320                  [(set Ty:$rd, (OpNode Ty:$rs1, (Ty simm13:$simm13)))],
321                  itin>;
322 }
323
324 /// F3_12np multiclass - Define a normal F3_1/F3_2 pattern in one shot, with no
325 /// pattern.
326 multiclass F3_12np<string OpcStr, bits<6> Op3Val, InstrItinClass itin = IIC_iu_instr> {
327   def rr  : F3_1<2, Op3Val,
328                  (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2),
329                  !strconcat(OpcStr, " $rs1, $rs2, $rd"), [],
330                  itin>;
331   def ri  : F3_2<2, Op3Val,
332                  (outs IntRegs:$rd), (ins IntRegs:$rs1, simm13Op:$simm13),
333                  !strconcat(OpcStr, " $rs1, $simm13, $rd"), [],
334                  itin>;
335 }
336
337 // Load multiclass - Define both Reg+Reg/Reg+Imm patterns in one shot.
338 multiclass Load<string OpcStr, bits<6> Op3Val, SDPatternOperator OpNode,
339            RegisterClass RC, ValueType Ty, InstrItinClass itin = IIC_iu_instr> {
340   def rr  : F3_1<3, Op3Val,
341                  (outs RC:$dst), (ins MEMrr:$addr),
342                  !strconcat(OpcStr, " [$addr], $dst"),
343                  [(set Ty:$dst, (OpNode ADDRrr:$addr))],
344                  itin>;
345   def ri  : F3_2<3, Op3Val,
346                  (outs RC:$dst), (ins MEMri:$addr),
347                  !strconcat(OpcStr, " [$addr], $dst"),
348                  [(set Ty:$dst, (OpNode ADDRri:$addr))],
349                  itin>;
350 }
351
352 // TODO: Instructions of the LoadASI class are currently asm only; hooking up
353 // CodeGen's address spaces to use these is a future task.
354 class LoadASI<string OpcStr, bits<6> Op3Val, SDPatternOperator OpNode,
355               RegisterClass RC, ValueType Ty, InstrItinClass itin = NoItinerary> :
356   F3_1_asi<3, Op3Val, (outs RC:$dst), (ins MEMrr:$addr, i8imm:$asi),
357                 !strconcat(OpcStr, "a [$addr] $asi, $dst"),
358                 []>;
359
360 // LoadA multiclass - As above, but also define alternate address space variant
361 multiclass LoadA<string OpcStr, bits<6> Op3Val, bits<6> LoadAOp3Val,
362                  SDPatternOperator OpNode, RegisterClass RC, ValueType Ty,
363                  InstrItinClass itin = NoItinerary> :
364              Load<OpcStr, Op3Val, OpNode, RC, Ty, itin> {
365   def Arr  : LoadASI<OpcStr, LoadAOp3Val, OpNode, RC, Ty>;
366 }
367
368 // The LDSTUB instruction is supported for asm only.
369 // It is unlikely that general-purpose code could make use of it.
370 // CAS is preferred for sparc v9.
371 def LDSTUBrr : F3_1<3, 0b001101, (outs IntRegs:$dst), (ins MEMrr:$addr),
372                     "ldstub [$addr], $dst", []>;
373 def LDSTUBri : F3_2<3, 0b001101, (outs IntRegs:$dst), (ins MEMri:$addr),
374                     "ldstub [$addr], $dst", []>;
375 def LDSTUBArr : F3_1_asi<3, 0b011101, (outs IntRegs:$dst),
376                          (ins MEMrr:$addr, i8imm:$asi),
377                          "ldstuba [$addr] $asi, $dst", []>;
378
379 // Store multiclass - Define both Reg+Reg/Reg+Imm patterns in one shot.
380 multiclass Store<string OpcStr, bits<6> Op3Val, SDPatternOperator OpNode,
381            RegisterClass RC, ValueType Ty, InstrItinClass itin = IIC_st> {
382   def rr  : F3_1<3, Op3Val,
383                  (outs), (ins MEMrr:$addr, RC:$rd),
384                  !strconcat(OpcStr, " $rd, [$addr]"),
385                  [(OpNode Ty:$rd, ADDRrr:$addr)],
386                  itin>;
387   def ri  : F3_2<3, Op3Val,
388                  (outs), (ins MEMri:$addr, RC:$rd),
389                  !strconcat(OpcStr, " $rd, [$addr]"),
390                  [(OpNode Ty:$rd, ADDRri:$addr)],
391                  itin>;
392 }
393
394 // TODO: Instructions of the StoreASI class are currently asm only; hooking up
395 // CodeGen's address spaces to use these is a future task.
396 class StoreASI<string OpcStr, bits<6> Op3Val,
397                SDPatternOperator OpNode, RegisterClass RC, ValueType Ty,
398                InstrItinClass itin = IIC_st> :
399   F3_1_asi<3, Op3Val, (outs), (ins MEMrr:$addr, RC:$rd, i8imm:$asi),
400            !strconcat(OpcStr, "a $rd, [$addr] $asi"),
401            [],
402            itin>;
403
404 multiclass StoreA<string OpcStr, bits<6> Op3Val, bits<6> StoreAOp3Val,
405                   SDPatternOperator OpNode, RegisterClass RC, ValueType Ty,
406                   InstrItinClass itin = IIC_st> :
407              Store<OpcStr, Op3Val, OpNode, RC, Ty> {
408   def Arr : StoreASI<OpcStr, StoreAOp3Val, OpNode, RC, Ty, itin>;
409 }
410
411 //===----------------------------------------------------------------------===//
412 // Instructions
413 //===----------------------------------------------------------------------===//
414
415 // Pseudo instructions.
416 class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern>
417    : InstSP<outs, ins, asmstr, pattern> {
418   let isCodeGenOnly = 1;
419   let isPseudo = 1;
420 }
421
422 // GETPCX for PIC
423 let Defs = [O7] in {
424   def GETPCX : Pseudo<(outs getPCX:$getpcseq), (ins), "$getpcseq", [] >;
425 }
426
427 let Defs = [O6], Uses = [O6] in {
428 def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2),
429                                "!ADJCALLSTACKDOWN $amt1, $amt2",
430                                [(callseq_start timm:$amt1, timm:$amt2)]>;
431 def ADJCALLSTACKUP : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2),
432                             "!ADJCALLSTACKUP $amt1",
433                             [(callseq_end timm:$amt1, timm:$amt2)]>;
434 }
435
436 let hasSideEffects = 1, mayStore = 1 in {
437   let rd = 0, rs1 = 0, rs2 = 0 in
438     def FLUSHW : F3_1<0b10, 0b101011, (outs), (ins),
439                       "flushw",
440                       [(flushw)]>, Requires<[HasV9]>;
441   let rd = 8, rs1 = 0, simm13 = 3 in
442     def TA3 : F3_2<0b10, 0b111010, (outs), (ins),
443                    "ta 3",
444                    [(flushw)]>;
445 }
446
447 // SELECT_CC_* - Used to implement the SELECT_CC DAG operation.  Expanded after
448 // instruction selection into a branch sequence.  This has to handle all
449 // permutations of selection between i32/f32/f64 on ICC and FCC.
450 // Expanded after instruction selection.
451 let Uses = [ICC], usesCustomInserter = 1 in {
452   def SELECT_CC_Int_ICC
453    : Pseudo<(outs IntRegs:$dst), (ins IntRegs:$T, IntRegs:$F, i32imm:$Cond),
454             "; SELECT_CC_Int_ICC PSEUDO!",
455             [(set i32:$dst, (SPselecticc i32:$T, i32:$F, imm:$Cond))]>;
456   def SELECT_CC_FP_ICC
457    : Pseudo<(outs FPRegs:$dst), (ins FPRegs:$T, FPRegs:$F, i32imm:$Cond),
458             "; SELECT_CC_FP_ICC PSEUDO!",
459             [(set f32:$dst, (SPselecticc f32:$T, f32:$F, imm:$Cond))]>;
460
461   def SELECT_CC_DFP_ICC
462    : Pseudo<(outs DFPRegs:$dst), (ins DFPRegs:$T, DFPRegs:$F, i32imm:$Cond),
463             "; SELECT_CC_DFP_ICC PSEUDO!",
464             [(set f64:$dst, (SPselecticc f64:$T, f64:$F, imm:$Cond))]>;
465
466   def SELECT_CC_QFP_ICC
467    : Pseudo<(outs QFPRegs:$dst), (ins QFPRegs:$T, QFPRegs:$F, i32imm:$Cond),
468             "; SELECT_CC_QFP_ICC PSEUDO!",
469             [(set f128:$dst, (SPselecticc f128:$T, f128:$F, imm:$Cond))]>;
470 }
471
472 let usesCustomInserter = 1, Uses = [FCC0] in {
473
474   def SELECT_CC_Int_FCC
475    : Pseudo<(outs IntRegs:$dst), (ins IntRegs:$T, IntRegs:$F, i32imm:$Cond),
476             "; SELECT_CC_Int_FCC PSEUDO!",
477             [(set i32:$dst, (SPselectfcc i32:$T, i32:$F, imm:$Cond))]>;
478
479   def SELECT_CC_FP_FCC
480    : Pseudo<(outs FPRegs:$dst), (ins FPRegs:$T, FPRegs:$F, i32imm:$Cond),
481             "; SELECT_CC_FP_FCC PSEUDO!",
482             [(set f32:$dst, (SPselectfcc f32:$T, f32:$F, imm:$Cond))]>;
483   def SELECT_CC_DFP_FCC
484    : Pseudo<(outs DFPRegs:$dst), (ins DFPRegs:$T, DFPRegs:$F, i32imm:$Cond),
485             "; SELECT_CC_DFP_FCC PSEUDO!",
486             [(set f64:$dst, (SPselectfcc f64:$T, f64:$F, imm:$Cond))]>;
487   def SELECT_CC_QFP_FCC
488    : Pseudo<(outs QFPRegs:$dst), (ins QFPRegs:$T, QFPRegs:$F, i32imm:$Cond),
489             "; SELECT_CC_QFP_FCC PSEUDO!",
490             [(set f128:$dst, (SPselectfcc f128:$T, f128:$F, imm:$Cond))]>;
491 }
492
493 // Section B.1 - Load Integer Instructions, p. 90
494 let DecoderMethod = "DecodeLoadInt" in {
495   defm LDSB : LoadA<"ldsb", 0b001001, 0b011001, sextloadi8,  IntRegs, i32>;
496   defm LDSH : LoadA<"ldsh", 0b001010, 0b011010, sextloadi16, IntRegs, i32>;
497   defm LDUB : LoadA<"ldub", 0b000001, 0b010001, zextloadi8,  IntRegs, i32>;
498   defm LDUH : LoadA<"lduh", 0b000010, 0b010010, zextloadi16, IntRegs, i32>;
499   defm LD   : LoadA<"ld",   0b000000, 0b010000, load,        IntRegs, i32>;
500 }
501
502 let DecoderMethod = "DecodeLoadIntPair" in
503   defm LDD : LoadA<"ldd", 0b000011, 0b010011, load, IntPair, v2i32, IIC_ldd>;
504
505 // Section B.2 - Load Floating-point Instructions, p. 92
506 let DecoderMethod = "DecodeLoadFP" in {
507   defm LDF   : Load<"ld",  0b100000, load,    FPRegs,  f32, IIC_iu_or_fpu_instr>;
508   def LDFArr : LoadASI<"ld",  0b110000, load, FPRegs,  f32, IIC_iu_or_fpu_instr>,
509                 Requires<[HasV9]>;
510 }
511 let DecoderMethod = "DecodeLoadDFP" in {
512   defm LDDF   : Load<"ldd", 0b100011, load,    DFPRegs, f64, IIC_ldd>;
513   def LDDFArr : LoadASI<"ldd", 0b110011, load, DFPRegs, f64>,
514                  Requires<[HasV9]>;
515 }
516 let DecoderMethod = "DecodeLoadQFP" in
517   defm LDQF  : LoadA<"ldq", 0b100010, 0b110010, load, QFPRegs, f128>,
518                Requires<[HasV9, HasHardQuad]>;
519
520 let DecoderMethod = "DecodeLoadCP" in 
521   defm LDC   : Load<"ld", 0b110000, load, CoprocRegs, i32>; 
522 let DecoderMethod = "DecodeLoadCPPair" in 
523   defm LDDC   : Load<"ldd", 0b110011, load, CoprocPair, v2i32, IIC_ldd>;
524
525 let DecoderMethod = "DecodeLoadCP", Defs = [CPSR] in {
526   let rd = 0 in {
527     def LDCSRrr : F3_1<3, 0b110001, (outs), (ins MEMrr:$addr),
528                        "ld [$addr], %csr", []>;
529     def LDCSRri : F3_2<3, 0b110001, (outs), (ins MEMri:$addr),
530                        "ld [$addr], %csr", []>;
531   }
532 }
533   
534 let DecoderMethod = "DecodeLoadFP" in
535   let Defs = [FSR] in {
536     let rd = 0 in {
537       def LDFSRrr : F3_1<3, 0b100001, (outs), (ins MEMrr:$addr),
538                      "ld [$addr], %fsr", [], IIC_iu_or_fpu_instr>;
539       def LDFSRri : F3_2<3, 0b100001, (outs), (ins MEMri:$addr),
540                      "ld [$addr], %fsr", [], IIC_iu_or_fpu_instr>;
541     }
542     let rd = 1 in {
543       def LDXFSRrr : F3_1<3, 0b100001, (outs), (ins MEMrr:$addr),
544                      "ldx [$addr], %fsr", []>, Requires<[HasV9]>;
545       def LDXFSRri : F3_2<3, 0b100001, (outs), (ins MEMri:$addr),
546                      "ldx [$addr], %fsr", []>, Requires<[HasV9]>;
547     }
548   }
549
550 // Section B.4 - Store Integer Instructions, p. 95
551 let DecoderMethod = "DecodeStoreInt" in {
552   defm STB   : StoreA<"stb", 0b000101, 0b010101, truncstorei8,  IntRegs, i32>;
553   defm STH   : StoreA<"sth", 0b000110, 0b010110, truncstorei16, IntRegs, i32>;
554   defm ST    : StoreA<"st",  0b000100, 0b010100, store,         IntRegs, i32>;
555 }
556
557 let DecoderMethod = "DecodeStoreIntPair" in
558   defm STD   : StoreA<"std", 0b000111, 0b010111, store, IntPair, v2i32, IIC_std>;
559
560 // Section B.5 - Store Floating-point Instructions, p. 97
561 let DecoderMethod = "DecodeStoreFP" in {
562   defm STF   : Store<"st",  0b100100, store,         FPRegs,  f32>;
563   def STFArr : StoreASI<"st",  0b110100, store,      FPRegs,  f32>,
564                Requires<[HasV9]>;
565 }
566 let DecoderMethod = "DecodeStoreDFP" in {
567   defm STDF   : Store<"std", 0b100111, store,         DFPRegs, f64, IIC_std>;
568   def STDFArr : StoreASI<"std", 0b110111, store,      DFPRegs, f64>,
569                 Requires<[HasV9]>;
570 }
571 let DecoderMethod = "DecodeStoreQFP" in
572   defm STQF  : StoreA<"stq", 0b100110, 0b110110, store, QFPRegs, f128>,
573                Requires<[HasV9, HasHardQuad]>;
574
575 let DecoderMethod = "DecodeStoreCP" in 
576   defm STC   : Store<"st", 0b110100, store, CoprocRegs, i32>; 
577   
578 let DecoderMethod = "DecodeStoreCPPair" in 
579   defm STDC   : Store<"std", 0b110111, store, CoprocPair, v2i32, IIC_std>;
580   
581 let DecoderMethod = "DecodeStoreCP", rd = 0 in {
582   let Defs = [CPSR] in {
583     def STCSRrr : F3_1<3, 0b110101, (outs MEMrr:$addr), (ins),
584                        "st %csr, [$addr]", [], IIC_st>;
585     def STCSRri : F3_2<3, 0b110101, (outs MEMri:$addr), (ins),
586                        "st %csr, [$addr]", [], IIC_st>;
587   }
588   let Defs = [CPQ] in {
589     def STDCQrr : F3_1<3, 0b110110, (outs MEMrr:$addr), (ins),
590                        "std %cq, [$addr]", [], IIC_std>;
591     def STDCQri : F3_2<3, 0b110110, (outs MEMri:$addr), (ins),
592                        "std %cq, [$addr]", [], IIC_std>;
593   }
594 }
595
596 let DecoderMethod = "DecodeStoreFP" in {
597   let rd = 0 in {
598     let Defs = [FSR] in {
599       def STFSRrr : F3_1<3, 0b100101, (outs MEMrr:$addr), (ins),
600                      "st %fsr, [$addr]", [], IIC_st>;
601       def STFSRri : F3_2<3, 0b100101, (outs MEMri:$addr), (ins),
602                      "st %fsr, [$addr]", [], IIC_st>;
603     }
604     let Defs = [FQ] in {
605       def STDFQrr : F3_1<3, 0b100110, (outs MEMrr:$addr), (ins),
606                      "std %fq, [$addr]", [], IIC_std>;
607       def STDFQri : F3_2<3, 0b100110, (outs MEMri:$addr), (ins),
608                      "std %fq, [$addr]", [], IIC_std>;
609     }
610   }
611   let rd = 1, Defs = [FSR] in {
612     def STXFSRrr : F3_1<3, 0b100101, (outs MEMrr:$addr), (ins),
613                    "stx %fsr, [$addr]", []>, Requires<[HasV9]>;
614     def STXFSRri : F3_2<3, 0b100101, (outs MEMri:$addr), (ins),
615                    "stx %fsr, [$addr]", []>, Requires<[HasV9]>;
616   }
617 }
618
619 // Section B.8 - SWAP Register with Memory Instruction
620 // (Atomic swap)
621 let Constraints = "$val = $dst", DecoderMethod = "DecodeSWAP" in {
622   def SWAPrr : F3_1<3, 0b001111,
623                  (outs IntRegs:$dst), (ins MEMrr:$addr, IntRegs:$val),
624                  "swap [$addr], $dst",
625                  [(set i32:$dst, (atomic_swap_32 ADDRrr:$addr, i32:$val))]>;
626   def SWAPri : F3_2<3, 0b001111,
627                  (outs IntRegs:$dst), (ins MEMri:$addr, IntRegs:$val),
628                  "swap [$addr], $dst",
629                  [(set i32:$dst, (atomic_swap_32 ADDRri:$addr, i32:$val))]>;
630   def SWAPArr : F3_1_asi<3, 0b011111,
631                  (outs IntRegs:$dst), (ins MEMrr:$addr, i8imm:$asi, IntRegs:$val),
632                  "swapa [$addr] $asi, $dst",
633                  [/*FIXME: pattern?*/]>;
634 }
635
636
637 // Section B.9 - SETHI Instruction, p. 104
638 def SETHIi: F2_1<0b100,
639                  (outs IntRegs:$rd), (ins i32imm:$imm22),
640                  "sethi $imm22, $rd",
641                  [(set i32:$rd, SETHIimm:$imm22)],
642                  IIC_iu_instr>;
643
644 // Section B.10 - NOP Instruction, p. 105
645 // (It's a special case of SETHI)
646 let rd = 0, imm22 = 0 in
647   def NOP : F2_1<0b100, (outs), (ins), "nop", []>;
648
649 // Section B.11 - Logical Instructions, p. 106
650 defm AND    : F3_12<"and", 0b000001, and, IntRegs, i32, simm13Op>;
651
652 def ANDNrr  : F3_1<2, 0b000101,
653                    (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2),
654                    "andn $rs1, $rs2, $rd",
655                    [(set i32:$rd, (and i32:$rs1, (not i32:$rs2)))]>;
656 def ANDNri  : F3_2<2, 0b000101,
657                    (outs IntRegs:$rd), (ins IntRegs:$rs1, simm13Op:$simm13),
658                    "andn $rs1, $simm13, $rd", []>;
659
660 defm OR     : F3_12<"or", 0b000010, or, IntRegs, i32, simm13Op>;
661
662 def ORNrr   : F3_1<2, 0b000110,
663                    (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2),
664                    "orn $rs1, $rs2, $rd",
665                    [(set i32:$rd, (or i32:$rs1, (not i32:$rs2)))]>;
666 def ORNri   : F3_2<2, 0b000110,
667                    (outs IntRegs:$rd), (ins IntRegs:$rs1, simm13Op:$simm13),
668                    "orn $rs1, $simm13, $rd", []>;
669 defm XOR    : F3_12<"xor", 0b000011, xor, IntRegs, i32, simm13Op>;
670
671 def XNORrr  : F3_1<2, 0b000111,
672                    (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2),
673                    "xnor $rs1, $rs2, $rd",
674                    [(set i32:$rd, (not (xor i32:$rs1, i32:$rs2)))]>;
675 def XNORri  : F3_2<2, 0b000111,
676                    (outs IntRegs:$rd), (ins IntRegs:$rs1, simm13Op:$simm13),
677                    "xnor $rs1, $simm13, $rd", []>;
678
679 def : Pat<(and IntRegs:$rs1, SETHIimm_not:$rs2),
680           (ANDNrr i32:$rs1, (SETHIi SETHIimm_not:$rs2))>;
681
682 def : Pat<(or IntRegs:$rs1, SETHIimm_not:$rs2),
683           (ORNrr i32:$rs1,  (SETHIi SETHIimm_not:$rs2))>;
684
685 let Defs = [ICC] in {
686   defm ANDCC  : F3_12np<"andcc",  0b010001>;
687   defm ANDNCC : F3_12np<"andncc", 0b010101>;
688   defm ORCC   : F3_12np<"orcc",   0b010010>;
689   defm ORNCC  : F3_12np<"orncc",  0b010110>;
690   defm XORCC  : F3_12np<"xorcc",  0b010011>;
691   defm XNORCC : F3_12np<"xnorcc", 0b010111>;
692 }
693
694 // Section B.12 - Shift Instructions, p. 107
695 defm SLL : F3_12<"sll", 0b100101, shl, IntRegs, i32, simm13Op>;
696 defm SRL : F3_12<"srl", 0b100110, srl, IntRegs, i32, simm13Op>;
697 defm SRA : F3_12<"sra", 0b100111, sra, IntRegs, i32, simm13Op>;
698
699 // Section B.13 - Add Instructions, p. 108
700 defm ADD   : F3_12<"add", 0b000000, add, IntRegs, i32, simm13Op>;
701
702 // "LEA" forms of add (patterns to make tblgen happy)
703 let Predicates = [Is32Bit], isCodeGenOnly = 1 in
704   def LEA_ADDri   : F3_2<2, 0b000000,
705                      (outs IntRegs:$dst), (ins MEMri:$addr),
706                      "add ${addr:arith}, $dst",
707                      [(set iPTR:$dst, ADDRri:$addr)]>;
708
709 let Defs = [ICC] in
710   defm ADDCC  : F3_12<"addcc", 0b010000, addc, IntRegs, i32, simm13Op>;
711
712 let Uses = [ICC] in
713   defm ADDC   : F3_12np<"addx", 0b001000>;
714
715 let Uses = [ICC], Defs = [ICC] in
716   defm ADDE  : F3_12<"addxcc", 0b011000, adde, IntRegs, i32, simm13Op>;
717
718 // Section B.15 - Subtract Instructions, p. 110
719 defm SUB    : F3_12  <"sub"  , 0b000100, sub, IntRegs, i32, simm13Op>;
720 let Uses = [ICC], Defs = [ICC] in
721   defm SUBE   : F3_12  <"subxcc" , 0b011100, sube, IntRegs, i32, simm13Op>;
722
723 let Defs = [ICC] in
724   defm SUBCC  : F3_12  <"subcc", 0b010100, subc, IntRegs, i32, simm13Op>;
725
726 let Uses = [ICC] in
727   defm SUBC   : F3_12np <"subx", 0b001100>;
728
729 // cmp (from Section A.3) is a specialized alias for subcc
730 let Defs = [ICC], rd = 0 in {
731   def CMPrr   : F3_1<2, 0b010100,
732                      (outs), (ins IntRegs:$rs1, IntRegs:$rs2),
733                      "cmp $rs1, $rs2",
734                      [(SPcmpicc i32:$rs1, i32:$rs2)]>;
735   def CMPri   : F3_2<2, 0b010100,
736                      (outs), (ins IntRegs:$rs1, simm13Op:$simm13),
737                      "cmp $rs1, $simm13",
738                      [(SPcmpicc i32:$rs1, (i32 simm13:$simm13))]>;
739 }
740
741 // Section B.18 - Multiply Instructions, p. 113
742 let Defs = [Y] in {
743   defm UMUL : F3_12<"umul", 0b001010, umullohi, IntRegs, i32, simm13Op, IIC_iu_umul>;
744   defm SMUL : F3_12<"smul", 0b001011, smullohi, IntRegs, i32, simm13Op, IIC_iu_smul>;
745 }
746
747 let Defs = [Y, ICC] in {
748   defm UMULCC : F3_12np<"umulcc", 0b011010, IIC_iu_umul>;
749   defm SMULCC : F3_12np<"smulcc", 0b011011, IIC_iu_smul>;
750 }
751
752 let Defs = [Y, ICC], Uses = [Y, ICC] in {
753   defm MULSCC : F3_12np<"mulscc", 0b100100>;
754 }
755
756 // Section B.19 - Divide Instructions, p. 115
757 let Uses = [Y], Defs = [Y] in {
758   defm UDIV : F3_12np<"udiv", 0b001110, IIC_iu_div>;
759   defm SDIV : F3_12np<"sdiv", 0b001111, IIC_iu_div>;
760 }
761
762 let Uses = [Y], Defs = [Y, ICC] in {
763   defm UDIVCC : F3_12np<"udivcc", 0b011110, IIC_iu_div>;
764   defm SDIVCC : F3_12np<"sdivcc", 0b011111, IIC_iu_div>;
765 }
766
767 // Section B.20 - SAVE and RESTORE, p. 117
768 defm SAVE    : F3_12np<"save"   , 0b111100>;
769 defm RESTORE : F3_12np<"restore", 0b111101>;
770
771 // Section B.21 - Branch on Integer Condition Codes Instructions, p. 119
772
773 // unconditional branch class.
774 class BranchAlways<dag ins, string asmstr, list<dag> pattern>
775   : F2_2<0b010, 0, (outs), ins, asmstr, pattern> {
776   let isBranch     = 1;
777   let isTerminator = 1;
778   let hasDelaySlot = 1;
779   let isBarrier    = 1;
780 }
781
782 let cond = 8 in
783   def BA : BranchAlways<(ins brtarget:$imm22), "ba $imm22", [(br bb:$imm22)]>;
784
785
786 let isBranch = 1, isTerminator = 1, hasDelaySlot = 1 in {
787
788 // conditional branch class:
789 class BranchSP<dag ins, string asmstr, list<dag> pattern>
790  : F2_2<0b010, 0, (outs), ins, asmstr, pattern, IIC_iu_instr>;
791
792 // conditional branch with annul class:
793 class BranchSPA<dag ins, string asmstr, list<dag> pattern>
794  : F2_2<0b010, 1, (outs), ins, asmstr, pattern, IIC_iu_instr>;
795
796 // Conditional branch class on %icc|%xcc with predication:
797 multiclass IPredBranch<string regstr, list<dag> CCPattern> {
798   def CC    : F2_3<0b001, 0, 1, (outs), (ins bprtarget:$imm19, CCOp:$cond),
799                    !strconcat("b$cond ", !strconcat(regstr, ", $imm19")),
800                    CCPattern,
801                    IIC_iu_instr>;
802   def CCA   : F2_3<0b001, 1, 1, (outs), (ins bprtarget:$imm19, CCOp:$cond),
803                    !strconcat("b$cond,a ", !strconcat(regstr, ", $imm19")),
804                    [],
805                    IIC_iu_instr>;
806   def CCNT  : F2_3<0b001, 0, 0, (outs), (ins bprtarget:$imm19, CCOp:$cond),
807                    !strconcat("b$cond,pn ", !strconcat(regstr, ", $imm19")),
808                    [],
809                    IIC_iu_instr>;
810   def CCANT : F2_3<0b001, 1, 0, (outs), (ins bprtarget:$imm19, CCOp:$cond),
811                    !strconcat("b$cond,a,pn ", !strconcat(regstr, ", $imm19")),
812                    [],
813                    IIC_iu_instr>;
814 }
815
816 } // let isBranch = 1, isTerminator = 1, hasDelaySlot = 1
817
818
819 // Indirect branch instructions.
820 let isTerminator = 1, isBarrier = 1,  hasDelaySlot = 1, isBranch =1,
821      isIndirectBranch = 1, rd = 0, isCodeGenOnly = 1 in {
822   def BINDrr  : F3_1<2, 0b111000,
823                    (outs), (ins MEMrr:$ptr),
824                    "jmp $ptr",
825                    [(brind ADDRrr:$ptr)]>;
826   def BINDri  : F3_2<2, 0b111000,
827                    (outs), (ins MEMri:$ptr),
828                    "jmp $ptr",
829                    [(brind ADDRri:$ptr)]>;
830 }
831
832 let Uses = [ICC] in {
833   def BCOND : BranchSP<(ins brtarget:$imm22, CCOp:$cond),
834                          "b$cond $imm22",
835                         [(SPbricc bb:$imm22, imm:$cond)]>;
836   def BCONDA : BranchSPA<(ins brtarget:$imm22, CCOp:$cond),
837                          "b$cond,a $imm22", []>;
838
839   let Predicates = [HasV9], cc = 0b00 in
840     defm BPI : IPredBranch<"%icc", []>;
841 }
842
843 // Section B.22 - Branch on Floating-point Condition Codes Instructions, p. 121
844
845 let isBranch = 1, isTerminator = 1, hasDelaySlot = 1 in {
846
847 // floating-point conditional branch class:
848 class FPBranchSP<dag ins, string asmstr, list<dag> pattern>
849  : F2_2<0b110, 0, (outs), ins, asmstr, pattern, IIC_fpu_normal_instr>;
850
851 // floating-point conditional branch with annul class:
852 class FPBranchSPA<dag ins, string asmstr, list<dag> pattern>
853  : F2_2<0b110, 1, (outs), ins, asmstr, pattern, IIC_fpu_normal_instr>;
854
855 // Conditional branch class on %fcc0-%fcc3 with predication:
856 multiclass FPredBranch {
857   def CC    : F2_3<0b101, 0, 1, (outs), (ins bprtarget:$imm19, CCOp:$cond,
858                                          FCCRegs:$cc),
859                   "fb$cond $cc, $imm19", [], IIC_fpu_normal_instr>;
860   def CCA   : F2_3<0b101, 1, 1, (outs), (ins bprtarget:$imm19, CCOp:$cond,
861                                          FCCRegs:$cc),
862                   "fb$cond,a $cc, $imm19", [], IIC_fpu_normal_instr>;
863   def CCNT  : F2_3<0b101, 0, 0, (outs), (ins bprtarget:$imm19, CCOp:$cond,
864                                          FCCRegs:$cc),
865                   "fb$cond,pn $cc, $imm19", [], IIC_fpu_normal_instr>;
866   def CCANT : F2_3<0b101, 1, 0, (outs), (ins bprtarget:$imm19, CCOp:$cond,
867                                          FCCRegs:$cc),
868                   "fb$cond,a,pn $cc, $imm19", [], IIC_fpu_normal_instr>;
869 }
870 } // let isBranch = 1, isTerminator = 1, hasDelaySlot = 1
871
872 let Uses = [FCC0] in {
873   def FBCOND  : FPBranchSP<(ins brtarget:$imm22, CCOp:$cond),
874                               "fb$cond $imm22",
875                               [(SPbrfcc bb:$imm22, imm:$cond)]>;
876   def FBCONDA : FPBranchSPA<(ins brtarget:$imm22, CCOp:$cond),
877                              "fb$cond,a $imm22", []>;
878 }
879
880 let Predicates = [HasV9] in
881   defm BPF : FPredBranch;
882
883 // Section B.22 - Branch on Co-processor Condition Codes Instructions, p. 123
884 let isBranch = 1, isTerminator = 1, hasDelaySlot = 1 in {
885
886 // co-processor conditional branch class:
887 class CPBranchSP<dag ins, string asmstr, list<dag> pattern>
888  : F2_2<0b111, 0, (outs), ins, asmstr, pattern>;
889
890 // co-processor conditional branch with annul class:
891 class CPBranchSPA<dag ins, string asmstr, list<dag> pattern>
892  : F2_2<0b111, 1, (outs), ins, asmstr, pattern>;
893
894 } // let isBranch = 1, isTerminator = 1, hasDelaySlot = 1
895
896 def CBCOND  : CPBranchSP<(ins brtarget:$imm22, CCOp:$cond),
897                           "cb$cond $imm22",
898                           [(SPbrfcc bb:$imm22, imm:$cond)]>;
899 def CBCONDA : CPBranchSPA<(ins brtarget:$imm22, CCOp:$cond),
900                            "cb$cond,a $imm22", []>;
901                            
902 // Section B.24 - Call and Link Instruction, p. 125
903 // This is the only Format 1 instruction
904 let Uses = [O6],
905     hasDelaySlot = 1, isCall = 1 in {
906   def CALL : InstSP<(outs), (ins calltarget:$disp, variable_ops),
907                     "call $disp",
908                     [],
909                     IIC_jmp_or_call> {
910     bits<30> disp;
911     let op = 1;
912     let Inst{29-0} = disp;
913   }
914
915   // indirect calls: special cases of JMPL.
916   let isCodeGenOnly = 1, rd = 15 in {
917     def CALLrr : F3_1<2, 0b111000,
918                       (outs), (ins MEMrr:$ptr, variable_ops),
919                       "call $ptr",
920                       [(call ADDRrr:$ptr)],
921                       IIC_jmp_or_call>;
922     def CALLri : F3_2<2, 0b111000,
923                       (outs), (ins MEMri:$ptr, variable_ops),
924                       "call $ptr",
925                       [(call ADDRri:$ptr)],
926                       IIC_jmp_or_call>;
927   }
928 }
929
930 // Section B.25 - Jump and Link Instruction
931
932 // JMPL Instruction.
933 let isTerminator = 1, hasDelaySlot = 1, isBarrier = 1,
934     DecoderMethod = "DecodeJMPL" in {
935   def JMPLrr: F3_1<2, 0b111000,
936                    (outs IntRegs:$dst), (ins MEMrr:$addr),
937                    "jmpl $addr, $dst",
938                    [],
939                    IIC_jmp_or_call>;
940   def JMPLri: F3_2<2, 0b111000,
941                    (outs IntRegs:$dst), (ins MEMri:$addr),
942                    "jmpl $addr, $dst",
943                    [],
944                    IIC_jmp_or_call>;
945 }
946
947 // Section A.3 - Synthetic Instructions, p. 85
948 // special cases of JMPL:
949 let isReturn = 1, isTerminator = 1, hasDelaySlot = 1, isBarrier = 1,
950     isCodeGenOnly = 1 in {
951   let rd = 0, rs1 = 15 in
952     def RETL: F3_2<2, 0b111000,
953                    (outs), (ins i32imm:$val),
954                    "jmp %o7+$val",
955                    [(retflag simm13:$val)],
956                    IIC_jmp_or_call>;
957
958   let rd = 0, rs1 = 31 in
959     def RET: F3_2<2, 0b111000,
960                   (outs), (ins i32imm:$val),
961                   "jmp %i7+$val",
962                   [],
963                   IIC_jmp_or_call>;
964 }
965
966 // Section B.26 - Return from Trap Instruction
967 let isReturn = 1, isTerminator = 1, hasDelaySlot = 1,
968      isBarrier = 1, rd = 0, DecoderMethod = "DecodeReturn" in {
969   def RETTrr : F3_1<2, 0b111001,
970                    (outs), (ins MEMrr:$addr),
971                    "rett $addr",
972                    [],
973                    IIC_jmp_or_call>;
974   def RETTri : F3_2<2, 0b111001,
975                     (outs), (ins MEMri:$addr),
976                     "rett $addr",
977                     [],
978                     IIC_jmp_or_call>;
979 }
980
981
982 // Section B.27 - Trap on Integer Condition Codes Instruction
983 // conditional branch class:
984 let DecoderNamespace = "SparcV8", DecoderMethod = "DecodeTRAP", hasSideEffects = 1, Uses = [ICC], cc = 0b00 in
985 {
986   def TRAPrr : TRAPSPrr<0b111010,
987                         (outs), (ins IntRegs:$rs1, IntRegs:$rs2, CCOp:$cond),
988                         "t$cond $rs1 + $rs2",
989                         []>;
990   def TRAPri : TRAPSPri<0b111010,
991                         (outs), (ins IntRegs:$rs1, i32imm:$imm, CCOp:$cond),
992                         "t$cond $rs1 + $imm",
993                         []>;
994 }
995
996 multiclass TRAP<string regStr> {
997   def rr : TRAPSPrr<0b111010,
998                     (outs), (ins IntRegs:$rs1, IntRegs:$rs2, CCOp:$cond),
999                     !strconcat(!strconcat("t$cond ", regStr), ", $rs1 + $rs2"),
1000                     []>;
1001   def ri : TRAPSPri<0b111010,
1002                     (outs), (ins IntRegs:$rs1, i32imm:$imm, CCOp:$cond),
1003                     !strconcat(!strconcat("t$cond ", regStr), ", $rs1 + $imm"),
1004                     []>;
1005 }
1006
1007 let DecoderNamespace = "SparcV9", DecoderMethod = "DecodeTRAP", Predicates = [HasV9], hasSideEffects = 1, Uses = [ICC], cc = 0b00 in
1008   defm TICC : TRAP<"%icc">;
1009
1010
1011 let isBarrier = 1, isTerminator = 1, rd = 0b01000, rs1 = 0, simm13 = 5 in
1012   def TA5 : F3_2<0b10, 0b111010, (outs), (ins), "ta 5", [(trap)]>;
1013
1014 let hasSideEffects = 1, rd = 0b01000, rs1 = 0, simm13 = 1 in
1015   def TA1 : F3_2<0b10, 0b111010, (outs), (ins), "ta 1", [(debugtrap)]>;
1016
1017 // Section B.28 - Read State Register Instructions
1018 let rs2 = 0 in
1019   def RDASR : F3_1<2, 0b101000,
1020                  (outs IntRegs:$rd), (ins ASRRegs:$rs1),
1021                  "rd $rs1, $rd", []>;
1022
1023 // PSR, WIM, and TBR don't exist on the SparcV9, only the V8.
1024 let Predicates = [HasNoV9] in {
1025   let rs2 = 0, rs1 = 0, Uses=[PSR] in
1026     def RDPSR : F3_1<2, 0b101001,
1027                      (outs IntRegs:$rd), (ins),
1028                      "rd %psr, $rd", []>;
1029
1030   let rs2 = 0, rs1 = 0, Uses=[WIM] in
1031     def RDWIM : F3_1<2, 0b101010,
1032                      (outs IntRegs:$rd), (ins),
1033                      "rd %wim, $rd", []>;
1034
1035   let rs2 = 0, rs1 = 0, Uses=[TBR] in
1036     def RDTBR : F3_1<2, 0b101011,
1037                      (outs IntRegs:$rd), (ins),
1038                      "rd %tbr, $rd", []>;
1039 }
1040
1041 // Section B.29 - Write State Register Instructions
1042 def WRASRrr : F3_1<2, 0b110000,
1043                  (outs ASRRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2),
1044                  "wr $rs1, $rs2, $rd", []>;
1045 def WRASRri : F3_2<2, 0b110000,
1046                  (outs ASRRegs:$rd), (ins IntRegs:$rs1, simm13Op:$simm13),
1047                  "wr $rs1, $simm13, $rd", []>;
1048
1049 // PSR, WIM, and TBR don't exist on the SparcV9, only the V8.
1050 let Predicates = [HasNoV9] in {
1051   let Defs = [PSR], rd=0 in {
1052     def WRPSRrr : F3_1<2, 0b110001,
1053                      (outs), (ins IntRegs:$rs1, IntRegs:$rs2),
1054                      "wr $rs1, $rs2, %psr", []>;
1055     def WRPSRri : F3_2<2, 0b110001,
1056                      (outs), (ins IntRegs:$rs1, simm13Op:$simm13),
1057                      "wr $rs1, $simm13, %psr", []>;
1058   }
1059
1060   let Defs = [WIM], rd=0 in {
1061     def WRWIMrr : F3_1<2, 0b110010,
1062                      (outs), (ins IntRegs:$rs1, IntRegs:$rs2),
1063                      "wr $rs1, $rs2, %wim", []>;
1064     def WRWIMri : F3_2<2, 0b110010,
1065                      (outs), (ins IntRegs:$rs1, simm13Op:$simm13),
1066                      "wr $rs1, $simm13, %wim", []>;
1067   }
1068
1069   let Defs = [TBR], rd=0 in {
1070     def WRTBRrr : F3_1<2, 0b110011,
1071                      (outs), (ins IntRegs:$rs1, IntRegs:$rs2),
1072                      "wr $rs1, $rs2, %tbr", []>;
1073     def WRTBRri : F3_2<2, 0b110011,
1074                      (outs), (ins IntRegs:$rs1, simm13Op:$simm13),
1075                      "wr $rs1, $simm13, %tbr", []>;
1076   }
1077 }
1078
1079 // Section B.30 - STBAR Instruction
1080 let hasSideEffects = 1, rd = 0, rs1 = 0b01111, rs2 = 0 in
1081   def STBAR : F3_1<2, 0b101000, (outs), (ins), "stbar", []>;
1082
1083
1084 // Section B.31 - Unimplmented Instruction
1085 let rd = 0 in
1086   def UNIMP : F2_1<0b000, (outs), (ins i32imm:$imm22),
1087                   "unimp $imm22", []>;
1088
1089 // Section B.32 - Flush Instruction Memory
1090 let rd = 0 in {
1091   def FLUSHrr : F3_1<2, 0b111011, (outs), (ins MEMrr:$addr),
1092                        "flush $addr", []>;
1093   def FLUSHri : F3_2<2, 0b111011, (outs), (ins MEMri:$addr),
1094                        "flush $addr", []>;
1095
1096   // The no-arg FLUSH is only here for the benefit of the InstAlias
1097   // "flush", which cannot seem to use FLUSHrr, due to the inability
1098   // to construct a MEMrr with fixed G0 registers.
1099   let rs1 = 0, rs2 = 0 in
1100     def FLUSH   : F3_1<2, 0b111011, (outs), (ins), "flush %g0", []>;
1101 }
1102
1103 // Section B.33 - Floating-point Operate (FPop) Instructions
1104
1105 // Convert Integer to Floating-point Instructions, p. 141
1106 def FITOS : F3_3u<2, 0b110100, 0b011000100,
1107                  (outs FPRegs:$rd), (ins FPRegs:$rs2),
1108                  "fitos $rs2, $rd",
1109                  [(set FPRegs:$rd, (SPitof FPRegs:$rs2))],
1110                  IIC_fpu_fast_instr>;
1111 def FITOD : F3_3u<2, 0b110100, 0b011001000,
1112                  (outs DFPRegs:$rd), (ins FPRegs:$rs2),
1113                  "fitod $rs2, $rd",
1114                  [(set DFPRegs:$rd, (SPitof FPRegs:$rs2))],
1115                  IIC_fpu_fast_instr>;
1116 def FITOQ : F3_3u<2, 0b110100, 0b011001100,
1117                  (outs QFPRegs:$rd), (ins FPRegs:$rs2),
1118                  "fitoq $rs2, $rd",
1119                  [(set QFPRegs:$rd, (SPitof FPRegs:$rs2))]>,
1120                  Requires<[HasHardQuad]>;
1121
1122 // Convert Floating-point to Integer Instructions, p. 142
1123 def FSTOI : F3_3u<2, 0b110100, 0b011010001,
1124                  (outs FPRegs:$rd), (ins FPRegs:$rs2),
1125                  "fstoi $rs2, $rd",
1126                  [(set FPRegs:$rd, (SPftoi FPRegs:$rs2))],
1127                  IIC_fpu_fast_instr>;
1128 def FDTOI : F3_3u<2, 0b110100, 0b011010010,
1129                  (outs FPRegs:$rd), (ins DFPRegs:$rs2),
1130                  "fdtoi $rs2, $rd",
1131                  [(set FPRegs:$rd, (SPftoi DFPRegs:$rs2))],
1132                  IIC_fpu_fast_instr>;
1133 def FQTOI : F3_3u<2, 0b110100, 0b011010011,
1134                  (outs FPRegs:$rd), (ins QFPRegs:$rs2),
1135                  "fqtoi $rs2, $rd",
1136                  [(set FPRegs:$rd, (SPftoi QFPRegs:$rs2))]>,
1137                  Requires<[HasHardQuad]>;
1138
1139 // Convert between Floating-point Formats Instructions, p. 143
1140 def FSTOD : F3_3u<2, 0b110100, 0b011001001,
1141                  (outs DFPRegs:$rd), (ins FPRegs:$rs2),
1142                  "fstod $rs2, $rd",
1143                  [(set f64:$rd, (fpextend f32:$rs2))],
1144                  IIC_fpu_stod>;
1145 def FSTOQ : F3_3u<2, 0b110100, 0b011001101,
1146                  (outs QFPRegs:$rd), (ins FPRegs:$rs2),
1147                  "fstoq $rs2, $rd",
1148                  [(set f128:$rd, (fpextend f32:$rs2))]>,
1149                  Requires<[HasHardQuad]>;
1150 def FDTOS : F3_3u<2, 0b110100, 0b011000110,
1151                  (outs FPRegs:$rd), (ins DFPRegs:$rs2),
1152                  "fdtos $rs2, $rd",
1153                  [(set f32:$rd, (fpround f64:$rs2))],
1154                  IIC_fpu_fast_instr>;
1155 def FDTOQ : F3_3u<2, 0b110100, 0b011001110,
1156                  (outs QFPRegs:$rd), (ins DFPRegs:$rs2),
1157                  "fdtoq $rs2, $rd",
1158                  [(set f128:$rd, (fpextend f64:$rs2))]>,
1159                  Requires<[HasHardQuad]>;
1160 def FQTOS : F3_3u<2, 0b110100, 0b011000111,
1161                  (outs FPRegs:$rd), (ins QFPRegs:$rs2),
1162                  "fqtos $rs2, $rd",
1163                  [(set f32:$rd, (fpround f128:$rs2))]>,
1164                  Requires<[HasHardQuad]>;
1165 def FQTOD : F3_3u<2, 0b110100, 0b011001011,
1166                  (outs DFPRegs:$rd), (ins QFPRegs:$rs2),
1167                  "fqtod $rs2, $rd",
1168                  [(set f64:$rd, (fpround f128:$rs2))]>,
1169                  Requires<[HasHardQuad]>;
1170
1171 // Floating-point Move Instructions, p. 144
1172 def FMOVS : F3_3u<2, 0b110100, 0b000000001,
1173                  (outs FPRegs:$rd), (ins FPRegs:$rs2),
1174                  "fmovs $rs2, $rd", []>;
1175 def FNEGS : F3_3u<2, 0b110100, 0b000000101,
1176                  (outs FPRegs:$rd), (ins FPRegs:$rs2),
1177                  "fnegs $rs2, $rd",
1178                  [(set f32:$rd, (fneg f32:$rs2))],
1179                  IIC_fpu_negs>;
1180 def FABSS : F3_3u<2, 0b110100, 0b000001001,
1181                  (outs FPRegs:$rd), (ins FPRegs:$rs2),
1182                  "fabss $rs2, $rd",
1183                  [(set f32:$rd, (fabs f32:$rs2))],
1184                  IIC_fpu_abs>;
1185
1186
1187 // Floating-point Square Root Instructions, p.145
1188 // FSQRTS generates an erratum on LEON processors, so by disabling this instruction
1189 // this will be promoted to use FSQRTD with doubles instead.
1190 let Predicates = [HasNoFdivSqrtFix] in 
1191 def FSQRTS : F3_3u<2, 0b110100, 0b000101001,
1192                   (outs FPRegs:$rd), (ins FPRegs:$rs2),
1193                   "fsqrts $rs2, $rd",
1194                   [(set f32:$rd, (fsqrt f32:$rs2))],
1195                   IIC_fpu_sqrts>;
1196 def FSQRTD : F3_3u<2, 0b110100, 0b000101010,
1197                   (outs DFPRegs:$rd), (ins DFPRegs:$rs2),
1198                   "fsqrtd $rs2, $rd",
1199                   [(set f64:$rd, (fsqrt f64:$rs2))],
1200                   IIC_fpu_sqrtd>;
1201 def FSQRTQ : F3_3u<2, 0b110100, 0b000101011,
1202                   (outs QFPRegs:$rd), (ins QFPRegs:$rs2),
1203                   "fsqrtq $rs2, $rd",
1204                   [(set f128:$rd, (fsqrt f128:$rs2))]>,
1205                   Requires<[HasHardQuad]>;
1206
1207
1208
1209 // Floating-point Add and Subtract Instructions, p. 146
1210 def FADDS  : F3_3<2, 0b110100, 0b001000001,
1211                   (outs FPRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2),
1212                   "fadds $rs1, $rs2, $rd",
1213                   [(set f32:$rd, (fadd f32:$rs1, f32:$rs2))],
1214                   IIC_fpu_fast_instr>;
1215 def FADDD  : F3_3<2, 0b110100, 0b001000010,
1216                   (outs DFPRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2),
1217                   "faddd $rs1, $rs2, $rd",
1218                   [(set f64:$rd, (fadd f64:$rs1, f64:$rs2))],
1219                   IIC_fpu_fast_instr>;
1220 def FADDQ  : F3_3<2, 0b110100, 0b001000011,
1221                   (outs QFPRegs:$rd), (ins QFPRegs:$rs1, QFPRegs:$rs2),
1222                   "faddq $rs1, $rs2, $rd",
1223                   [(set f128:$rd, (fadd f128:$rs1, f128:$rs2))]>,
1224                   Requires<[HasHardQuad]>;
1225
1226 def FSUBS  : F3_3<2, 0b110100, 0b001000101,
1227                   (outs FPRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2),
1228                   "fsubs $rs1, $rs2, $rd",
1229                   [(set f32:$rd, (fsub f32:$rs1, f32:$rs2))],
1230                   IIC_fpu_fast_instr>;
1231 def FSUBD  : F3_3<2, 0b110100, 0b001000110,
1232                   (outs DFPRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2),
1233                   "fsubd $rs1, $rs2, $rd",
1234                   [(set f64:$rd, (fsub f64:$rs1, f64:$rs2))],
1235                   IIC_fpu_fast_instr>;
1236 def FSUBQ  : F3_3<2, 0b110100, 0b001000111,
1237                   (outs QFPRegs:$rd), (ins QFPRegs:$rs1, QFPRegs:$rs2),
1238                   "fsubq $rs1, $rs2, $rd",
1239                   [(set f128:$rd, (fsub f128:$rs1, f128:$rs2))]>,
1240                   Requires<[HasHardQuad]>;
1241
1242
1243 // Floating-point Multiply and Divide Instructions, p. 147
1244 def FMULS  : F3_3<2, 0b110100, 0b001001001,
1245                   (outs FPRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2),
1246                   "fmuls $rs1, $rs2, $rd",
1247                   [(set f32:$rd, (fmul f32:$rs1, f32:$rs2))],
1248                   IIC_fpu_muls>,
1249                   Requires<[HasFMULS]>;
1250 def FMULD  : F3_3<2, 0b110100, 0b001001010,
1251                   (outs DFPRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2),
1252                   "fmuld $rs1, $rs2, $rd",
1253                   [(set f64:$rd, (fmul f64:$rs1, f64:$rs2))],
1254                   IIC_fpu_muld>;
1255 def FMULQ  : F3_3<2, 0b110100, 0b001001011,
1256                   (outs QFPRegs:$rd), (ins QFPRegs:$rs1, QFPRegs:$rs2),
1257                   "fmulq $rs1, $rs2, $rd",
1258                   [(set f128:$rd, (fmul f128:$rs1, f128:$rs2))]>,
1259                   Requires<[HasHardQuad]>;
1260
1261 def FSMULD : F3_3<2, 0b110100, 0b001101001,
1262                   (outs DFPRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2),
1263                   "fsmuld $rs1, $rs2, $rd",
1264                   [(set f64:$rd, (fmul (fpextend f32:$rs1),
1265                                         (fpextend f32:$rs2)))],
1266                   IIC_fpu_muld>,
1267                   Requires<[HasFSMULD]>;
1268 def FDMULQ : F3_3<2, 0b110100, 0b001101110,
1269                   (outs QFPRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2),
1270                   "fdmulq $rs1, $rs2, $rd",
1271                   [(set f128:$rd, (fmul (fpextend f64:$rs1),
1272                                          (fpextend f64:$rs2)))]>,
1273                   Requires<[HasHardQuad]>;
1274
1275 // FDIVS generates an erratum on LEON processors, so by disabling this instruction
1276 // this will be promoted to use FDIVD with doubles instead.
1277 def FDIVS  : F3_3<2, 0b110100, 0b001001101,
1278                  (outs FPRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2),
1279                  "fdivs $rs1, $rs2, $rd",
1280                  [(set f32:$rd, (fdiv f32:$rs1, f32:$rs2))],
1281                  IIC_fpu_divs>;
1282 def FDIVD  : F3_3<2, 0b110100, 0b001001110,
1283                  (outs DFPRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2),
1284                  "fdivd $rs1, $rs2, $rd",
1285                  [(set f64:$rd, (fdiv f64:$rs1, f64:$rs2))],
1286                  IIC_fpu_divd>;
1287 def FDIVQ  : F3_3<2, 0b110100, 0b001001111,
1288                  (outs QFPRegs:$rd), (ins QFPRegs:$rs1, QFPRegs:$rs2),
1289                  "fdivq $rs1, $rs2, $rd",
1290                  [(set f128:$rd, (fdiv f128:$rs1, f128:$rs2))]>,
1291                  Requires<[HasHardQuad]>;
1292
1293 // Floating-point Compare Instructions, p. 148
1294 // Note: the 2nd template arg is different for these guys.
1295 // Note 2: the result of a FCMP is not available until the 2nd cycle
1296 // after the instr is retired, but there is no interlock in Sparc V8.
1297 // This behavior is modeled with a forced noop after the instruction in
1298 // DelaySlotFiller.
1299
1300 let Defs = [FCC0], rd = 0, isCodeGenOnly = 1 in {
1301   def FCMPS  : F3_3c<2, 0b110101, 0b001010001,
1302                    (outs), (ins FPRegs:$rs1, FPRegs:$rs2),
1303                    "fcmps $rs1, $rs2",
1304                    [(SPcmpfcc f32:$rs1, f32:$rs2)],
1305                    IIC_fpu_fast_instr>;
1306   def FCMPD  : F3_3c<2, 0b110101, 0b001010010,
1307                    (outs), (ins DFPRegs:$rs1, DFPRegs:$rs2),
1308                    "fcmpd $rs1, $rs2",
1309                    [(SPcmpfcc f64:$rs1, f64:$rs2)],
1310                    IIC_fpu_fast_instr>;
1311   def FCMPQ  : F3_3c<2, 0b110101, 0b001010011,
1312                    (outs), (ins QFPRegs:$rs1, QFPRegs:$rs2),
1313                    "fcmpq $rs1, $rs2",
1314                    [(SPcmpfcc f128:$rs1, f128:$rs2)]>,
1315                    Requires<[HasHardQuad]>;
1316 }
1317
1318 //===----------------------------------------------------------------------===//
1319 // Instructions for Thread Local Storage(TLS).
1320 //===----------------------------------------------------------------------===//
1321 let isAsmParserOnly = 1 in {
1322 def TLS_ADDrr : F3_1<2, 0b000000,
1323                     (outs IntRegs:$rd),
1324                     (ins IntRegs:$rs1, IntRegs:$rs2, TLSSym:$sym),
1325                     "add $rs1, $rs2, $rd, $sym",
1326                     [(set i32:$rd,
1327                         (tlsadd i32:$rs1, i32:$rs2, tglobaltlsaddr:$sym))]>;
1328
1329 let mayLoad = 1 in
1330   def TLS_LDrr : F3_1<3, 0b000000,
1331                       (outs IntRegs:$dst), (ins MEMrr:$addr, TLSSym:$sym),
1332                       "ld [$addr], $dst, $sym",
1333                       [(set i32:$dst,
1334                           (tlsld ADDRrr:$addr, tglobaltlsaddr:$sym))]>;
1335
1336 let Uses = [O6], isCall = 1, hasDelaySlot = 1 in
1337   def TLS_CALL : InstSP<(outs),
1338                         (ins calltarget:$disp, TLSSym:$sym, variable_ops),
1339                         "call $disp, $sym",
1340                         [(tlscall texternalsym:$disp, tglobaltlsaddr:$sym)],
1341                         IIC_jmp_or_call> {
1342   bits<30> disp;
1343   let op = 1;
1344   let Inst{29-0} = disp;
1345 }
1346 }
1347
1348 //===----------------------------------------------------------------------===//
1349 // V9 Instructions
1350 //===----------------------------------------------------------------------===//
1351
1352 // V9 Conditional Moves.
1353 let Predicates = [HasV9], Constraints = "$f = $rd" in {
1354   // Move Integer Register on Condition (MOVcc) p. 194 of the V9 manual.
1355   let Uses = [ICC], intcc = 1, cc = 0b00 in {
1356     def MOVICCrr
1357       : F4_1<0b101100, (outs IntRegs:$rd),
1358              (ins IntRegs:$rs2, IntRegs:$f, CCOp:$cond),
1359              "mov$cond %icc, $rs2, $rd",
1360              [(set i32:$rd, (SPselecticc i32:$rs2, i32:$f, imm:$cond))]>;
1361
1362     def MOVICCri
1363       : F4_2<0b101100, (outs IntRegs:$rd),
1364              (ins i32imm:$simm11, IntRegs:$f, CCOp:$cond),
1365              "mov$cond %icc, $simm11, $rd",
1366              [(set i32:$rd,
1367                     (SPselecticc simm11:$simm11, i32:$f, imm:$cond))]>;
1368   }
1369
1370   let Uses = [FCC0], intcc = 0, cc = 0b00 in {
1371     def MOVFCCrr
1372       : F4_1<0b101100, (outs IntRegs:$rd),
1373              (ins IntRegs:$rs2, IntRegs:$f, CCOp:$cond),
1374              "mov$cond %fcc0, $rs2, $rd",
1375              [(set i32:$rd, (SPselectfcc i32:$rs2, i32:$f, imm:$cond))]>;
1376     def MOVFCCri
1377       : F4_2<0b101100, (outs IntRegs:$rd),
1378              (ins i32imm:$simm11, IntRegs:$f, CCOp:$cond),
1379              "mov$cond %fcc0, $simm11, $rd",
1380              [(set i32:$rd,
1381                     (SPselectfcc simm11:$simm11, i32:$f, imm:$cond))]>;
1382   }
1383
1384   let Uses = [ICC], intcc = 1, opf_cc = 0b00 in {
1385     def FMOVS_ICC
1386       : F4_3<0b110101, 0b000001, (outs FPRegs:$rd),
1387              (ins FPRegs:$rs2, FPRegs:$f, CCOp:$cond),
1388              "fmovs$cond %icc, $rs2, $rd",
1389              [(set f32:$rd, (SPselecticc f32:$rs2, f32:$f, imm:$cond))]>;
1390     def FMOVD_ICC
1391       : F4_3<0b110101, 0b000010, (outs DFPRegs:$rd),
1392                (ins DFPRegs:$rs2, DFPRegs:$f, CCOp:$cond),
1393                "fmovd$cond %icc, $rs2, $rd",
1394                [(set f64:$rd, (SPselecticc f64:$rs2, f64:$f, imm:$cond))]>;
1395     def FMOVQ_ICC
1396       : F4_3<0b110101, 0b000011, (outs QFPRegs:$rd),
1397                (ins QFPRegs:$rs2, QFPRegs:$f, CCOp:$cond),
1398                "fmovq$cond %icc, $rs2, $rd",
1399                [(set f128:$rd, (SPselecticc f128:$rs2, f128:$f, imm:$cond))]>,
1400                Requires<[HasHardQuad]>;
1401   }
1402
1403   let Uses = [FCC0], intcc = 0, opf_cc = 0b00 in {
1404     def FMOVS_FCC
1405       : F4_3<0b110101, 0b000001, (outs FPRegs:$rd),
1406              (ins FPRegs:$rs2, FPRegs:$f, CCOp:$cond),
1407              "fmovs$cond %fcc0, $rs2, $rd",
1408              [(set f32:$rd, (SPselectfcc f32:$rs2, f32:$f, imm:$cond))]>;
1409     def FMOVD_FCC
1410       : F4_3<0b110101, 0b000010, (outs DFPRegs:$rd),
1411              (ins DFPRegs:$rs2, DFPRegs:$f, CCOp:$cond),
1412              "fmovd$cond %fcc0, $rs2, $rd",
1413              [(set f64:$rd, (SPselectfcc f64:$rs2, f64:$f, imm:$cond))]>;
1414     def FMOVQ_FCC
1415       : F4_3<0b110101, 0b000011, (outs QFPRegs:$rd),
1416              (ins QFPRegs:$rs2, QFPRegs:$f, CCOp:$cond),
1417              "fmovq$cond %fcc0, $rs2, $rd",
1418              [(set f128:$rd, (SPselectfcc f128:$rs2, f128:$f, imm:$cond))]>,
1419              Requires<[HasHardQuad]>;
1420   }
1421
1422 }
1423
1424 // Floating-Point Move Instructions, p. 164 of the V9 manual.
1425 let Predicates = [HasV9] in {
1426   def FMOVD : F3_3u<2, 0b110100, 0b000000010,
1427                    (outs DFPRegs:$rd), (ins DFPRegs:$rs2),
1428                    "fmovd $rs2, $rd", []>;
1429   def FMOVQ : F3_3u<2, 0b110100, 0b000000011,
1430                    (outs QFPRegs:$rd), (ins QFPRegs:$rs2),
1431                    "fmovq $rs2, $rd", []>,
1432                    Requires<[HasHardQuad]>;
1433   def FNEGD : F3_3u<2, 0b110100, 0b000000110,
1434                    (outs DFPRegs:$rd), (ins DFPRegs:$rs2),
1435                    "fnegd $rs2, $rd",
1436                    [(set f64:$rd, (fneg f64:$rs2))]>;
1437   def FNEGQ : F3_3u<2, 0b110100, 0b000000111,
1438                    (outs QFPRegs:$rd), (ins QFPRegs:$rs2),
1439                    "fnegq $rs2, $rd",
1440                    [(set f128:$rd, (fneg f128:$rs2))]>,
1441                    Requires<[HasHardQuad]>;
1442   def FABSD : F3_3u<2, 0b110100, 0b000001010,
1443                    (outs DFPRegs:$rd), (ins DFPRegs:$rs2),
1444                    "fabsd $rs2, $rd",
1445                    [(set f64:$rd, (fabs f64:$rs2))]>;
1446   def FABSQ : F3_3u<2, 0b110100, 0b000001011,
1447                    (outs QFPRegs:$rd), (ins QFPRegs:$rs2),
1448                    "fabsq $rs2, $rd",
1449                    [(set f128:$rd, (fabs f128:$rs2))]>,
1450                    Requires<[HasHardQuad]>;
1451 }
1452
1453 // Floating-point compare instruction with %fcc0-%fcc3.
1454 def V9FCMPS  : F3_3c<2, 0b110101, 0b001010001,
1455                (outs FCCRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2),
1456                "fcmps $rd, $rs1, $rs2", []>;
1457 def V9FCMPD  : F3_3c<2, 0b110101, 0b001010010,
1458                 (outs FCCRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2),
1459                 "fcmpd $rd, $rs1, $rs2", []>;
1460 def V9FCMPQ  : F3_3c<2, 0b110101, 0b001010011,
1461                 (outs FCCRegs:$rd), (ins QFPRegs:$rs1, QFPRegs:$rs2),
1462                 "fcmpq $rd, $rs1, $rs2", []>,
1463                  Requires<[HasHardQuad]>;
1464
1465 let hasSideEffects = 1 in {
1466   def V9FCMPES  : F3_3c<2, 0b110101, 0b001010101,
1467                    (outs FCCRegs:$rd), (ins FPRegs:$rs1, FPRegs:$rs2),
1468                    "fcmpes $rd, $rs1, $rs2", []>;
1469   def V9FCMPED  : F3_3c<2, 0b110101, 0b001010110,
1470                    (outs FCCRegs:$rd), (ins DFPRegs:$rs1, DFPRegs:$rs2),
1471                    "fcmped $rd, $rs1, $rs2", []>;
1472   def V9FCMPEQ  : F3_3c<2, 0b110101, 0b001010111,
1473                    (outs FCCRegs:$rd), (ins QFPRegs:$rs1, QFPRegs:$rs2),
1474                    "fcmpeq $rd, $rs1, $rs2", []>,
1475                    Requires<[HasHardQuad]>;
1476 }
1477
1478 // Floating point conditional move instrucitons with %fcc0-%fcc3.
1479 let Predicates = [HasV9] in {
1480   let Constraints = "$f = $rd", intcc = 0 in {
1481     def V9MOVFCCrr
1482       : F4_1<0b101100, (outs IntRegs:$rd),
1483              (ins FCCRegs:$cc, IntRegs:$rs2, IntRegs:$f, CCOp:$cond),
1484              "mov$cond $cc, $rs2, $rd", []>;
1485     def V9MOVFCCri
1486       : F4_2<0b101100, (outs IntRegs:$rd),
1487              (ins FCCRegs:$cc, i32imm:$simm11, IntRegs:$f, CCOp:$cond),
1488              "mov$cond $cc, $simm11, $rd", []>;
1489     def V9FMOVS_FCC
1490       : F4_3<0b110101, 0b000001, (outs FPRegs:$rd),
1491              (ins FCCRegs:$opf_cc, FPRegs:$rs2, FPRegs:$f, CCOp:$cond),
1492              "fmovs$cond $opf_cc, $rs2, $rd", []>;
1493     def V9FMOVD_FCC
1494       : F4_3<0b110101, 0b000010, (outs DFPRegs:$rd),
1495              (ins FCCRegs:$opf_cc, DFPRegs:$rs2, DFPRegs:$f, CCOp:$cond),
1496              "fmovd$cond $opf_cc, $rs2, $rd", []>;
1497     def V9FMOVQ_FCC
1498       : F4_3<0b110101, 0b000011, (outs QFPRegs:$rd),
1499              (ins FCCRegs:$opf_cc, QFPRegs:$rs2, QFPRegs:$f, CCOp:$cond),
1500              "fmovq$cond $opf_cc, $rs2, $rd", []>,
1501              Requires<[HasHardQuad]>;
1502   } // Constraints = "$f = $rd", ...
1503 } // let Predicates = [hasV9]
1504
1505
1506 // POPCrr - This does a ctpop of a 64-bit register.  As such, we have to clear
1507 // the top 32-bits before using it.  To do this clearing, we use a SRLri X,0.
1508 let rs1 = 0 in
1509   def POPCrr : F3_1<2, 0b101110,
1510                     (outs IntRegs:$rd), (ins IntRegs:$rs2),
1511                     "popc $rs2, $rd", []>, Requires<[HasV9]>;
1512 def : Pat<(ctpop i32:$src),
1513           (POPCrr (SRLri $src, 0))>;
1514
1515 let Predicates = [HasV9], hasSideEffects = 1, rd = 0, rs1 = 0b01111 in
1516  def MEMBARi : F3_2<2, 0b101000, (outs), (ins MembarTag:$simm13),
1517                     "membar $simm13", []>;
1518
1519 // The CAS instruction, unlike other instructions, only comes in a 
1520 // form which requires an ASI be provided. The ASI value hardcoded 
1521 // here is ASI_PRIMARY, the default unprivileged ASI for SparcV9.
1522 let Predicates = [HasV9], Constraints = "$swap = $rd", asi = 0b10000000 in
1523   def CASrr: F3_1_asi<3, 0b111100,
1524                 (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2,
1525                                      IntRegs:$swap),
1526                  "cas [$rs1], $rs2, $rd",
1527                  [(set i32:$rd,
1528                      (atomic_cmp_swap_32 iPTR:$rs1, i32:$rs2, i32:$swap))]>;
1529
1530
1531 // CASA is supported as an instruction on some LEON3 and all LEON4 processors.
1532 // This version can be automatically lowered from C code, selecting ASI 10
1533 let Predicates = [HasLeonCASA], Constraints = "$swap = $rd", asi = 0b00001010 in
1534   def CASAasi10: F3_1_asi<3, 0b111100,
1535                 (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2,
1536                                      IntRegs:$swap),
1537                  "casa [$rs1] 10, $rs2, $rd",
1538                  [(set i32:$rd,
1539                      (atomic_cmp_swap_32 iPTR:$rs1, i32:$rs2, i32:$swap))]>;
1540                  
1541 // CASA supported on some LEON3 and all LEON4 processors. Same pattern as
1542 // CASrr, above, but with a different ASI. This version is supported for
1543 // inline assembly lowering only. 
1544 let Predicates = [HasLeonCASA], Constraints = "$swap = $rd" in
1545   def CASArr: F3_1_asi<3, 0b111100,
1546                 (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2,
1547                                      IntRegs:$swap, i8imm:$asi),
1548                  "casa [$rs1] $asi, $rs2, $rd", []>;
1549                 
1550 // TODO: Add DAG sequence to lower these instructions. Currently, only provided
1551 // as inline assembler-supported instructions. 
1552 let Predicates = [HasUMAC_SMAC], Defs = [Y, ASR18], Uses = [Y, ASR18] in {
1553   def SMACrr :  F3_1<2, 0b111111,
1554                    (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2, ASRRegs:$asr18),
1555                    "smac $rs1, $rs2, $rd",
1556                    [], IIC_smac_umac>;
1557
1558   def SMACri :  F3_2<2, 0b111111,
1559                   (outs IntRegs:$rd), (ins IntRegs:$rs1, simm13Op:$simm13, ASRRegs:$asr18),
1560                    "smac $rs1, $simm13, $rd",
1561                    [], IIC_smac_umac>;
1562                  
1563   def UMACrr :  F3_1<2, 0b111110,
1564                   (outs IntRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2, ASRRegs:$asr18),
1565                    "umac $rs1, $rs2, $rd",
1566                    [], IIC_smac_umac>;
1567                  
1568   def UMACri :  F3_2<2, 0b111110,
1569                   (outs IntRegs:$rd), (ins IntRegs:$rs1, simm13Op:$simm13, ASRRegs:$asr18),
1570                    "umac $rs1, $simm13, $rd",
1571                    [], IIC_smac_umac>;
1572 }
1573
1574 // The partial write WRPSR instruction has a non-zero destination
1575 // register value to separate it from the standard instruction.
1576 let Predicates = [HasPWRPSR], Defs = [PSR], rd=1 in {
1577   def PWRPSRrr : F3_1<2, 0b110001,
1578      (outs), (ins IntRegs:$rs1, IntRegs:$rs2),
1579      "pwr $rs1, $rs2, %psr", []>;
1580   def PWRPSRri : F3_2<2, 0b110001,
1581      (outs), (ins IntRegs:$rs1, simm13Op:$simm13),
1582      "pwr $rs1, $simm13, %psr", []>;
1583 }
1584
1585 let Defs = [ICC] in {
1586 defm TADDCC   : F3_12np<"taddcc",   0b100000>;
1587 defm TSUBCC   : F3_12np<"tsubcc",   0b100001>;
1588
1589 let hasSideEffects = 1 in {
1590   defm TADDCCTV : F3_12np<"taddcctv", 0b100010>;
1591   defm TSUBCCTV : F3_12np<"tsubcctv", 0b100011>;
1592 }
1593 }
1594
1595
1596 // Section A.43 - Read Privileged Register Instructions
1597 let Predicates = [HasV9] in {
1598 let rs2 = 0 in
1599   def RDPR : F3_1<2, 0b101010,
1600                  (outs IntRegs:$rd), (ins PRRegs:$rs1),
1601                  "rdpr $rs1, $rd", []>;
1602 }
1603
1604 // Section A.62 - Write Privileged Register Instructions
1605 let Predicates = [HasV9] in {
1606   def WRPRrr : F3_1<2, 0b110010,
1607                    (outs PRRegs:$rd), (ins IntRegs:$rs1, IntRegs:$rs2),
1608                    "wrpr $rs1, $rs2, $rd", []>;
1609   def WRPRri : F3_2<2, 0b110010,
1610                    (outs PRRegs:$rd), (ins IntRegs:$rs1, simm13Op:$simm13),
1611                    "wrpr $rs1, $simm13, $rd", []>;
1612 }
1613
1614 //===----------------------------------------------------------------------===//
1615 // Non-Instruction Patterns
1616 //===----------------------------------------------------------------------===//
1617
1618 // Zero immediate.
1619 def : Pat<(i32 0),
1620           (ORrr (i32 G0), (i32 G0))>;
1621 // Small immediates.
1622 def : Pat<(i32 simm13:$val),
1623           (ORri (i32 G0), imm:$val)>;
1624 // Arbitrary immediates.
1625 def : Pat<(i32 imm:$val),
1626           (ORri (SETHIi (HI22 imm:$val)), (LO10 imm:$val))>;
1627
1628
1629 // Global addresses, constant pool entries
1630 let Predicates = [Is32Bit] in {
1631
1632 def : Pat<(SPhi tglobaladdr:$in), (SETHIi tglobaladdr:$in)>;
1633 def : Pat<(SPlo tglobaladdr:$in), (ORri (i32 G0), tglobaladdr:$in)>;
1634 def : Pat<(SPhi tconstpool:$in), (SETHIi tconstpool:$in)>;
1635 def : Pat<(SPlo tconstpool:$in), (ORri (i32 G0), tconstpool:$in)>;
1636
1637 // GlobalTLS addresses
1638 def : Pat<(SPhi tglobaltlsaddr:$in), (SETHIi tglobaltlsaddr:$in)>;
1639 def : Pat<(SPlo tglobaltlsaddr:$in), (ORri (i32 G0), tglobaltlsaddr:$in)>;
1640 def : Pat<(add (SPhi tglobaltlsaddr:$in1), (SPlo tglobaltlsaddr:$in2)),
1641           (ADDri (SETHIi tglobaltlsaddr:$in1), (tglobaltlsaddr:$in2))>;
1642 def : Pat<(xor (SPhi tglobaltlsaddr:$in1), (SPlo tglobaltlsaddr:$in2)),
1643           (XORri (SETHIi tglobaltlsaddr:$in1), (tglobaltlsaddr:$in2))>;
1644
1645 // Blockaddress
1646 def : Pat<(SPhi tblockaddress:$in), (SETHIi tblockaddress:$in)>;
1647 def : Pat<(SPlo tblockaddress:$in), (ORri (i32 G0), tblockaddress:$in)>;
1648
1649 // Add reg, lo.  This is used when taking the addr of a global/constpool entry.
1650 def : Pat<(add iPTR:$r, (SPlo tglobaladdr:$in)), (ADDri $r, tglobaladdr:$in)>;
1651 def : Pat<(add iPTR:$r, (SPlo tconstpool:$in)),  (ADDri $r, tconstpool:$in)>;
1652 def : Pat<(add iPTR:$r, (SPlo tblockaddress:$in)),
1653                         (ADDri $r, tblockaddress:$in)>;
1654 }
1655
1656 // Calls:
1657 def : Pat<(call tglobaladdr:$dst),
1658           (CALL tglobaladdr:$dst)>;
1659 def : Pat<(call texternalsym:$dst),
1660           (CALL texternalsym:$dst)>;
1661
1662 // Map integer extload's to zextloads.
1663 def : Pat<(i32 (extloadi1 ADDRrr:$src)), (LDUBrr ADDRrr:$src)>;
1664 def : Pat<(i32 (extloadi1 ADDRri:$src)), (LDUBri ADDRri:$src)>;
1665 def : Pat<(i32 (extloadi8 ADDRrr:$src)), (LDUBrr ADDRrr:$src)>;
1666 def : Pat<(i32 (extloadi8 ADDRri:$src)), (LDUBri ADDRri:$src)>;
1667 def : Pat<(i32 (extloadi16 ADDRrr:$src)), (LDUHrr ADDRrr:$src)>;
1668 def : Pat<(i32 (extloadi16 ADDRri:$src)), (LDUHri ADDRri:$src)>;
1669
1670 // zextload bool -> zextload byte
1671 def : Pat<(i32 (zextloadi1 ADDRrr:$src)), (LDUBrr ADDRrr:$src)>;
1672 def : Pat<(i32 (zextloadi1 ADDRri:$src)), (LDUBri ADDRri:$src)>;
1673
1674 // store 0, addr -> store %g0, addr
1675 def : Pat<(store (i32 0), ADDRrr:$dst), (STrr ADDRrr:$dst, (i32 G0))>;
1676 def : Pat<(store (i32 0), ADDRri:$dst), (STri ADDRri:$dst, (i32 G0))>;
1677
1678 // store bar for all atomic_fence in V8.
1679 let Predicates = [HasNoV9] in
1680   def : Pat<(atomic_fence imm, imm), (STBAR)>;
1681
1682 // atomic_load addr -> load addr
1683 def : Pat<(i32 (atomic_load_8 ADDRrr:$src)), (LDUBrr ADDRrr:$src)>;
1684 def : Pat<(i32 (atomic_load_8 ADDRri:$src)), (LDUBri ADDRri:$src)>;
1685 def : Pat<(i32 (atomic_load_16 ADDRrr:$src)), (LDUHrr ADDRrr:$src)>;
1686 def : Pat<(i32 (atomic_load_16 ADDRri:$src)), (LDUHri ADDRri:$src)>;
1687 def : Pat<(i32 (atomic_load_32 ADDRrr:$src)), (LDrr ADDRrr:$src)>;
1688 def : Pat<(i32 (atomic_load_32 ADDRri:$src)), (LDri ADDRri:$src)>;
1689
1690 // atomic_store val, addr -> store val, addr
1691 def : Pat<(atomic_store_8 ADDRrr:$dst, i32:$val), (STBrr ADDRrr:$dst, $val)>;
1692 def : Pat<(atomic_store_8 ADDRri:$dst, i32:$val), (STBri ADDRri:$dst, $val)>;
1693 def : Pat<(atomic_store_16 ADDRrr:$dst, i32:$val), (STHrr ADDRrr:$dst, $val)>;
1694 def : Pat<(atomic_store_16 ADDRri:$dst, i32:$val), (STHri ADDRri:$dst, $val)>;
1695 def : Pat<(atomic_store_32 ADDRrr:$dst, i32:$val), (STrr ADDRrr:$dst, $val)>;
1696 def : Pat<(atomic_store_32 ADDRri:$dst, i32:$val), (STri ADDRri:$dst, $val)>;
1697
1698 // extract_vector
1699 def : Pat<(extractelt (v2i32 IntPair:$Rn), 0),
1700           (i32 (EXTRACT_SUBREG IntPair:$Rn, sub_even))>;
1701 def : Pat<(extractelt (v2i32 IntPair:$Rn), 1),
1702           (i32 (EXTRACT_SUBREG IntPair:$Rn, sub_odd))>;
1703
1704 // build_vector
1705 def : Pat<(build_vector (i32 IntRegs:$a1), (i32 IntRegs:$a2)),
1706           (INSERT_SUBREG
1707             (INSERT_SUBREG (v2i32 (IMPLICIT_DEF)), (i32 IntRegs:$a1), sub_even),
1708             (i32 IntRegs:$a2), sub_odd)>;
1709
1710
1711 include "SparcInstr64Bit.td"
1712 include "SparcInstrVIS.td"
1713 include "SparcInstrAliases.td"