1 //=- HexagonInstrInfoV4.td - Target Desc. for Hexagon Target -*- tablegen -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the Hexagon V4 instructions in TableGen format.
12 //===----------------------------------------------------------------------===//
14 let neverHasSideEffects = 1 in
15 def IMMEXT : Immext<(outs), (ins),
20 // Hexagon V4 Architecture spec defines 8 instruction classes:
21 // LD ST ALU32 XTYPE J JR MEMOP NV CR SYSTEM(system is not implemented in the
25 // ========================================
26 // Loads (8/16/32/64 bit)
30 // ========================================
31 // Stores (8/16/32/64 bit)
34 // ALU32 Instructions:
35 // ========================================
36 // Arithmetic / Logical (32 bit)
39 // XTYPE Instructions (32/64 bit):
40 // ========================================
41 // Arithmetic, Logical, Bit Manipulation
42 // Multiply (Integer, Fractional, Complex)
43 // Permute / Vector Permute Operations
44 // Predicate Operations
45 // Shift / Shift with Add/Sub/Logical
47 // Vector Halfword (ALU, Shift, Multiply)
48 // Vector Word (ALU, Shift)
51 // ========================================
52 // Jump/Call PC-relative
55 // ========================================
58 // MEMOP Instructions:
59 // ========================================
60 // Operation on memory (8/16/32 bit)
63 // ========================================
68 // ========================================
69 // Control-Register Transfers
70 // Hardware Loop Setup
71 // Predicate Logicals & Reductions
73 // SYSTEM Instructions (not implemented in the compiler):
74 // ========================================
80 //===----------------------------------------------------------------------===//
82 //===----------------------------------------------------------------------===//
86 let isPredicated = 1 in
87 def ASLH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
88 (ins PredRegs:$src1, IntRegs:$src2),
89 "if ($src1) $dst = aslh($src2)",
93 let isPredicated = 1 in
94 def ASLH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
95 (ins PredRegs:$src1, IntRegs:$src2),
96 "if (!$src1) $dst = aslh($src2)",
100 let isPredicated = 1 in
101 def ASLH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
102 (ins PredRegs:$src1, IntRegs:$src2),
103 "if ($src1.new) $dst = aslh($src2)",
107 let isPredicated = 1 in
108 def ASLH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
109 (ins PredRegs:$src1, IntRegs:$src2),
110 "if (!$src1.new) $dst = aslh($src2)",
114 let isPredicated = 1 in
115 def ASRH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
116 (ins PredRegs:$src1, IntRegs:$src2),
117 "if ($src1) $dst = asrh($src2)",
121 let isPredicated = 1 in
122 def ASRH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
123 (ins PredRegs:$src1, IntRegs:$src2),
124 "if (!$src1) $dst = asrh($src2)",
128 let isPredicated = 1 in
129 def ASRH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
130 (ins PredRegs:$src1, IntRegs:$src2),
131 "if ($src1.new) $dst = asrh($src2)",
135 let isPredicated = 1 in
136 def ASRH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
137 (ins PredRegs:$src1, IntRegs:$src2),
138 "if (!$src1.new) $dst = asrh($src2)",
144 let isPredicated = 1 in
145 def SXTB_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
146 (ins PredRegs:$src1, IntRegs:$src2),
147 "if ($src1) $dst = sxtb($src2)",
151 let isPredicated = 1 in
152 def SXTB_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
153 (ins PredRegs:$src1, IntRegs:$src2),
154 "if (!$src1) $dst = sxtb($src2)",
158 let isPredicated = 1 in
159 def SXTB_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
160 (ins PredRegs:$src1, IntRegs:$src2),
161 "if ($src1.new) $dst = sxtb($src2)",
165 let isPredicated = 1 in
166 def SXTB_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
167 (ins PredRegs:$src1, IntRegs:$src2),
168 "if (!$src1.new) $dst = sxtb($src2)",
173 let isPredicated = 1 in
174 def SXTH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
175 (ins PredRegs:$src1, IntRegs:$src2),
176 "if ($src1) $dst = sxth($src2)",
180 let isPredicated = 1 in
181 def SXTH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
182 (ins PredRegs:$src1, IntRegs:$src2),
183 "if (!$src1) $dst = sxth($src2)",
187 let isPredicated = 1 in
188 def SXTH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
189 (ins PredRegs:$src1, IntRegs:$src2),
190 "if ($src1.new) $dst = sxth($src2)",
194 let isPredicated = 1 in
195 def SXTH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
196 (ins PredRegs:$src1, IntRegs:$src2),
197 "if (!$src1.new) $dst = sxth($src2)",
203 let neverHasSideEffects = 1, isPredicated = 1 in
204 def ZXTB_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
205 (ins PredRegs:$src1, IntRegs:$src2),
206 "if ($src1) $dst = zxtb($src2)",
210 let neverHasSideEffects = 1, isPredicated = 1 in
211 def ZXTB_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
212 (ins PredRegs:$src1, IntRegs:$src2),
213 "if (!$src1) $dst = zxtb($src2)",
217 let neverHasSideEffects = 1, isPredicated = 1 in
218 def ZXTB_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
219 (ins PredRegs:$src1, IntRegs:$src2),
220 "if ($src1.new) $dst = zxtb($src2)",
224 let neverHasSideEffects = 1, isPredicated = 1 in
225 def ZXTB_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
226 (ins PredRegs:$src1, IntRegs:$src2),
227 "if (!$src1.new) $dst = zxtb($src2)",
231 let neverHasSideEffects = 1, isPredicated = 1 in
232 def ZXTH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
233 (ins PredRegs:$src1, IntRegs:$src2),
234 "if ($src1) $dst = zxth($src2)",
238 let neverHasSideEffects = 1, isPredicated = 1 in
239 def ZXTH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
240 (ins PredRegs:$src1, IntRegs:$src2),
241 "if (!$src1) $dst = zxth($src2)",
245 let neverHasSideEffects = 1, isPredicated = 1 in
246 def ZXTH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
247 (ins PredRegs:$src1, IntRegs:$src2),
248 "if ($src1.new) $dst = zxth($src2)",
252 let neverHasSideEffects = 1, isPredicated = 1 in
253 def ZXTH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
254 (ins PredRegs:$src1, IntRegs:$src2),
255 "if (!$src1.new) $dst = zxth($src2)",
259 // Generate frame index addresses.
260 let neverHasSideEffects = 1, isReMaterializable = 1 in
261 def TFR_FI_immext_V4 : ALU32_ri<(outs IntRegs:$dst),
262 (ins IntRegs:$src1, s32Imm:$offset),
263 "$dst = add($src1, ##$offset)",
268 //===----------------------------------------------------------------------===//
270 //===----------------------------------------------------------------------===//
273 //===----------------------------------------------------------------------===//
275 //===----------------------------------------------------------------------===//
278 // Rdd=combine(Rs, #s8)
279 let isExtendable = 1, opExtendable = 2, isExtentSigned = 1, opExtentBits = 8,
280 neverHasSideEffects = 1, validSubTargets = HasV4SubT in
281 def COMBINE_rI_V4 : ALU32_ri<(outs DoubleRegs:$dst),
282 (ins IntRegs:$src1, s8Ext:$src2),
283 "$dst = combine($src1, #$src2)",
287 // Rdd=combine(#s8, Rs)
288 let isExtendable = 1, opExtendable = 1, isExtentSigned = 1, opExtentBits = 8,
289 neverHasSideEffects = 1, validSubTargets = HasV4SubT in
290 def COMBINE_Ir_V4 : ALU32_ir<(outs DoubleRegs:$dst),
291 (ins s8Ext:$src1, IntRegs:$src2),
292 "$dst = combine(#$src1, $src2)",
296 let isExtendable = 1, opExtendable = 2, isExtentSigned = 0, opExtentBits = 6,
297 neverHasSideEffects = 1, validSubTargets = HasV4SubT in
298 def COMBINE_iI_V4 : ALU32_ii<(outs DoubleRegs:$dst),
299 (ins s8Imm:$src1, u6Ext:$src2),
300 "$dst = combine(#$src1, #$src2)",
304 //===----------------------------------------------------------------------===//
306 //===----------------------------------------------------------------------===//
308 //===----------------------------------------------------------------------===//
310 //===----------------------------------------------------------------------===//
312 // These absolute set addressing mode instructions accept immediate as
313 // an operand. We have duplicated these patterns to take global address.
315 let neverHasSideEffects = 1 in
316 def LDrid_abs_setimm_V4 : LDInst2<(outs DoubleRegs:$dst1, IntRegs:$dst2),
318 "$dst1 = memd($dst2=#$addr)",
323 let neverHasSideEffects = 1 in
324 def LDrib_abs_setimm_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
326 "$dst1 = memb($dst2=#$addr)",
331 let neverHasSideEffects = 1 in
332 def LDrih_abs_setimm_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
334 "$dst1 = memh($dst2=#$addr)",
339 let neverHasSideEffects = 1 in
340 def LDriub_abs_setimm_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
342 "$dst1 = memub($dst2=#$addr)",
347 let neverHasSideEffects = 1 in
348 def LDriuh_abs_setimm_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
350 "$dst1 = memuh($dst2=#$addr)",
355 let neverHasSideEffects = 1 in
356 def LDriw_abs_setimm_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
358 "$dst1 = memw($dst2=#$addr)",
362 // Following patterns are defined for absolute set addressing mode
363 // instruction which take global address as operand.
364 let neverHasSideEffects = 1 in
365 def LDrid_abs_set_V4 : LDInst2<(outs DoubleRegs:$dst1, IntRegs:$dst2),
366 (ins globaladdress:$addr),
367 "$dst1 = memd($dst2=##$addr)",
372 let neverHasSideEffects = 1 in
373 def LDrib_abs_set_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
374 (ins globaladdress:$addr),
375 "$dst1 = memb($dst2=##$addr)",
380 let neverHasSideEffects = 1 in
381 def LDrih_abs_set_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
382 (ins globaladdress:$addr),
383 "$dst1 = memh($dst2=##$addr)",
388 let neverHasSideEffects = 1 in
389 def LDriub_abs_set_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
390 (ins globaladdress:$addr),
391 "$dst1 = memub($dst2=##$addr)",
396 let neverHasSideEffects = 1 in
397 def LDriuh_abs_set_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
398 (ins globaladdress:$addr),
399 "$dst1 = memuh($dst2=##$addr)",
404 let neverHasSideEffects = 1 in
405 def LDriw_abs_set_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
406 (ins globaladdress:$addr),
407 "$dst1 = memw($dst2=##$addr)",
413 // Make sure that in post increment load, the first operand is always the post
414 // increment operand.
416 // Rdd=memd(Rs+Rt<<#u2)
417 // Special case pattern for indexed load without offset which is easier to
418 // match. AddedComplexity of this pattern should be lower than base+offset load
419 // and lower yet than the more generic version with offset/shift below
420 // Similar approach is taken for all other base+index loads.
421 let AddedComplexity = 10, isPredicable = 1 in
422 def LDrid_indexed_V4 : LDInst<(outs DoubleRegs:$dst),
423 (ins IntRegs:$src1, IntRegs:$src2),
424 "$dst=memd($src1+$src2<<#0)",
425 [(set (i64 DoubleRegs:$dst),
426 (i64 (load (add (i32 IntRegs:$src1),
427 (i32 IntRegs:$src2)))))]>,
430 // multiclass for load instructions with base + register offset
432 multiclass ld_idxd_shl_pbase<string mnemonic, RegisterClass RC, bit isNot,
434 let PNewValue = #!if(isPredNew, "new", "") in
435 def #NAME# : LDInst2<(outs RC:$dst),
436 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, u2Imm:$offset),
437 !if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
438 ") ")#"$dst = "#mnemonic#"($src2+$src3<<#$offset)",
439 []>, Requires<[HasV4T]>;
442 multiclass ld_idxd_shl_pred<string mnemonic, RegisterClass RC, bit PredNot> {
443 let PredSense = #!if(PredNot, "false", "true") in {
444 defm _c#NAME# : ld_idxd_shl_pbase<mnemonic, RC, PredNot, 0>;
446 defm _cdn#NAME# : ld_idxd_shl_pbase<mnemonic, RC, PredNot, 1>;
450 let neverHasSideEffects = 1 in
451 multiclass ld_idxd_shl<string mnemonic, string CextOp, RegisterClass RC> {
452 let CextOpcode = CextOp, BaseOpcode = CextOp#_indexed_shl in {
453 let isPredicable = 1 in
454 def #NAME#_V4 : LDInst2<(outs RC:$dst),
455 (ins IntRegs:$src1, IntRegs:$src2, u2Imm:$offset),
456 "$dst = "#mnemonic#"($src1+$src2<<#$offset)",
457 []>, Requires<[HasV4T]>;
459 let isPredicated = 1 in {
460 defm Pt_V4 : ld_idxd_shl_pred<mnemonic, RC, 0 >;
461 defm NotPt_V4 : ld_idxd_shl_pred<mnemonic, RC, 1>;
466 let addrMode = BaseRegOffset in {
467 defm LDrib_indexed_shl: ld_idxd_shl<"memb", "LDrib", IntRegs>, AddrModeRel;
468 defm LDriub_indexed_shl: ld_idxd_shl<"memub", "LDriub", IntRegs>, AddrModeRel;
469 defm LDrih_indexed_shl: ld_idxd_shl<"memh", "LDrih", IntRegs>, AddrModeRel;
470 defm LDriuh_indexed_shl: ld_idxd_shl<"memuh", "LDriuh", IntRegs>, AddrModeRel;
471 defm LDriw_indexed_shl: ld_idxd_shl<"memw", "LDriw", IntRegs>, AddrModeRel;
472 defm LDrid_indexed_shl: ld_idxd_shl<"memd", "LDrid", DoubleRegs>, AddrModeRel;
475 // 'def pats' for load instructions with base + register offset and non-zero
476 // immediate value. Immediate value is used to left-shift the second
478 let AddedComplexity = 40 in {
479 def : Pat <(i32 (sextloadi8 (add IntRegs:$src1,
480 (shl IntRegs:$src2, u2ImmPred:$offset)))),
481 (LDrib_indexed_shl_V4 IntRegs:$src1,
482 IntRegs:$src2, u2ImmPred:$offset)>,
485 def : Pat <(i32 (zextloadi8 (add IntRegs:$src1,
486 (shl IntRegs:$src2, u2ImmPred:$offset)))),
487 (LDriub_indexed_shl_V4 IntRegs:$src1,
488 IntRegs:$src2, u2ImmPred:$offset)>,
491 def : Pat <(i32 (extloadi8 (add IntRegs:$src1,
492 (shl IntRegs:$src2, u2ImmPred:$offset)))),
493 (LDriub_indexed_shl_V4 IntRegs:$src1,
494 IntRegs:$src2, u2ImmPred:$offset)>,
497 def : Pat <(i32 (sextloadi16 (add IntRegs:$src1,
498 (shl IntRegs:$src2, u2ImmPred:$offset)))),
499 (LDrih_indexed_shl_V4 IntRegs:$src1,
500 IntRegs:$src2, u2ImmPred:$offset)>,
503 def : Pat <(i32 (zextloadi16 (add IntRegs:$src1,
504 (shl IntRegs:$src2, u2ImmPred:$offset)))),
505 (LDriuh_indexed_shl_V4 IntRegs:$src1,
506 IntRegs:$src2, u2ImmPred:$offset)>,
509 def : Pat <(i32 (extloadi16 (add IntRegs:$src1,
510 (shl IntRegs:$src2, u2ImmPred:$offset)))),
511 (LDriuh_indexed_shl_V4 IntRegs:$src1,
512 IntRegs:$src2, u2ImmPred:$offset)>,
515 def : Pat <(i32 (load (add IntRegs:$src1,
516 (shl IntRegs:$src2, u2ImmPred:$offset)))),
517 (LDriw_indexed_shl_V4 IntRegs:$src1,
518 IntRegs:$src2, u2ImmPred:$offset)>,
521 def : Pat <(i64 (load (add IntRegs:$src1,
522 (shl IntRegs:$src2, u2ImmPred:$offset)))),
523 (LDrid_indexed_shl_V4 IntRegs:$src1,
524 IntRegs:$src2, u2ImmPred:$offset)>,
528 //// Load doubleword conditionally.
529 // if ([!]Pv[.new]) Rd=memd(Rs+Rt<<#u2)
530 // if (Pv) Rd=memd(Rs+Rt<<#u2)
531 let AddedComplexity = 15, isPredicated = 1 in
532 def LDrid_indexed_cPt_V4 : LDInst2<(outs DoubleRegs:$dst),
533 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
534 "if ($src1) $dst=memd($src2+$src3<<#0)",
538 // if (Pv.new) Rd=memd(Rs+Rt<<#u2)
539 let AddedComplexity = 15, isPredicated = 1 in
540 def LDrid_indexed_cdnPt_V4 : LDInst2<(outs DoubleRegs:$dst),
541 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
542 "if ($src1.new) $dst=memd($src2+$src3<<#0)",
546 // if (!Pv) Rd=memd(Rs+Rt<<#u2)
547 let AddedComplexity = 15, isPredicated = 1 in
548 def LDrid_indexed_cNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
549 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
550 "if (!$src1) $dst=memd($src2+$src3<<#0)",
554 // if (!Pv.new) Rd=memd(Rs+Rt<<#u2)
555 let AddedComplexity = 15, isPredicated = 1 in
556 def LDrid_indexed_cdnNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
557 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
558 "if (!$src1.new) $dst=memd($src2+$src3<<#0)",
562 // Rdd=memd(Rt<<#u2+#U6)
565 // Rd=memb(Rs+Rt<<#u2)
566 let AddedComplexity = 10, isPredicable = 1 in
567 def LDrib_indexed_V4 : LDInst<(outs IntRegs:$dst),
568 (ins IntRegs:$src1, IntRegs:$src2),
569 "$dst=memb($src1+$src2<<#0)",
570 [(set (i32 IntRegs:$dst),
571 (i32 (sextloadi8 (add (i32 IntRegs:$src1),
572 (i32 IntRegs:$src2)))))]>,
575 let AddedComplexity = 10, isPredicable = 1 in
576 def LDriub_indexed_V4 : LDInst<(outs IntRegs:$dst),
577 (ins IntRegs:$src1, IntRegs:$src2),
578 "$dst=memub($src1+$src2<<#0)",
579 [(set (i32 IntRegs:$dst),
580 (i32 (zextloadi8 (add (i32 IntRegs:$src1),
581 (i32 IntRegs:$src2)))))]>,
584 let AddedComplexity = 10, isPredicable = 1 in
585 def LDriub_ae_indexed_V4 : LDInst<(outs IntRegs:$dst),
586 (ins IntRegs:$src1, IntRegs:$src2),
587 "$dst=memub($src1+$src2<<#0)",
588 [(set (i32 IntRegs:$dst),
589 (i32 (extloadi8 (add (i32 IntRegs:$src1),
590 (i32 IntRegs:$src2)))))]>,
593 let AddedComplexity = 40, isPredicable = 1 in
594 def LDriub_ae_indexed_shl_V4 : LDInst<(outs IntRegs:$dst),
595 (ins IntRegs:$src1, IntRegs:$src2, u2Imm:$offset),
596 "$dst=memub($src1+$src2<<#$offset)",
597 [(set (i32 IntRegs:$dst),
598 (i32 (extloadi8 (add (i32 IntRegs:$src1),
599 (shl (i32 IntRegs:$src2),
600 u2ImmPred:$offset)))))]>,
603 //// Load byte conditionally.
604 // if ([!]Pv[.new]) Rd=memb(Rs+Rt<<#u2)
605 // if (Pv) Rd=memb(Rs+Rt<<#u2)
606 let AddedComplexity = 15, isPredicated = 1 in
607 def LDrib_indexed_cPt_V4 : LDInst2<(outs IntRegs:$dst),
608 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
609 "if ($src1) $dst=memb($src2+$src3<<#0)",
613 // if (Pv.new) Rd=memb(Rs+Rt<<#u2)
614 let AddedComplexity = 15, isPredicated = 1 in
615 def LDrib_indexed_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
616 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
617 "if ($src1.new) $dst=memb($src2+$src3<<#0)",
621 // if (!Pv) Rd=memb(Rs+Rt<<#u2)
622 let AddedComplexity = 15, isPredicated = 1 in
623 def LDrib_indexed_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
624 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
625 "if (!$src1) $dst=memb($src2+$src3<<#0)",
629 // if (!Pv.new) Rd=memb(Rs+Rt<<#u2)
630 let AddedComplexity = 15, isPredicated = 1 in
631 def LDrib_indexed_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
632 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
633 "if (!$src1.new) $dst=memb($src2+$src3<<#0)",
637 //// Load unsigned byte conditionally.
638 // if ([!]Pv[.new]) Rd=memub(Rs+Rt<<#u2)
639 // if (Pv) Rd=memub(Rs+Rt<<#u2)
640 let AddedComplexity = 15, isPredicated = 1 in
641 def LDriub_indexed_cPt_V4 : LDInst2<(outs IntRegs:$dst),
642 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
643 "if ($src1) $dst=memub($src2+$src3<<#0)",
647 // if (Pv.new) Rd=memub(Rs+Rt<<#u2)
648 let AddedComplexity = 15, isPredicated = 1 in
649 def LDriub_indexed_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
650 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
651 "if ($src1.new) $dst=memub($src2+$src3<<#0)",
655 // if (!Pv) Rd=memub(Rs+Rt<<#u2)
656 let AddedComplexity = 15, isPredicated = 1 in
657 def LDriub_indexed_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
658 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
659 "if (!$src1) $dst=memub($src2+$src3<<#0)",
663 // if (!Pv.new) Rd=memub(Rs+Rt<<#u2)
664 let AddedComplexity = 15, isPredicated = 1 in
665 def LDriub_indexed_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
666 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
667 "if (!$src1.new) $dst=memub($src2+$src3<<#0)",
671 // Rd=memb(Rt<<#u2+#U6)
674 // Rd=memh(Rs+Rt<<#u2)
675 let AddedComplexity = 10, isPredicable = 1 in
676 def LDrih_indexed_V4 : LDInst<(outs IntRegs:$dst),
677 (ins IntRegs:$src1, IntRegs:$src2),
678 "$dst=memh($src1+$src2<<#0)",
679 [(set (i32 IntRegs:$dst),
680 (i32 (sextloadi16 (add (i32 IntRegs:$src1),
681 (i32 IntRegs:$src2)))))]>,
684 let AddedComplexity = 10, isPredicable = 1 in
685 def LDriuh_indexed_V4 : LDInst<(outs IntRegs:$dst),
686 (ins IntRegs:$src1, IntRegs:$src2),
687 "$dst=memuh($src1+$src2<<#0)",
688 [(set (i32 IntRegs:$dst),
689 (i32 (zextloadi16 (add (i32 IntRegs:$src1),
690 (i32 IntRegs:$src2)))))]>,
693 let AddedComplexity = 10, isPredicable = 1 in
694 def LDriuh_ae_indexed_V4 : LDInst<(outs IntRegs:$dst),
695 (ins IntRegs:$src1, IntRegs:$src2),
696 "$dst=memuh($src1+$src2<<#0)",
697 [(set (i32 IntRegs:$dst),
698 (i32 (extloadi16 (add (i32 IntRegs:$src1),
699 (i32 IntRegs:$src2)))))]>,
702 let AddedComplexity = 40, isPredicable = 1 in
703 def LDriuh_ae_indexed_shl_V4 : LDInst<(outs IntRegs:$dst),
704 (ins IntRegs:$src1, IntRegs:$src2, u2Imm:$offset),
705 "$dst=memuh($src1+$src2<<#$offset)",
706 [(set (i32 IntRegs:$dst),
707 (i32 (extloadi16 (add (i32 IntRegs:$src1),
708 (shl (i32 IntRegs:$src2),
709 u2ImmPred:$offset)))))]>,
712 //// Load halfword conditionally.
713 // if ([!]Pv[.new]) Rd=memh(Rs+Rt<<#u2)
714 // if (Pv) Rd=memh(Rs+Rt<<#u2)
715 let AddedComplexity = 15, isPredicated = 1 in
716 def LDrih_indexed_cPt_V4 : LDInst2<(outs IntRegs:$dst),
717 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
718 "if ($src1) $dst=memh($src2+$src3<<#0)",
722 // if (Pv.new) Rd=memh(Rs+Rt<<#u2)
723 let AddedComplexity = 15, isPredicated = 1 in
724 def LDrih_indexed_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
725 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
726 "if ($src1.new) $dst=memh($src2+$src3<<#0)",
730 // if (!Pv) Rd=memh(Rs+Rt<<#u2)
731 let AddedComplexity = 15, isPredicated = 1 in
732 def LDrih_indexed_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
733 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
734 "if (!$src1) $dst=memh($src2+$src3<<#0)",
738 // if (!Pv.new) Rd=memh(Rs+Rt<<#u2)
739 let AddedComplexity = 15, isPredicated = 1 in
740 def LDrih_indexed_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
741 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
742 "if (!$src1.new) $dst=memh($src2+$src3<<#0)",
746 //// Load unsigned halfword conditionally.
747 // if ([!]Pv[.new]) Rd=memuh(Rs+Rt<<#u2)
748 // if (Pv) Rd=memuh(Rs+Rt<<#u2)
749 let AddedComplexity = 15, isPredicated = 1 in
750 def LDriuh_indexed_cPt_V4 : LDInst2<(outs IntRegs:$dst),
751 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
752 "if ($src1) $dst=memuh($src2+$src3<<#0)",
756 // if (Pv.new) Rd=memuh(Rs+Rt<<#u2)
757 let AddedComplexity = 15, isPredicated = 1 in
758 def LDriuh_indexed_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
759 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
760 "if ($src1.new) $dst=memuh($src2+$src3<<#0)",
764 // if (!Pv) Rd=memuh(Rs+Rt<<#u2)
765 let AddedComplexity = 15, isPredicated = 1 in
766 def LDriuh_indexed_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
767 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
768 "if (!$src1) $dst=memuh($src2+$src3<<#0)",
772 // if (!Pv.new) Rd=memuh(Rs+Rt<<#u2)
773 let AddedComplexity = 15, isPredicated = 1 in
774 def LDriuh_indexed_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
775 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
776 "if (!$src1.new) $dst=memuh($src2+$src3<<#0)",
780 // Rd=memh(Rt<<#u2+#U6)
783 // Load predicate: Fix for bug 5279.
784 let neverHasSideEffects = 1 in
785 def LDriw_pred_V4 : LDInst2<(outs PredRegs:$dst),
787 "Error; should not emit",
793 // Rd=memw(Rs+Rt<<#u2)
794 let AddedComplexity = 10, isPredicable = 1 in
795 def LDriw_indexed_V4 : LDInst<(outs IntRegs:$dst),
796 (ins IntRegs:$src1, IntRegs:$src2),
797 "$dst=memw($src1+$src2<<#0)",
798 [(set (i32 IntRegs:$dst),
799 (i32 (load (add (i32 IntRegs:$src1),
800 (i32 IntRegs:$src2)))))]>,
803 //// Load word conditionally.
804 // if ([!]Pv[.new]) Rd=memw(Rs+Rt<<#u2)
805 // if (Pv) Rd=memw(Rs+Rt<<#u2)
806 let AddedComplexity = 15, isPredicated = 1 in
807 def LDriw_indexed_cPt_V4 : LDInst2<(outs IntRegs:$dst),
808 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
809 "if ($src1) $dst=memw($src2+$src3<<#0)",
813 // if (Pv.new) Rd=memh(Rs+Rt<<#u2)
814 let AddedComplexity = 15, isPredicated = 1 in
815 def LDriw_indexed_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
816 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
817 "if ($src1.new) $dst=memw($src2+$src3<<#0)",
821 // if (!Pv) Rd=memh(Rs+Rt<<#u2)
822 let AddedComplexity = 15, isPredicated = 1 in
823 def LDriw_indexed_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
824 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
825 "if (!$src1) $dst=memw($src2+$src3<<#0)",
829 // if (!Pv.new) Rd=memh(Rs+Rt<<#u2)
830 let AddedComplexity = 15, isPredicated = 1 in
831 def LDriw_indexed_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
832 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3),
833 "if (!$src1.new) $dst=memw($src2+$src3<<#0)",
837 /// Load from global offset
839 let isPredicable = 1, neverHasSideEffects = 1 in
840 def LDrid_GP_V4 : LDInst2<(outs DoubleRegs:$dst),
841 (ins globaladdress:$global, u16Imm:$offset),
842 "$dst=memd(#$global+$offset)",
846 let neverHasSideEffects = 1, isPredicated = 1 in
847 def LDrid_GP_cPt_V4 : LDInst2<(outs DoubleRegs:$dst),
848 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
849 "if ($src1) $dst=memd(##$global+$offset)",
853 let neverHasSideEffects = 1, isPredicated = 1 in
854 def LDrid_GP_cNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
855 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
856 "if (!$src1) $dst=memd(##$global+$offset)",
860 let neverHasSideEffects = 1, isPredicated = 1 in
861 def LDrid_GP_cdnPt_V4 : LDInst2<(outs DoubleRegs:$dst),
862 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
863 "if ($src1.new) $dst=memd(##$global+$offset)",
867 let neverHasSideEffects = 1, isPredicated = 1 in
868 def LDrid_GP_cdnNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
869 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
870 "if (!$src1.new) $dst=memd(##$global+$offset)",
874 let isPredicable = 1, neverHasSideEffects = 1 in
875 def LDrib_GP_V4 : LDInst2<(outs IntRegs:$dst),
876 (ins globaladdress:$global, u16Imm:$offset),
877 "$dst=memb(#$global+$offset)",
881 let neverHasSideEffects = 1, isPredicated = 1 in
882 def LDrib_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
883 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
884 "if ($src1) $dst=memb(##$global+$offset)",
888 let neverHasSideEffects = 1, isPredicated = 1 in
889 def LDrib_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
890 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
891 "if (!$src1) $dst=memb(##$global+$offset)",
895 let neverHasSideEffects = 1, isPredicated = 1 in
896 def LDrib_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
897 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
898 "if ($src1.new) $dst=memb(##$global+$offset)",
902 let neverHasSideEffects = 1, isPredicated = 1 in
903 def LDrib_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
904 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
905 "if (!$src1.new) $dst=memb(##$global+$offset)",
910 let isPredicable = 1, neverHasSideEffects = 1 in
911 def LDriub_GP_V4 : LDInst2<(outs IntRegs:$dst),
912 (ins globaladdress:$global, u16Imm:$offset),
913 "$dst=memub(#$global+$offset)",
918 let neverHasSideEffects = 1, isPredicated = 1 in
919 def LDriub_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
920 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
921 "if ($src1) $dst=memub(##$global+$offset)",
925 let neverHasSideEffects = 1, isPredicated = 1 in
926 def LDriub_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
927 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
928 "if (!$src1) $dst=memub(##$global+$offset)",
932 let neverHasSideEffects = 1, isPredicated = 1 in
933 def LDriub_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
934 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
935 "if ($src1.new) $dst=memub(##$global+$offset)",
939 let neverHasSideEffects = 1, isPredicated = 1 in
940 def LDriub_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
941 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
942 "if (!$src1.new) $dst=memub(##$global+$offset)",
947 let isPredicable = 1, neverHasSideEffects = 1 in
948 def LDrih_GP_V4 : LDInst2<(outs IntRegs:$dst),
949 (ins globaladdress:$global, u16Imm:$offset),
950 "$dst=memh(#$global+$offset)",
955 let neverHasSideEffects = 1, isPredicated = 1 in
956 def LDrih_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
957 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
958 "if ($src1) $dst=memh(##$global+$offset)",
962 let neverHasSideEffects = 1, isPredicated = 1 in
963 def LDrih_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
964 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
965 "if (!$src1) $dst=memh(##$global+$offset)",
969 let neverHasSideEffects = 1, isPredicated = 1 in
970 def LDrih_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
971 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
972 "if ($src1.new) $dst=memh(##$global+$offset)",
976 let neverHasSideEffects = 1, isPredicated = 1 in
977 def LDrih_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
978 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
979 "if (!$src1.new) $dst=memh(##$global+$offset)",
984 let isPredicable = 1, neverHasSideEffects = 1 in
985 def LDriuh_GP_V4 : LDInst2<(outs IntRegs:$dst),
986 (ins globaladdress:$global, u16Imm:$offset),
987 "$dst=memuh(#$global+$offset)",
991 let neverHasSideEffects = 1, isPredicated = 1 in
992 def LDriuh_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
993 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
994 "if ($src1) $dst=memuh(##$global+$offset)",
998 let neverHasSideEffects = 1, isPredicated = 1 in
999 def LDriuh_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1000 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
1001 "if (!$src1) $dst=memuh(##$global+$offset)",
1005 let neverHasSideEffects = 1, isPredicated = 1 in
1006 def LDriuh_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
1007 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
1008 "if ($src1.new) $dst=memuh(##$global+$offset)",
1012 let neverHasSideEffects = 1, isPredicated = 1 in
1013 def LDriuh_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1014 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
1015 "if (!$src1.new) $dst=memuh(##$global+$offset)",
1019 let isPredicable = 1, neverHasSideEffects = 1 in
1020 def LDriw_GP_V4 : LDInst2<(outs IntRegs:$dst),
1021 (ins globaladdress:$global, u16Imm:$offset),
1022 "$dst=memw(#$global+$offset)",
1027 let neverHasSideEffects = 1, isPredicated = 1 in
1028 def LDriw_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
1029 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
1030 "if ($src1) $dst=memw(##$global+$offset)",
1034 let neverHasSideEffects = 1, isPredicated = 1 in
1035 def LDriw_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1036 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
1037 "if (!$src1) $dst=memw(##$global+$offset)",
1042 let neverHasSideEffects = 1, isPredicated = 1 in
1043 def LDriw_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
1044 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
1045 "if ($src1.new) $dst=memw(##$global+$offset)",
1049 let neverHasSideEffects = 1, isPredicated = 1 in
1050 def LDriw_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1051 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
1052 "if (!$src1.new) $dst=memw(##$global+$offset)",
1057 let isPredicable = 1, neverHasSideEffects = 1 in
1058 def LDd_GP_V4 : LDInst2<(outs DoubleRegs:$dst),
1059 (ins globaladdress:$global),
1060 "$dst=memd(#$global)",
1064 // if (Pv) Rtt=memd(##global)
1065 let neverHasSideEffects = 1, isPredicated = 1 in
1066 def LDd_GP_cPt_V4 : LDInst2<(outs DoubleRegs:$dst),
1067 (ins PredRegs:$src1, globaladdress:$global),
1068 "if ($src1) $dst=memd(##$global)",
1073 // if (!Pv) Rtt=memd(##global)
1074 let neverHasSideEffects = 1, isPredicated = 1 in
1075 def LDd_GP_cNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
1076 (ins PredRegs:$src1, globaladdress:$global),
1077 "if (!$src1) $dst=memd(##$global)",
1081 // if (Pv) Rtt=memd(##global)
1082 let neverHasSideEffects = 1, isPredicated = 1 in
1083 def LDd_GP_cdnPt_V4 : LDInst2<(outs DoubleRegs:$dst),
1084 (ins PredRegs:$src1, globaladdress:$global),
1085 "if ($src1.new) $dst=memd(##$global)",
1090 // if (!Pv) Rtt=memd(##global)
1091 let neverHasSideEffects = 1, isPredicated = 1 in
1092 def LDd_GP_cdnNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
1093 (ins PredRegs:$src1, globaladdress:$global),
1094 "if (!$src1.new) $dst=memd(##$global)",
1098 let isPredicable = 1, neverHasSideEffects = 1 in
1099 def LDb_GP_V4 : LDInst2<(outs IntRegs:$dst),
1100 (ins globaladdress:$global),
1101 "$dst=memb(#$global)",
1105 // if (Pv) Rt=memb(##global)
1106 let neverHasSideEffects = 1, isPredicated = 1 in
1107 def LDb_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
1108 (ins PredRegs:$src1, globaladdress:$global),
1109 "if ($src1) $dst=memb(##$global)",
1113 // if (!Pv) Rt=memb(##global)
1114 let neverHasSideEffects = 1, isPredicated = 1 in
1115 def LDb_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1116 (ins PredRegs:$src1, globaladdress:$global),
1117 "if (!$src1) $dst=memb(##$global)",
1121 // if (Pv) Rt=memb(##global)
1122 let neverHasSideEffects = 1, isPredicated = 1 in
1123 def LDb_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
1124 (ins PredRegs:$src1, globaladdress:$global),
1125 "if ($src1.new) $dst=memb(##$global)",
1129 // if (!Pv) Rt=memb(##global)
1130 let neverHasSideEffects = 1, isPredicated = 1 in
1131 def LDb_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1132 (ins PredRegs:$src1, globaladdress:$global),
1133 "if (!$src1.new) $dst=memb(##$global)",
1137 let isPredicable = 1, neverHasSideEffects = 1 in
1138 def LDub_GP_V4 : LDInst2<(outs IntRegs:$dst),
1139 (ins globaladdress:$global),
1140 "$dst=memub(#$global)",
1144 // if (Pv) Rt=memub(##global)
1145 let neverHasSideEffects = 1, isPredicated = 1 in
1146 def LDub_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
1147 (ins PredRegs:$src1, globaladdress:$global),
1148 "if ($src1) $dst=memub(##$global)",
1153 // if (!Pv) Rt=memub(##global)
1154 let neverHasSideEffects = 1, isPredicated = 1 in
1155 def LDub_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1156 (ins PredRegs:$src1, globaladdress:$global),
1157 "if (!$src1) $dst=memub(##$global)",
1161 // if (Pv) Rt=memub(##global)
1162 let neverHasSideEffects = 1, isPredicated = 1 in
1163 def LDub_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
1164 (ins PredRegs:$src1, globaladdress:$global),
1165 "if ($src1.new) $dst=memub(##$global)",
1170 // if (!Pv) Rt=memub(##global)
1171 let neverHasSideEffects = 1, isPredicated = 1 in
1172 def LDub_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1173 (ins PredRegs:$src1, globaladdress:$global),
1174 "if (!$src1.new) $dst=memub(##$global)",
1178 let isPredicable = 1, neverHasSideEffects = 1 in
1179 def LDh_GP_V4 : LDInst2<(outs IntRegs:$dst),
1180 (ins globaladdress:$global),
1181 "$dst=memh(#$global)",
1185 // if (Pv) Rt=memh(##global)
1186 let neverHasSideEffects = 1, isPredicated = 1 in
1187 def LDh_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
1188 (ins PredRegs:$src1, globaladdress:$global),
1189 "if ($src1) $dst=memh(##$global)",
1193 // if (!Pv) Rt=memh(##global)
1194 let neverHasSideEffects = 1, isPredicated = 1 in
1195 def LDh_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1196 (ins PredRegs:$src1, globaladdress:$global),
1197 "if (!$src1) $dst=memh(##$global)",
1201 // if (Pv) Rt=memh(##global)
1202 let neverHasSideEffects = 1, isPredicated = 1 in
1203 def LDh_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
1204 (ins PredRegs:$src1, globaladdress:$global),
1205 "if ($src1.new) $dst=memh(##$global)",
1209 // if (!Pv) Rt=memh(##global)
1210 let neverHasSideEffects = 1, isPredicated = 1 in
1211 def LDh_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1212 (ins PredRegs:$src1, globaladdress:$global),
1213 "if (!$src1.new) $dst=memh(##$global)",
1217 let isPredicable = 1, neverHasSideEffects = 1 in
1218 def LDuh_GP_V4 : LDInst2<(outs IntRegs:$dst),
1219 (ins globaladdress:$global),
1220 "$dst=memuh(#$global)",
1224 // if (Pv) Rt=memuh(##global)
1225 let neverHasSideEffects = 1, isPredicated = 1 in
1226 def LDuh_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
1227 (ins PredRegs:$src1, globaladdress:$global),
1228 "if ($src1) $dst=memuh(##$global)",
1232 // if (!Pv) Rt=memuh(##global)
1233 let neverHasSideEffects = 1, isPredicated = 1 in
1234 def LDuh_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1235 (ins PredRegs:$src1, globaladdress:$global),
1236 "if (!$src1) $dst=memuh(##$global)",
1240 // if (Pv) Rt=memuh(##global)
1241 let neverHasSideEffects = 1, isPredicated = 1 in
1242 def LDuh_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
1243 (ins PredRegs:$src1, globaladdress:$global),
1244 "if ($src1.new) $dst=memuh(##$global)",
1248 // if (!Pv) Rt=memuh(##global)
1249 let neverHasSideEffects = 1, isPredicated = 1 in
1250 def LDuh_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1251 (ins PredRegs:$src1, globaladdress:$global),
1252 "if (!$src1.new) $dst=memuh(##$global)",
1256 let isPredicable = 1, neverHasSideEffects = 1 in
1257 def LDw_GP_V4 : LDInst2<(outs IntRegs:$dst),
1258 (ins globaladdress:$global),
1259 "$dst=memw(#$global)",
1263 // if (Pv) Rt=memw(##global)
1264 let neverHasSideEffects = 1, isPredicated = 1 in
1265 def LDw_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
1266 (ins PredRegs:$src1, globaladdress:$global),
1267 "if ($src1) $dst=memw(##$global)",
1272 // if (!Pv) Rt=memw(##global)
1273 let neverHasSideEffects = 1, isPredicated = 1 in
1274 def LDw_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1275 (ins PredRegs:$src1, globaladdress:$global),
1276 "if (!$src1) $dst=memw(##$global)",
1280 // if (Pv) Rt=memw(##global)
1281 let neverHasSideEffects = 1, isPredicated = 1 in
1282 def LDw_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
1283 (ins PredRegs:$src1, globaladdress:$global),
1284 "if ($src1.new) $dst=memw(##$global)",
1289 // if (!Pv) Rt=memw(##global)
1290 let neverHasSideEffects = 1, isPredicated = 1 in
1291 def LDw_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
1292 (ins PredRegs:$src1, globaladdress:$global),
1293 "if (!$src1.new) $dst=memw(##$global)",
1299 def : Pat <(atomic_load_64 (HexagonCONST32_GP tglobaladdr:$global)),
1300 (i64 (LDd_GP_V4 tglobaladdr:$global))>,
1303 def : Pat <(atomic_load_32 (HexagonCONST32_GP tglobaladdr:$global)),
1304 (i32 (LDw_GP_V4 tglobaladdr:$global))>,
1307 def : Pat <(atomic_load_16 (HexagonCONST32_GP tglobaladdr:$global)),
1308 (i32 (LDuh_GP_V4 tglobaladdr:$global))>,
1311 def : Pat <(atomic_load_8 (HexagonCONST32_GP tglobaladdr:$global)),
1312 (i32 (LDub_GP_V4 tglobaladdr:$global))>,
1315 // Map from load(globaladdress) -> memw(#foo + 0)
1316 let AddedComplexity = 100 in
1317 def : Pat <(i64 (load (HexagonCONST32_GP tglobaladdr:$global))),
1318 (i64 (LDd_GP_V4 tglobaladdr:$global))>,
1321 // Map from Pd = load(globaladdress) -> Rd = memb(globaladdress), Pd = Rd
1322 let AddedComplexity = 100 in
1323 def : Pat <(i1 (load (HexagonCONST32_GP tglobaladdr:$global))),
1324 (i1 (TFR_PdRs (i32 (LDb_GP_V4 tglobaladdr:$global))))>,
1327 // When the Interprocedural Global Variable optimizer realizes that a certain
1328 // global variable takes only two constant values, it shrinks the global to
1329 // a boolean. Catch those loads here in the following 3 patterns.
1330 let AddedComplexity = 100 in
1331 def : Pat <(i32 (extloadi1 (HexagonCONST32_GP tglobaladdr:$global))),
1332 (i32 (LDb_GP_V4 tglobaladdr:$global))>,
1335 let AddedComplexity = 100 in
1336 def : Pat <(i32 (sextloadi1 (HexagonCONST32_GP tglobaladdr:$global))),
1337 (i32 (LDb_GP_V4 tglobaladdr:$global))>,
1340 // Map from load(globaladdress) -> memb(#foo)
1341 let AddedComplexity = 100 in
1342 def : Pat <(i32 (extloadi8 (HexagonCONST32_GP tglobaladdr:$global))),
1343 (i32 (LDb_GP_V4 tglobaladdr:$global))>,
1346 // Map from load(globaladdress) -> memb(#foo)
1347 let AddedComplexity = 100 in
1348 def : Pat <(i32 (sextloadi8 (HexagonCONST32_GP tglobaladdr:$global))),
1349 (i32 (LDb_GP_V4 tglobaladdr:$global))>,
1352 let AddedComplexity = 100 in
1353 def : Pat <(i32 (zextloadi1 (HexagonCONST32_GP tglobaladdr:$global))),
1354 (i32 (LDub_GP_V4 tglobaladdr:$global))>,
1357 // Map from load(globaladdress) -> memub(#foo)
1358 let AddedComplexity = 100 in
1359 def : Pat <(i32 (zextloadi8 (HexagonCONST32_GP tglobaladdr:$global))),
1360 (i32 (LDub_GP_V4 tglobaladdr:$global))>,
1363 // Map from load(globaladdress) -> memh(#foo)
1364 let AddedComplexity = 100 in
1365 def : Pat <(i32 (extloadi16 (HexagonCONST32_GP tglobaladdr:$global))),
1366 (i32 (LDh_GP_V4 tglobaladdr:$global))>,
1369 // Map from load(globaladdress) -> memh(#foo)
1370 let AddedComplexity = 100 in
1371 def : Pat <(i32 (sextloadi16 (HexagonCONST32_GP tglobaladdr:$global))),
1372 (i32 (LDh_GP_V4 tglobaladdr:$global))>,
1375 // Map from load(globaladdress) -> memuh(#foo)
1376 let AddedComplexity = 100 in
1377 def : Pat <(i32 (zextloadi16 (HexagonCONST32_GP tglobaladdr:$global))),
1378 (i32 (LDuh_GP_V4 tglobaladdr:$global))>,
1381 // Map from load(globaladdress) -> memw(#foo)
1382 let AddedComplexity = 100 in
1383 def : Pat <(i32 (load (HexagonCONST32_GP tglobaladdr:$global))),
1384 (i32 (LDw_GP_V4 tglobaladdr:$global))>,
1387 def : Pat <(atomic_load_64 (add (HexagonCONST32_GP tglobaladdr:$global),
1388 u16ImmPred:$offset)),
1389 (i64 (LDrid_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1392 def : Pat <(atomic_load_32 (add (HexagonCONST32_GP tglobaladdr:$global),
1393 u16ImmPred:$offset)),
1394 (i32 (LDriw_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1397 def : Pat <(atomic_load_16 (add (HexagonCONST32_GP tglobaladdr:$global),
1398 u16ImmPred:$offset)),
1399 (i32 (LDriuh_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1402 def : Pat <(atomic_load_8 (add (HexagonCONST32_GP tglobaladdr:$global),
1403 u16ImmPred:$offset)),
1404 (i32 (LDriub_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1407 // Map from load(globaladdress + x) -> memd(#foo + x)
1408 let AddedComplexity = 100 in
1409 def : Pat <(i64 (load (add (HexagonCONST32_GP tglobaladdr:$global),
1410 u16ImmPred:$offset))),
1411 (i64 (LDrid_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1414 // Map from load(globaladdress + x) -> memb(#foo + x)
1415 let AddedComplexity = 100 in
1416 def : Pat <(i32 (extloadi8 (add (HexagonCONST32_GP tglobaladdr:$global),
1417 u16ImmPred:$offset))),
1418 (i32 (LDrib_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1421 // Map from load(globaladdress + x) -> memb(#foo + x)
1422 let AddedComplexity = 100 in
1423 def : Pat <(i32 (sextloadi8 (add (HexagonCONST32_GP tglobaladdr:$global),
1424 u16ImmPred:$offset))),
1425 (i32 (LDrib_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1428 // Map from load(globaladdress + x) -> memub(#foo + x)
1429 let AddedComplexity = 100 in
1430 def : Pat <(i32 (zextloadi8 (add (HexagonCONST32_GP tglobaladdr:$global),
1431 u16ImmPred:$offset))),
1432 (i32 (LDriub_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1435 // Map from load(globaladdress + x) -> memuh(#foo + x)
1436 let AddedComplexity = 100 in
1437 def : Pat <(i32 (extloadi16 (add (HexagonCONST32_GP tglobaladdr:$global),
1438 u16ImmPred:$offset))),
1439 (i32 (LDrih_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1442 // Map from load(globaladdress + x) -> memh(#foo + x)
1443 let AddedComplexity = 100 in
1444 def : Pat <(i32 (sextloadi16 (add (HexagonCONST32_GP tglobaladdr:$global),
1445 u16ImmPred:$offset))),
1446 (i32 (LDrih_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1450 // Map from load(globaladdress + x) -> memuh(#foo + x)
1451 let AddedComplexity = 100 in
1452 def : Pat <(i32 (zextloadi16 (add (HexagonCONST32_GP tglobaladdr:$global),
1453 u16ImmPred:$offset))),
1454 (i32 (LDriuh_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1457 // Map from load(globaladdress + x) -> memw(#foo + x)
1458 let AddedComplexity = 100 in
1459 def : Pat <(i32 (load (add (HexagonCONST32_GP tglobaladdr:$global),
1460 u16ImmPred:$offset))),
1461 (i32 (LDriw_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1465 //===----------------------------------------------------------------------===//
1467 //===----------------------------------------------------------------------===//
1469 //===----------------------------------------------------------------------===//
1471 //===----------------------------------------------------------------------===//
1473 /// Assumptions::: ****** DO NOT IGNORE ********
1474 /// 1. Make sure that in post increment store, the zero'th operand is always the
1475 /// post increment operand.
1476 /// 2. Make sure that the store value operand(Rt/Rtt) in a store is always the
1481 def STrid_abs_setimm_V4 : STInst2<(outs IntRegs:$dst1),
1482 (ins DoubleRegs:$src1, u6Imm:$src2),
1483 "memd($dst1=#$src2) = $src1",
1488 def STrib_abs_setimm_V4 : STInst2<(outs IntRegs:$dst1),
1489 (ins IntRegs:$src1, u6Imm:$src2),
1490 "memb($dst1=#$src2) = $src1",
1495 def STrih_abs_setimm_V4 : STInst2<(outs IntRegs:$dst1),
1496 (ins IntRegs:$src1, u6Imm:$src2),
1497 "memh($dst1=#$src2) = $src1",
1502 def STriw_abs_setimm_V4 : STInst2<(outs IntRegs:$dst1),
1503 (ins IntRegs:$src1, u6Imm:$src2),
1504 "memw($dst1=#$src2) = $src1",
1509 def STrid_abs_set_V4 : STInst2<(outs IntRegs:$dst1),
1510 (ins DoubleRegs:$src1, globaladdress:$src2),
1511 "memd($dst1=##$src2) = $src1",
1516 def STrib_abs_set_V4 : STInst2<(outs IntRegs:$dst1),
1517 (ins IntRegs:$src1, globaladdress:$src2),
1518 "memb($dst1=##$src2) = $src1",
1523 def STrih_abs_set_V4 : STInst2<(outs IntRegs:$dst1),
1524 (ins IntRegs:$src1, globaladdress:$src2),
1525 "memh($dst1=##$src2) = $src1",
1530 def STriw_abs_set_V4 : STInst2<(outs IntRegs:$dst1),
1531 (ins IntRegs:$src1, globaladdress:$src2),
1532 "memw($dst1=##$src2) = $src1",
1537 // multiclass for store instructions with base + register offset addressing
1539 multiclass ST_Idxd_shl_Pbase<string mnemonic, RegisterClass RC, bit isNot,
1541 let PNewValue = #!if(isPredNew, "new", "") in
1542 def #NAME# : STInst2<(outs),
1543 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, u2Imm:$src4,
1545 !if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
1546 ") ")#mnemonic#"($src2+$src3<<#$src4) = $src5",
1551 multiclass ST_Idxd_shl_Pred<string mnemonic, RegisterClass RC, bit PredNot> {
1552 let PredSense = #!if(PredNot, "false", "true") in {
1553 defm _c#NAME# : ST_Idxd_shl_Pbase<mnemonic, RC, PredNot, 0>;
1555 defm _cdn#NAME# : ST_Idxd_shl_Pbase<mnemonic, RC, PredNot, 1>;
1559 let isNVStorable = 1 in
1560 multiclass ST_Idxd_shl<string mnemonic, string CextOp, RegisterClass RC> {
1561 let CextOpcode = CextOp, BaseOpcode = CextOp#_indexed_shl in {
1562 let isPredicable = 1 in
1563 def #NAME#_V4 : STInst2<(outs),
1564 (ins IntRegs:$src1, IntRegs:$src2, u2Imm:$src3, RC:$src4),
1565 #mnemonic#"($src1+$src2<<#$src3) = $src4",
1569 let isPredicated = 1 in {
1570 defm Pt_V4 : ST_Idxd_shl_Pred<mnemonic, RC, 0 >;
1571 defm NotPt_V4 : ST_Idxd_shl_Pred<mnemonic, RC, 1>;
1576 // multiclass for new-value store instructions with base + register offset
1578 multiclass ST_Idxd_shl_Pbase_nv<string mnemonic, RegisterClass RC, bit isNot,
1580 let PNewValue = #!if(isPredNew, "new", "") in
1581 def #NAME#_nv_V4 : NVInst_V4<(outs),
1582 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, u2Imm:$src4,
1584 !if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
1585 ") ")#mnemonic#"($src2+$src3<<#$src4) = $src5.new",
1590 multiclass ST_Idxd_shl_Pred_nv<string mnemonic, RegisterClass RC, bit PredNot> {
1591 let PredSense = #!if(PredNot, "false", "true") in {
1592 defm _c#NAME# : ST_Idxd_shl_Pbase_nv<mnemonic, RC, PredNot, 0>;
1594 defm _cdn#NAME# : ST_Idxd_shl_Pbase_nv<mnemonic, RC, PredNot, 1>;
1598 let mayStore = 1, isNVStore = 1 in
1599 multiclass ST_Idxd_shl_nv<string mnemonic, string CextOp, RegisterClass RC> {
1600 let CextOpcode = CextOp, BaseOpcode = CextOp#_indexed_shl in {
1601 let isPredicable = 1 in
1602 def #NAME#_nv_V4 : NVInst_V4<(outs),
1603 (ins IntRegs:$src1, IntRegs:$src2, u2Imm:$src3, RC:$src4),
1604 #mnemonic#"($src1+$src2<<#$src3) = $src4.new",
1608 let isPredicated = 1 in {
1609 defm Pt : ST_Idxd_shl_Pred_nv<mnemonic, RC, 0 >;
1610 defm NotPt : ST_Idxd_shl_Pred_nv<mnemonic, RC, 1>;
1615 let addrMode = BaseRegOffset, neverHasSideEffects = 1,
1616 validSubTargets = HasV4SubT in {
1617 defm STrib_indexed_shl: ST_Idxd_shl<"memb", "STrib", IntRegs>,
1618 ST_Idxd_shl_nv<"memb", "STrib", IntRegs>, AddrModeRel;
1620 defm STrih_indexed_shl: ST_Idxd_shl<"memh", "STrih", IntRegs>,
1621 ST_Idxd_shl_nv<"memh", "STrih", IntRegs>, AddrModeRel;
1623 defm STriw_indexed_shl: ST_Idxd_shl<"memw", "STriw", IntRegs>,
1624 ST_Idxd_shl_nv<"memw", "STriw", IntRegs>, AddrModeRel;
1626 let isNVStorable = 0 in
1627 defm STrid_indexed_shl: ST_Idxd_shl<"memd", "STrid", DoubleRegs>, AddrModeRel;
1630 let Predicates = [HasV4T], AddedComplexity = 10 in {
1631 def : Pat<(truncstorei8 (i32 IntRegs:$src4),
1632 (add IntRegs:$src1, (shl IntRegs:$src2,
1634 (STrib_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2,
1635 u2ImmPred:$src3, IntRegs:$src4)>;
1637 def : Pat<(truncstorei16 (i32 IntRegs:$src4),
1638 (add IntRegs:$src1, (shl IntRegs:$src2,
1640 (STrih_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2,
1641 u2ImmPred:$src3, IntRegs:$src4)>;
1643 def : Pat<(store (i32 IntRegs:$src4),
1644 (add IntRegs:$src1, (shl IntRegs:$src2, u2ImmPred:$src3))),
1645 (STriw_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2,
1646 u2ImmPred:$src3, IntRegs:$src4)>;
1648 def : Pat<(store (i64 DoubleRegs:$src4),
1649 (add IntRegs:$src1, (shl IntRegs:$src2, u2ImmPred:$src3))),
1650 (STrid_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2,
1651 u2ImmPred:$src3, DoubleRegs:$src4)>;
1654 // memd(Ru<<#u2+#U6)=Rtt
1655 let AddedComplexity = 10 in
1656 def STrid_shl_V4 : STInst<(outs),
1657 (ins IntRegs:$src1, u2Imm:$src2, u6Imm:$src3, DoubleRegs:$src4),
1658 "memd($src1<<#$src2+#$src3) = $src4",
1659 [(store (i64 DoubleRegs:$src4),
1660 (add (shl (i32 IntRegs:$src1), u2ImmPred:$src2),
1661 u6ImmPred:$src3))]>,
1664 // memd(Rx++#s4:3)=Rtt
1665 // memd(Rx++#s4:3:circ(Mu))=Rtt
1666 // memd(Rx++I:circ(Mu))=Rtt
1668 // memd(Rx++Mu:brev)=Rtt
1669 // memd(gp+#u16:3)=Rtt
1671 // Store doubleword conditionally.
1672 // if ([!]Pv[.new]) memd(#u6)=Rtt
1673 // TODO: needs to be implemented.
1675 // if ([!]Pv[.new]) memd(Rx++#s4:3)=Rtt
1676 // if (Pv) memd(Rx++#s4:3)=Rtt
1677 // if (Pv.new) memd(Rx++#s4:3)=Rtt
1678 let AddedComplexity = 10, neverHasSideEffects = 1,
1680 def POST_STdri_cdnPt_V4 : STInst2PI<(outs IntRegs:$dst),
1681 (ins PredRegs:$src1, DoubleRegs:$src2, IntRegs:$src3,
1683 "if ($src1.new) memd($src3++#$offset) = $src2",
1688 // if (!Pv) memd(Rx++#s4:3)=Rtt
1689 // if (!Pv.new) memd(Rx++#s4:3)=Rtt
1690 let AddedComplexity = 10, neverHasSideEffects = 1,
1692 def POST_STdri_cdnNotPt_V4 : STInst2PI<(outs IntRegs:$dst),
1693 (ins PredRegs:$src1, DoubleRegs:$src2, IntRegs:$src3,
1695 "if (!$src1.new) memd($src3++#$offset) = $src2",
1701 // multiclass for store instructions with base + immediate offset
1702 // addressing mode and immediate stored value.
1703 multiclass ST_Imm_Pbase<string mnemonic, Operand OffsetOp, bit isNot,
1705 let PNewValue = #!if(isPredNew, "new", "") in
1706 def #NAME# : STInst2<(outs),
1707 (ins PredRegs:$src1, IntRegs:$src2, OffsetOp:$src3, s6Ext:$src4),
1708 #!if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
1709 ") ")#mnemonic#"($src2+#$src3) = #$src4",
1714 multiclass ST_Imm_Pred<string mnemonic, Operand OffsetOp, bit PredNot> {
1715 let PredSense = #!if(PredNot, "false", "true") in {
1716 defm _c#NAME# : ST_Imm_Pbase<mnemonic, OffsetOp, PredNot, 0>;
1718 defm _cdn#NAME# : ST_Imm_Pbase<mnemonic, OffsetOp, PredNot, 1>;
1722 let isExtendable = 1, isExtentSigned = 1, neverHasSideEffects = 1 in
1723 multiclass ST_Imm<string mnemonic, string CextOp, Operand OffsetOp> {
1724 let CextOpcode = CextOp, BaseOpcode = CextOp#_imm in {
1725 let opExtendable = 2, opExtentBits = 8, isPredicable = 1 in
1726 def #NAME#_V4 : STInst2<(outs),
1727 (ins IntRegs:$src1, OffsetOp:$src2, s8Ext:$src3),
1728 #mnemonic#"($src1+#$src2) = #$src3",
1732 let opExtendable = 3, opExtentBits = 6, isPredicated = 1 in {
1733 defm Pt_V4 : ST_Imm_Pred<mnemonic, OffsetOp, 0>;
1734 defm NotPt_V4 : ST_Imm_Pred<mnemonic, OffsetOp, 1 >;
1739 let addrMode = BaseImmOffset, InputType = "imm",
1740 validSubTargets = HasV4SubT in {
1741 defm STrib_imm : ST_Imm<"memb", "STrib", u6_0Imm>, ImmRegRel;
1742 defm STrih_imm : ST_Imm<"memh", "STrih", u6_1Imm>, ImmRegRel;
1743 defm STriw_imm : ST_Imm<"memw", "STriw", u6_2Imm>, ImmRegRel;
1746 let Predicates = [HasV4T], AddedComplexity = 10 in {
1747 def: Pat<(truncstorei8 s8ExtPred:$src3, (add IntRegs:$src1, u6_0ImmPred:$src2)),
1748 (STrib_imm_V4 IntRegs:$src1, u6_0ImmPred:$src2, s8ExtPred:$src3)>;
1750 def: Pat<(truncstorei16 s8ExtPred:$src3, (add IntRegs:$src1,
1751 u6_1ImmPred:$src2)),
1752 (STrih_imm_V4 IntRegs:$src1, u6_1ImmPred:$src2, s8ExtPred:$src3)>;
1754 def: Pat<(store s8ExtPred:$src3, (add IntRegs:$src1, u6_2ImmPred:$src2)),
1755 (STriw_imm_V4 IntRegs:$src1, u6_2ImmPred:$src2, s8ExtPred:$src3)>;
1758 let AddedComplexity = 6 in
1759 def : Pat <(truncstorei8 s8ExtPred:$src2, (i32 IntRegs:$src1)),
1760 (STrib_imm_V4 IntRegs:$src1, 0, s8ExtPred:$src2)>,
1763 // memb(Ru<<#u2+#U6)=Rt
1764 let AddedComplexity = 10 in
1765 def STrib_shl_V4 : STInst<(outs),
1766 (ins IntRegs:$src1, u2Imm:$src2, u6Imm:$src3, IntRegs:$src4),
1767 "memb($src1<<#$src2+#$src3) = $src4",
1768 [(truncstorei8 (i32 IntRegs:$src4),
1769 (add (shl (i32 IntRegs:$src1), u2ImmPred:$src2),
1770 u6ImmPred:$src3))]>,
1773 // memb(Rx++#s4:0:circ(Mu))=Rt
1774 // memb(Rx++I:circ(Mu))=Rt
1776 // memb(Rx++Mu:brev)=Rt
1777 // memb(gp+#u16:0)=Rt
1780 // Store byte conditionally.
1781 // if ([!]Pv[.new]) memb(#u6)=Rt
1782 // if ([!]Pv[.new]) memb(Rx++#s4:0)=Rt
1783 // if (Pv) memb(Rx++#s4:0)=Rt
1784 // if (Pv.new) memb(Rx++#s4:0)=Rt
1787 def POST_STbri_cdnPt_V4 : STInst2PI<(outs IntRegs:$dst),
1788 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_0Imm:$offset),
1789 "if ($src1.new) memb($src3++#$offset) = $src2",
1793 // if (!Pv) memb(Rx++#s4:0)=Rt
1794 // if (!Pv.new) memb(Rx++#s4:0)=Rt
1797 def POST_STbri_cdnNotPt_V4 : STInst2PI<(outs IntRegs:$dst),
1798 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_0Imm:$offset),
1799 "if (!$src1.new) memb($src3++#$offset) = $src2",
1805 // TODO: needs to be implemented
1806 // memh(Re=#U6)=Rt.H
1807 // memh(Rs+#s11:1)=Rt.H
1808 let AddedComplexity = 6 in
1809 def : Pat <(truncstorei16 s8ExtPred:$src2, (i32 IntRegs:$src1)),
1810 (STrih_imm_V4 IntRegs:$src1, 0, s8ExtPred:$src2)>,
1813 // memh(Rs+Ru<<#u2)=Rt.H
1814 // TODO: needs to be implemented.
1816 // memh(Ru<<#u2+#U6)=Rt.H
1817 // memh(Ru<<#u2+#U6)=Rt
1818 let AddedComplexity = 10 in
1819 def STrih_shl_V4 : STInst<(outs),
1820 (ins IntRegs:$src1, u2Imm:$src2, u6Imm:$src3, IntRegs:$src4),
1821 "memh($src1<<#$src2+#$src3) = $src4",
1822 [(truncstorei16 (i32 IntRegs:$src4),
1823 (add (shl (i32 IntRegs:$src1), u2ImmPred:$src2),
1824 u6ImmPred:$src3))]>,
1827 // memh(Rx++#s4:1:circ(Mu))=Rt.H
1828 // memh(Rx++#s4:1:circ(Mu))=Rt
1829 // memh(Rx++I:circ(Mu))=Rt.H
1830 // memh(Rx++I:circ(Mu))=Rt
1831 // memh(Rx++Mu)=Rt.H
1833 // memh(Rx++Mu:brev)=Rt.H
1834 // memh(Rx++Mu:brev)=Rt
1835 // memh(gp+#u16:1)=Rt
1836 // if ([!]Pv[.new]) memh(#u6)=Rt.H
1837 // if ([!]Pv[.new]) memh(#u6)=Rt
1840 // if ([!]Pv[.new]) memh(Rs+#u6:1)=Rt.H
1841 // TODO: needs to be implemented.
1843 // if ([!]Pv[.new]) memh(Rx++#s4:1)=Rt.H
1844 // TODO: Needs to be implemented.
1846 // if ([!]Pv[.new]) memh(Rx++#s4:1)=Rt
1847 // if (Pv) memh(Rx++#s4:1)=Rt
1848 // if (Pv.new) memh(Rx++#s4:1)=Rt
1851 def POST_SThri_cdnPt_V4 : STInst2PI<(outs IntRegs:$dst),
1852 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_1Imm:$offset),
1853 "if ($src1.new) memh($src3++#$offset) = $src2",
1857 // if (!Pv) memh(Rx++#s4:1)=Rt
1858 // if (!Pv.new) memh(Rx++#s4:1)=Rt
1861 def POST_SThri_cdnNotPt_V4 : STInst2PI<(outs IntRegs:$dst),
1862 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_1Imm:$offset),
1863 "if (!$src1.new) memh($src3++#$offset) = $src2",
1870 // TODO: Needs to be implemented.
1873 let neverHasSideEffects = 1 in
1874 def STriw_pred_V4 : STInst2<(outs),
1875 (ins MEMri:$addr, PredRegs:$src1),
1876 "Error; should not emit",
1880 let AddedComplexity = 6 in
1881 def : Pat <(store s8ExtPred:$src2, (i32 IntRegs:$src1)),
1882 (STriw_imm_V4 IntRegs:$src1, 0, s8ExtPred:$src2)>,
1885 // memw(Ru<<#u2+#U6)=Rt
1886 let AddedComplexity = 10 in
1887 def STriw_shl_V4 : STInst<(outs),
1888 (ins IntRegs:$src1, u2Imm:$src2, u6Imm:$src3, IntRegs:$src4),
1889 "memw($src1<<#$src2+#$src3) = $src4",
1890 [(store (i32 IntRegs:$src4),
1891 (add (shl (i32 IntRegs:$src1), u2ImmPred:$src2),
1892 u6ImmPred:$src3))]>,
1895 // memw(Rx++#s4:2)=Rt
1896 // memw(Rx++#s4:2:circ(Mu))=Rt
1897 // memw(Rx++I:circ(Mu))=Rt
1899 // memw(Rx++Mu:brev)=Rt
1900 // memw(gp+#u16:2)=Rt
1903 // if ([!]Pv[.new]) memw(Rx++#s4:2)=Rt
1904 // if (Pv) memw(Rx++#s4:2)=Rt
1905 // if (Pv.new) memw(Rx++#s4:2)=Rt
1908 def POST_STwri_cdnPt_V4 : STInst2PI<(outs IntRegs:$dst),
1909 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_2Imm:$offset),
1910 "if ($src1.new) memw($src3++#$offset) = $src2",
1914 // if (!Pv) memw(Rx++#s4:2)=Rt
1915 // if (!Pv.new) memw(Rx++#s4:2)=Rt
1918 def POST_STwri_cdnNotPt_V4 : STInst2PI<(outs IntRegs:$dst),
1919 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_2Imm:$offset),
1920 "if (!$src1.new) memw($src3++#$offset) = $src2",
1925 /// store to global address
1927 let isPredicable = 1, neverHasSideEffects = 1 in
1928 def STrid_GP_V4 : STInst2<(outs),
1929 (ins globaladdress:$global, u16Imm:$offset, DoubleRegs:$src),
1930 "memd(#$global+$offset) = $src",
1934 let neverHasSideEffects = 1, isPredicated = 1 in
1935 def STrid_GP_cPt_V4 : STInst2<(outs),
1936 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1938 "if ($src1) memd(##$global+$offset) = $src2",
1942 let neverHasSideEffects = 1, isPredicated = 1 in
1943 def STrid_GP_cNotPt_V4 : STInst2<(outs),
1944 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1946 "if (!$src1) memd(##$global+$offset) = $src2",
1950 let neverHasSideEffects = 1, isPredicated = 1 in
1951 def STrid_GP_cdnPt_V4 : STInst2<(outs),
1952 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1954 "if ($src1.new) memd(##$global+$offset) = $src2",
1958 let neverHasSideEffects = 1, isPredicated = 1 in
1959 def STrid_GP_cdnNotPt_V4 : STInst2<(outs),
1960 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1962 "if (!$src1.new) memd(##$global+$offset) = $src2",
1966 let isPredicable = 1, neverHasSideEffects = 1 in
1967 def STrib_GP_V4 : STInst2<(outs),
1968 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
1969 "memb(#$global+$offset) = $src",
1973 let neverHasSideEffects = 1, isPredicated = 1 in
1974 def STrib_GP_cPt_V4 : STInst2<(outs),
1975 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1977 "if ($src1) memb(##$global+$offset) = $src2",
1981 let neverHasSideEffects = 1, isPredicated = 1 in
1982 def STrib_GP_cNotPt_V4 : STInst2<(outs),
1983 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1985 "if (!$src1) memb(##$global+$offset) = $src2",
1989 let neverHasSideEffects = 1, isPredicated = 1 in
1990 def STrib_GP_cdnPt_V4 : STInst2<(outs),
1991 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1993 "if ($src1.new) memb(##$global+$offset) = $src2",
1997 let neverHasSideEffects = 1, isPredicated = 1 in
1998 def STrib_GP_cdnNotPt_V4 : STInst2<(outs),
1999 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2001 "if (!$src1.new) memb(##$global+$offset) = $src2",
2005 let isPredicable = 1, neverHasSideEffects = 1 in
2006 def STrih_GP_V4 : STInst2<(outs),
2007 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
2008 "memh(#$global+$offset) = $src",
2012 let neverHasSideEffects = 1, isPredicated = 1 in
2013 def STrih_GP_cPt_V4 : STInst2<(outs),
2014 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2016 "if ($src1) memh(##$global+$offset) = $src2",
2020 let neverHasSideEffects = 1, isPredicated = 1 in
2021 def STrih_GP_cNotPt_V4 : STInst2<(outs),
2022 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2024 "if (!$src1) memh(##$global+$offset) = $src2",
2028 let neverHasSideEffects = 1, isPredicated = 1 in
2029 def STrih_GP_cdnPt_V4 : STInst2<(outs),
2030 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2032 "if ($src1.new) memh(##$global+$offset) = $src2",
2036 let neverHasSideEffects = 1, isPredicated = 1 in
2037 def STrih_GP_cdnNotPt_V4 : STInst2<(outs),
2038 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2040 "if (!$src1.new) memh(##$global+$offset) = $src2",
2044 let isPredicable = 1, neverHasSideEffects = 1 in
2045 def STriw_GP_V4 : STInst2<(outs),
2046 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
2047 "memw(#$global+$offset) = $src",
2051 let neverHasSideEffects = 1, isPredicated = 1 in
2052 def STriw_GP_cPt_V4 : STInst2<(outs),
2053 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2055 "if ($src1) memw(##$global+$offset) = $src2",
2059 let neverHasSideEffects = 1, isPredicated = 1 in
2060 def STriw_GP_cNotPt_V4 : STInst2<(outs),
2061 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2063 "if (!$src1) memw(##$global+$offset) = $src2",
2067 let neverHasSideEffects = 1, isPredicated = 1 in
2068 def STriw_GP_cdnPt_V4 : STInst2<(outs),
2069 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2071 "if ($src1.new) memw(##$global+$offset) = $src2",
2075 let neverHasSideEffects = 1, isPredicated = 1 in
2076 def STriw_GP_cdnNotPt_V4 : STInst2<(outs),
2077 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2079 "if (!$src1.new) memw(##$global+$offset) = $src2",
2083 // memd(#global)=Rtt
2084 let isPredicable = 1, neverHasSideEffects = 1 in
2085 def STd_GP_V4 : STInst2<(outs),
2086 (ins globaladdress:$global, DoubleRegs:$src),
2087 "memd(#$global) = $src",
2091 // if (Pv) memd(##global) = Rtt
2092 let neverHasSideEffects = 1, isPredicated = 1 in
2093 def STd_GP_cPt_V4 : STInst2<(outs),
2094 (ins PredRegs:$src1, globaladdress:$global, DoubleRegs:$src2),
2095 "if ($src1) memd(##$global) = $src2",
2099 // if (!Pv) memd(##global) = Rtt
2100 let neverHasSideEffects = 1, isPredicated = 1 in
2101 def STd_GP_cNotPt_V4 : STInst2<(outs),
2102 (ins PredRegs:$src1, globaladdress:$global, DoubleRegs:$src2),
2103 "if (!$src1) memd(##$global) = $src2",
2107 // if (Pv) memd(##global) = Rtt
2108 let neverHasSideEffects = 1, isPredicated = 1 in
2109 def STd_GP_cdnPt_V4 : STInst2<(outs),
2110 (ins PredRegs:$src1, globaladdress:$global, DoubleRegs:$src2),
2111 "if ($src1.new) memd(##$global) = $src2",
2115 // if (!Pv) memd(##global) = Rtt
2116 let neverHasSideEffects = 1, isPredicated = 1 in
2117 def STd_GP_cdnNotPt_V4 : STInst2<(outs),
2118 (ins PredRegs:$src1, globaladdress:$global, DoubleRegs:$src2),
2119 "if (!$src1.new) memd(##$global) = $src2",
2124 let isPredicable = 1, neverHasSideEffects = 1 in
2125 def STb_GP_V4 : STInst2<(outs),
2126 (ins globaladdress:$global, IntRegs:$src),
2127 "memb(#$global) = $src",
2131 // if (Pv) memb(##global) = Rt
2132 let neverHasSideEffects = 1, isPredicated = 1 in
2133 def STb_GP_cPt_V4 : STInst2<(outs),
2134 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2135 "if ($src1) memb(##$global) = $src2",
2139 // if (!Pv) memb(##global) = Rt
2140 let neverHasSideEffects = 1, isPredicated = 1 in
2141 def STb_GP_cNotPt_V4 : STInst2<(outs),
2142 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2143 "if (!$src1) memb(##$global) = $src2",
2147 // if (Pv) memb(##global) = Rt
2148 let neverHasSideEffects = 1, isPredicated = 1 in
2149 def STb_GP_cdnPt_V4 : STInst2<(outs),
2150 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2151 "if ($src1.new) memb(##$global) = $src2",
2155 // if (!Pv) memb(##global) = Rt
2156 let neverHasSideEffects = 1, isPredicated = 1 in
2157 def STb_GP_cdnNotPt_V4 : STInst2<(outs),
2158 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2159 "if (!$src1.new) memb(##$global) = $src2",
2164 let isPredicable = 1, neverHasSideEffects = 1 in
2165 def STh_GP_V4 : STInst2<(outs),
2166 (ins globaladdress:$global, IntRegs:$src),
2167 "memh(#$global) = $src",
2171 // if (Pv) memh(##global) = Rt
2172 let neverHasSideEffects = 1, isPredicated = 1 in
2173 def STh_GP_cPt_V4 : STInst2<(outs),
2174 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2175 "if ($src1) memh(##$global) = $src2",
2179 // if (!Pv) memh(##global) = Rt
2180 let neverHasSideEffects = 1, isPredicated = 1 in
2181 def STh_GP_cNotPt_V4 : STInst2<(outs),
2182 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2183 "if (!$src1) memh(##$global) = $src2",
2187 // if (Pv) memh(##global) = Rt
2188 let neverHasSideEffects = 1, isPredicated = 1 in
2189 def STh_GP_cdnPt_V4 : STInst2<(outs),
2190 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2191 "if ($src1.new) memh(##$global) = $src2",
2195 // if (!Pv) memh(##global) = Rt
2196 let neverHasSideEffects = 1, isPredicated = 1 in
2197 def STh_GP_cdnNotPt_V4 : STInst2<(outs),
2198 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2199 "if (!$src1.new) memh(##$global) = $src2",
2204 let isPredicable = 1, neverHasSideEffects = 1 in
2205 def STw_GP_V4 : STInst2<(outs),
2206 (ins globaladdress:$global, IntRegs:$src),
2207 "memw(#$global) = $src",
2211 // if (Pv) memw(##global) = Rt
2212 let neverHasSideEffects = 1, isPredicated = 1 in
2213 def STw_GP_cPt_V4 : STInst2<(outs),
2214 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2215 "if ($src1) memw(##$global) = $src2",
2219 // if (!Pv) memw(##global) = Rt
2220 let neverHasSideEffects = 1, isPredicated = 1 in
2221 def STw_GP_cNotPt_V4 : STInst2<(outs),
2222 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2223 "if (!$src1) memw(##$global) = $src2",
2227 // if (Pv) memw(##global) = Rt
2228 let neverHasSideEffects = 1, isPredicated = 1 in
2229 def STw_GP_cdnPt_V4 : STInst2<(outs),
2230 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2231 "if ($src1.new) memw(##$global) = $src2",
2235 // if (!Pv) memw(##global) = Rt
2236 let neverHasSideEffects = 1, isPredicated = 1 in
2237 def STw_GP_cdnNotPt_V4 : STInst2<(outs),
2238 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2239 "if (!$src1.new) memw(##$global) = $src2",
2243 // 64 bit atomic store
2244 def : Pat <(atomic_store_64 (HexagonCONST32_GP tglobaladdr:$global),
2245 (i64 DoubleRegs:$src1)),
2246 (STd_GP_V4 tglobaladdr:$global, (i64 DoubleRegs:$src1))>,
2249 // Map from store(globaladdress) -> memd(#foo)
2250 let AddedComplexity = 100 in
2251 def : Pat <(store (i64 DoubleRegs:$src1),
2252 (HexagonCONST32_GP tglobaladdr:$global)),
2253 (STd_GP_V4 tglobaladdr:$global, (i64 DoubleRegs:$src1))>,
2256 // 8 bit atomic store
2257 def : Pat < (atomic_store_8 (HexagonCONST32_GP tglobaladdr:$global),
2258 (i32 IntRegs:$src1)),
2259 (STb_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
2262 // Map from store(globaladdress) -> memb(#foo)
2263 let AddedComplexity = 100 in
2264 def : Pat<(truncstorei8 (i32 IntRegs:$src1),
2265 (HexagonCONST32_GP tglobaladdr:$global)),
2266 (STb_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
2269 // Map from "i1 = constant<-1>; memw(CONST32(#foo)) = i1"
2270 // to "r0 = 1; memw(#foo) = r0"
2271 let AddedComplexity = 100 in
2272 def : Pat<(store (i1 -1), (HexagonCONST32_GP tglobaladdr:$global)),
2273 (STb_GP_V4 tglobaladdr:$global, (TFRI 1))>,
2276 def : Pat<(atomic_store_16 (HexagonCONST32_GP tglobaladdr:$global),
2277 (i32 IntRegs:$src1)),
2278 (STh_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
2281 // Map from store(globaladdress) -> memh(#foo)
2282 let AddedComplexity = 100 in
2283 def : Pat<(truncstorei16 (i32 IntRegs:$src1),
2284 (HexagonCONST32_GP tglobaladdr:$global)),
2285 (STh_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
2288 // 32 bit atomic store
2289 def : Pat<(atomic_store_32 (HexagonCONST32_GP tglobaladdr:$global),
2290 (i32 IntRegs:$src1)),
2291 (STw_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
2294 // Map from store(globaladdress) -> memw(#foo)
2295 let AddedComplexity = 100 in
2296 def : Pat<(store (i32 IntRegs:$src1), (HexagonCONST32_GP tglobaladdr:$global)),
2297 (STw_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
2300 def : Pat<(atomic_store_64 (add (HexagonCONST32_GP tglobaladdr:$global),
2301 u16ImmPred:$offset),
2302 (i64 DoubleRegs:$src1)),
2303 (STrid_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2304 (i64 DoubleRegs:$src1))>,
2307 def : Pat<(atomic_store_32 (add (HexagonCONST32_GP tglobaladdr:$global),
2308 u16ImmPred:$offset),
2309 (i32 IntRegs:$src1)),
2310 (STriw_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2311 (i32 IntRegs:$src1))>,
2314 def : Pat<(atomic_store_16 (add (HexagonCONST32_GP tglobaladdr:$global),
2315 u16ImmPred:$offset),
2316 (i32 IntRegs:$src1)),
2317 (STrih_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2318 (i32 IntRegs:$src1))>,
2321 def : Pat<(atomic_store_8 (add (HexagonCONST32_GP tglobaladdr:$global),
2322 u16ImmPred:$offset),
2323 (i32 IntRegs:$src1)),
2324 (STrib_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2325 (i32 IntRegs:$src1))>,
2328 // Map from store(globaladdress + x) -> memd(#foo + x)
2329 let AddedComplexity = 100 in
2330 def : Pat<(store (i64 DoubleRegs:$src1),
2331 (add (HexagonCONST32_GP tglobaladdr:$global),
2332 u16ImmPred:$offset)),
2333 (STrid_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2334 (i64 DoubleRegs:$src1))>,
2337 // Map from store(globaladdress + x) -> memb(#foo + x)
2338 let AddedComplexity = 100 in
2339 def : Pat<(truncstorei8 (i32 IntRegs:$src1),
2340 (add (HexagonCONST32_GP tglobaladdr:$global),
2341 u16ImmPred:$offset)),
2342 (STrib_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2343 (i32 IntRegs:$src1))>,
2346 // Map from store(globaladdress + x) -> memh(#foo + x)
2347 let AddedComplexity = 100 in
2348 def : Pat<(truncstorei16 (i32 IntRegs:$src1),
2349 (add (HexagonCONST32_GP tglobaladdr:$global),
2350 u16ImmPred:$offset)),
2351 (STrih_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2352 (i32 IntRegs:$src1))>,
2355 // Map from store(globaladdress + x) -> memw(#foo + x)
2356 let AddedComplexity = 100 in
2357 def : Pat<(store (i32 IntRegs:$src1),
2358 (add (HexagonCONST32_GP tglobaladdr:$global),
2359 u16ImmPred:$offset)),
2360 (STriw_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2361 (i32 IntRegs:$src1))>,
2366 //===----------------------------------------------------------------------===
2368 //===----------------------------------------------------------------------===
2371 //===----------------------------------------------------------------------===//
2373 //===----------------------------------------------------------------------===//
2375 // Store new-value byte.
2377 // memb(Re=#U6)=Nt.new
2378 // memb(Rs+#s11:0)=Nt.new
2379 let mayStore = 1, isPredicable = 1 in
2380 def STrib_nv_V4 : NVInst_V4<(outs), (ins MEMri:$addr, IntRegs:$src1),
2381 "memb($addr) = $src1.new",
2385 let mayStore = 1, isPredicable = 1 in
2386 def STrib_indexed_nv_V4 : NVInst_V4<(outs),
2387 (ins IntRegs:$src1, s11_0Imm:$src2, IntRegs:$src3),
2388 "memb($src1+#$src2) = $src3.new",
2391 // memb(Ru<<#u2+#U6)=Nt.new
2392 let mayStore = 1, AddedComplexity = 10 in
2393 def STrib_shl_nv_V4 : NVInst_V4<(outs),
2394 (ins IntRegs:$src1, u2Imm:$src2, u6Imm:$src3, IntRegs:$src4),
2395 "memb($src1<<#$src2+#$src3) = $src4.new",
2399 // memb(Rx++#s4:0)=Nt.new
2400 let mayStore = 1, hasCtrlDep = 1, isPredicable = 1 in
2401 def POST_STbri_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2402 (ins IntRegs:$src1, IntRegs:$src2, s4_0Imm:$offset),
2403 "memb($src2++#$offset) = $src1.new",
2408 // memb(Rx++#s4:0:circ(Mu))=Nt.new
2409 // memb(Rx++I:circ(Mu))=Nt.new
2410 // memb(Rx++Mu)=Nt.new
2411 // memb(Rx++Mu:brev)=Nt.new
2413 // memb(gp+#u16:0)=Nt.new
2414 let mayStore = 1, neverHasSideEffects = 1 in
2415 def STrib_GP_nv_V4 : NVInst_V4<(outs),
2416 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
2417 "memb(#$global+$offset) = $src.new",
2421 // memb(#global)=Nt.new
2422 let mayStore = 1, neverHasSideEffects = 1 in
2423 def STb_GP_nv_V4 : NVInst_V4<(outs),
2424 (ins globaladdress:$global, IntRegs:$src),
2425 "memb(#$global) = $src.new",
2429 // Store new-value byte conditionally.
2430 // if ([!]Pv[.new]) memb(#u6)=Nt.new
2431 // if (Pv) memb(Rs+#u6:0)=Nt.new
2432 let mayStore = 1, neverHasSideEffects = 1,
2434 def STrib_cPt_nv_V4 : NVInst_V4<(outs),
2435 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2436 "if ($src1) memb($addr) = $src2.new",
2440 // if (Pv.new) memb(Rs+#u6:0)=Nt.new
2441 let mayStore = 1, neverHasSideEffects = 1,
2443 def STrib_cdnPt_nv_V4 : NVInst_V4<(outs),
2444 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2445 "if ($src1.new) memb($addr) = $src2.new",
2449 // if (!Pv) memb(Rs+#u6:0)=Nt.new
2450 let mayStore = 1, neverHasSideEffects = 1,
2452 def STrib_cNotPt_nv_V4 : NVInst_V4<(outs),
2453 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2454 "if (!$src1) memb($addr) = $src2.new",
2458 // if (!Pv.new) memb(Rs+#u6:0)=Nt.new
2459 let mayStore = 1, neverHasSideEffects = 1,
2461 def STrib_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2462 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2463 "if (!$src1.new) memb($addr) = $src2.new",
2467 // if (Pv) memb(Rs+#u6:0)=Nt.new
2468 let mayStore = 1, neverHasSideEffects = 1,
2470 def STrib_indexed_cPt_nv_V4 : NVInst_V4<(outs),
2471 (ins PredRegs:$src1, IntRegs:$src2, u6_0Imm:$src3, IntRegs:$src4),
2472 "if ($src1) memb($src2+#$src3) = $src4.new",
2476 // if (Pv.new) memb(Rs+#u6:0)=Nt.new
2477 let mayStore = 1, neverHasSideEffects = 1,
2479 def STrib_indexed_cdnPt_nv_V4 : NVInst_V4<(outs),
2480 (ins PredRegs:$src1, IntRegs:$src2, u6_0Imm:$src3, IntRegs:$src4),
2481 "if ($src1.new) memb($src2+#$src3) = $src4.new",
2485 // if (!Pv) memb(Rs+#u6:0)=Nt.new
2486 let mayStore = 1, neverHasSideEffects = 1,
2488 def STrib_indexed_cNotPt_nv_V4 : NVInst_V4<(outs),
2489 (ins PredRegs:$src1, IntRegs:$src2, u6_0Imm:$src3, IntRegs:$src4),
2490 "if (!$src1) memb($src2+#$src3) = $src4.new",
2494 // if (!Pv.new) memb(Rs+#u6:0)=Nt.new
2495 let mayStore = 1, neverHasSideEffects = 1,
2497 def STrib_indexed_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2498 (ins PredRegs:$src1, IntRegs:$src2, u6_0Imm:$src3, IntRegs:$src4),
2499 "if (!$src1.new) memb($src2+#$src3) = $src4.new",
2503 // if ([!]Pv[.new]) memb(Rx++#s4:0)=Nt.new
2504 // if (Pv) memb(Rx++#s4:0)=Nt.new
2505 let mayStore = 1, hasCtrlDep = 1,
2507 def POST_STbri_cPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2508 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_0Imm:$offset),
2509 "if ($src1) memb($src3++#$offset) = $src2.new",
2513 // if (Pv.new) memb(Rx++#s4:0)=Nt.new
2514 let mayStore = 1, hasCtrlDep = 1,
2516 def POST_STbri_cdnPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2517 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_0Imm:$offset),
2518 "if ($src1.new) memb($src3++#$offset) = $src2.new",
2522 // if (!Pv) memb(Rx++#s4:0)=Nt.new
2523 let mayStore = 1, hasCtrlDep = 1,
2525 def POST_STbri_cNotPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2526 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_0Imm:$offset),
2527 "if (!$src1) memb($src3++#$offset) = $src2.new",
2531 // if (!Pv.new) memb(Rx++#s4:0)=Nt.new
2532 let mayStore = 1, hasCtrlDep = 1,
2534 def POST_STbri_cdnNotPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2535 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_0Imm:$offset),
2536 "if (!$src1.new) memb($src3++#$offset) = $src2.new",
2541 // Store new-value halfword.
2542 // memh(Re=#U6)=Nt.new
2543 // memh(Rs+#s11:1)=Nt.new
2544 let mayStore = 1, isPredicable = 1 in
2545 def STrih_nv_V4 : NVInst_V4<(outs), (ins MEMri:$addr, IntRegs:$src1),
2546 "memh($addr) = $src1.new",
2550 let mayStore = 1, isPredicable = 1 in
2551 def STrih_indexed_nv_V4 : NVInst_V4<(outs),
2552 (ins IntRegs:$src1, s11_1Imm:$src2, IntRegs:$src3),
2553 "memh($src1+#$src2) = $src3.new",
2557 // memh(Ru<<#u2+#U6)=Nt.new
2558 let mayStore = 1, AddedComplexity = 10 in
2559 def STrih_shl_nv_V4 : NVInst_V4<(outs),
2560 (ins IntRegs:$src1, u2Imm:$src2, u6Imm:$src3, IntRegs:$src4),
2561 "memh($src1<<#$src2+#$src3) = $src4.new",
2565 // memh(Rx++#s4:1)=Nt.new
2566 let mayStore = 1, hasCtrlDep = 1, isPredicable = 1 in
2567 def POST_SThri_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2568 (ins IntRegs:$src1, IntRegs:$src2, s4_1Imm:$offset),
2569 "memh($src2++#$offset) = $src1.new",
2574 // memh(Rx++#s4:1:circ(Mu))=Nt.new
2575 // memh(Rx++I:circ(Mu))=Nt.new
2576 // memh(Rx++Mu)=Nt.new
2577 // memh(Rx++Mu:brev)=Nt.new
2579 // memh(gp+#u16:1)=Nt.new
2580 let mayStore = 1, neverHasSideEffects = 1 in
2581 def STrih_GP_nv_V4 : NVInst_V4<(outs),
2582 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
2583 "memh(#$global+$offset) = $src.new",
2587 // memh(#global)=Nt.new
2588 let mayStore = 1, neverHasSideEffects = 1 in
2589 def STh_GP_nv_V4 : NVInst_V4<(outs),
2590 (ins globaladdress:$global, IntRegs:$src),
2591 "memh(#$global) = $src.new",
2596 // Store new-value halfword conditionally.
2598 // if ([!]Pv[.new]) memh(#u6)=Nt.new
2600 // if ([!]Pv[.new]) memh(Rs+#u6:1)=Nt.new
2601 // if (Pv) memh(Rs+#u6:1)=Nt.new
2602 let mayStore = 1, neverHasSideEffects = 1,
2604 def STrih_cPt_nv_V4 : NVInst_V4<(outs),
2605 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2606 "if ($src1) memh($addr) = $src2.new",
2610 // if (Pv.new) memh(Rs+#u6:1)=Nt.new
2611 let mayStore = 1, neverHasSideEffects = 1,
2613 def STrih_cdnPt_nv_V4 : NVInst_V4<(outs),
2614 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2615 "if ($src1.new) memh($addr) = $src2.new",
2619 // if (!Pv) memh(Rs+#u6:1)=Nt.new
2620 let mayStore = 1, neverHasSideEffects = 1,
2622 def STrih_cNotPt_nv_V4 : NVInst_V4<(outs),
2623 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2624 "if (!$src1) memh($addr) = $src2.new",
2628 // if (!Pv.new) memh(Rs+#u6:1)=Nt.new
2629 let mayStore = 1, neverHasSideEffects = 1,
2631 def STrih_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2632 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2633 "if (!$src1.new) memh($addr) = $src2.new",
2637 // if (Pv) memh(Rs+#u6:1)=Nt.new
2638 let mayStore = 1, neverHasSideEffects = 1,
2640 def STrih_indexed_cPt_nv_V4 : NVInst_V4<(outs),
2641 (ins PredRegs:$src1, IntRegs:$src2, u6_1Imm:$src3, IntRegs:$src4),
2642 "if ($src1) memh($src2+#$src3) = $src4.new",
2646 // if (Pv.new) memh(Rs+#u6:1)=Nt.new
2647 let mayStore = 1, neverHasSideEffects = 1,
2649 def STrih_indexed_cdnPt_nv_V4 : NVInst_V4<(outs),
2650 (ins PredRegs:$src1, IntRegs:$src2, u6_1Imm:$src3, IntRegs:$src4),
2651 "if ($src1.new) memh($src2+#$src3) = $src4.new",
2655 // if (!Pv) memh(Rs+#u6:1)=Nt.new
2656 let mayStore = 1, neverHasSideEffects = 1,
2658 def STrih_indexed_cNotPt_nv_V4 : NVInst_V4<(outs),
2659 (ins PredRegs:$src1, IntRegs:$src2, u6_1Imm:$src3, IntRegs:$src4),
2660 "if (!$src1) memh($src2+#$src3) = $src4.new",
2664 // if (!Pv.new) memh(Rs+#u6:1)=Nt.new
2665 let mayStore = 1, neverHasSideEffects = 1,
2667 def STrih_indexed_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2668 (ins PredRegs:$src1, IntRegs:$src2, u6_1Imm:$src3, IntRegs:$src4),
2669 "if (!$src1.new) memh($src2+#$src3) = $src4.new",
2673 // if ([!]Pv[]) memh(Rx++#s4:1)=Nt.new
2674 // if (Pv) memh(Rx++#s4:1)=Nt.new
2675 let mayStore = 1, hasCtrlDep = 1,
2677 def POST_SThri_cPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2678 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_1Imm:$offset),
2679 "if ($src1) memh($src3++#$offset) = $src2.new",
2683 // if (Pv.new) memh(Rx++#s4:1)=Nt.new
2684 let mayStore = 1, hasCtrlDep = 1,
2686 def POST_SThri_cdnPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2687 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_1Imm:$offset),
2688 "if ($src1.new) memh($src3++#$offset) = $src2.new",
2692 // if (!Pv) memh(Rx++#s4:1)=Nt.new
2693 let mayStore = 1, hasCtrlDep = 1,
2695 def POST_SThri_cNotPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2696 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_1Imm:$offset),
2697 "if (!$src1) memh($src3++#$offset) = $src2.new",
2701 // if (!Pv.new) memh(Rx++#s4:1)=Nt.new
2702 let mayStore = 1, hasCtrlDep = 1,
2704 def POST_SThri_cdnNotPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2705 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_1Imm:$offset),
2706 "if (!$src1.new) memh($src3++#$offset) = $src2.new",
2711 // Store new-value word.
2713 // memw(Re=#U6)=Nt.new
2714 // memw(Rs+#s11:2)=Nt.new
2715 let mayStore = 1, isPredicable = 1 in
2716 def STriw_nv_V4 : NVInst_V4<(outs),
2717 (ins MEMri:$addr, IntRegs:$src1),
2718 "memw($addr) = $src1.new",
2722 let mayStore = 1, isPredicable = 1 in
2723 def STriw_indexed_nv_V4 : NVInst_V4<(outs),
2724 (ins IntRegs:$src1, s11_2Imm:$src2, IntRegs:$src3),
2725 "memw($src1+#$src2) = $src3.new",
2729 // memw(Ru<<#u2+#U6)=Nt.new
2730 let mayStore = 1, AddedComplexity = 10 in
2731 def STriw_shl_nv_V4 : NVInst_V4<(outs),
2732 (ins IntRegs:$src1, u2Imm:$src2, u6Imm:$src3, IntRegs:$src4),
2733 "memw($src1<<#$src2+#$src3) = $src4.new",
2737 // memw(Rx++#s4:2)=Nt.new
2738 let mayStore = 1, hasCtrlDep = 1, isPredicable = 1 in
2739 def POST_STwri_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2740 (ins IntRegs:$src1, IntRegs:$src2, s4_2Imm:$offset),
2741 "memw($src2++#$offset) = $src1.new",
2746 // memw(Rx++#s4:2:circ(Mu))=Nt.new
2747 // memw(Rx++I:circ(Mu))=Nt.new
2748 // memw(Rx++Mu)=Nt.new
2749 // memw(Rx++Mu:brev)=Nt.new
2750 // memw(gp+#u16:2)=Nt.new
2751 let mayStore = 1, neverHasSideEffects = 1 in
2752 def STriw_GP_nv_V4 : NVInst_V4<(outs),
2753 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
2754 "memw(#$global+$offset) = $src.new",
2758 let mayStore = 1, neverHasSideEffects = 1 in
2759 def STw_GP_nv_V4 : NVInst_V4<(outs),
2760 (ins globaladdress:$global, IntRegs:$src),
2761 "memw(#$global) = $src.new",
2765 // Store new-value word conditionally.
2767 // if ([!]Pv[.new]) memw(#u6)=Nt.new
2769 // if ([!]Pv[.new]) memw(Rs+#u6:2)=Nt.new
2770 // if (Pv) memw(Rs+#u6:2)=Nt.new
2771 let mayStore = 1, neverHasSideEffects = 1,
2773 def STriw_cPt_nv_V4 : NVInst_V4<(outs),
2774 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2775 "if ($src1) memw($addr) = $src2.new",
2779 // if (Pv.new) memw(Rs+#u6:2)=Nt.new
2780 let mayStore = 1, neverHasSideEffects = 1,
2782 def STriw_cdnPt_nv_V4 : NVInst_V4<(outs),
2783 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2784 "if ($src1.new) memw($addr) = $src2.new",
2788 // if (!Pv) memw(Rs+#u6:2)=Nt.new
2789 let mayStore = 1, neverHasSideEffects = 1,
2791 def STriw_cNotPt_nv_V4 : NVInst_V4<(outs),
2792 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2793 "if (!$src1) memw($addr) = $src2.new",
2797 // if (!Pv.new) memw(Rs+#u6:2)=Nt.new
2798 let mayStore = 1, neverHasSideEffects = 1,
2800 def STriw_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2801 (ins PredRegs:$src1, MEMri:$addr, IntRegs:$src2),
2802 "if (!$src1.new) memw($addr) = $src2.new",
2806 // if (Pv) memw(Rs+#u6:2)=Nt.new
2807 let mayStore = 1, neverHasSideEffects = 1,
2809 def STriw_indexed_cPt_nv_V4 : NVInst_V4<(outs),
2810 (ins PredRegs:$src1, IntRegs:$src2, u6_2Imm:$src3, IntRegs:$src4),
2811 "if ($src1) memw($src2+#$src3) = $src4.new",
2815 // if (Pv.new) memw(Rs+#u6:2)=Nt.new
2816 let mayStore = 1, neverHasSideEffects = 1,
2818 def STriw_indexed_cdnPt_nv_V4 : NVInst_V4<(outs),
2819 (ins PredRegs:$src1, IntRegs:$src2, u6_2Imm:$src3, IntRegs:$src4),
2820 "if ($src1.new) memw($src2+#$src3) = $src4.new",
2824 // if (!Pv) memw(Rs+#u6:2)=Nt.new
2825 let mayStore = 1, neverHasSideEffects = 1,
2827 def STriw_indexed_cNotPt_nv_V4 : NVInst_V4<(outs),
2828 (ins PredRegs:$src1, IntRegs:$src2, u6_2Imm:$src3, IntRegs:$src4),
2829 "if (!$src1) memw($src2+#$src3) = $src4.new",
2833 // if (!Pv.new) memw(Rs+#u6:2)=Nt.new
2834 let mayStore = 1, neverHasSideEffects = 1,
2836 def STriw_indexed_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2837 (ins PredRegs:$src1, IntRegs:$src2, u6_2Imm:$src3, IntRegs:$src4),
2838 "if (!$src1.new) memw($src2+#$src3) = $src4.new",
2842 // if ([!]Pv[.new]) memw(Rx++#s4:2)=Nt.new
2843 // if (Pv) memw(Rx++#s4:2)=Nt.new
2844 let mayStore = 1, hasCtrlDep = 1,
2846 def POST_STwri_cPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2847 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_2Imm:$offset),
2848 "if ($src1) memw($src3++#$offset) = $src2.new",
2852 // if (Pv.new) memw(Rx++#s4:2)=Nt.new
2853 let mayStore = 1, hasCtrlDep = 1,
2855 def POST_STwri_cdnPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2856 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_2Imm:$offset),
2857 "if ($src1.new) memw($src3++#$offset) = $src2.new",
2861 // if (!Pv) memw(Rx++#s4:2)=Nt.new
2862 let mayStore = 1, hasCtrlDep = 1,
2864 def POST_STwri_cNotPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2865 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_2Imm:$offset),
2866 "if (!$src1) memw($src3++#$offset) = $src2.new",
2870 // if (!Pv.new) memw(Rx++#s4:2)=Nt.new
2871 let mayStore = 1, hasCtrlDep = 1,
2873 def POST_STwri_cdnNotPt_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2874 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, s4_2Imm:$offset),
2875 "if (!$src1.new) memw($src3++#$offset) = $src2.new",
2881 // if (Pv) memb(##global) = Rt
2882 let mayStore = 1, neverHasSideEffects = 1 in
2883 def STb_GP_cPt_nv_V4 : NVInst_V4<(outs),
2884 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2885 "if ($src1) memb(##$global) = $src2.new",
2889 // if (!Pv) memb(##global) = Rt
2890 let mayStore = 1, neverHasSideEffects = 1 in
2891 def STb_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
2892 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2893 "if (!$src1) memb(##$global) = $src2.new",
2897 // if (Pv) memb(##global) = Rt
2898 let mayStore = 1, neverHasSideEffects = 1 in
2899 def STb_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
2900 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2901 "if ($src1.new) memb(##$global) = $src2.new",
2905 // if (!Pv) memb(##global) = Rt
2906 let mayStore = 1, neverHasSideEffects = 1 in
2907 def STb_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2908 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2909 "if (!$src1.new) memb(##$global) = $src2.new",
2913 // if (Pv) memh(##global) = Rt
2914 let mayStore = 1, neverHasSideEffects = 1 in
2915 def STh_GP_cPt_nv_V4 : NVInst_V4<(outs),
2916 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2917 "if ($src1) memh(##$global) = $src2.new",
2921 // if (!Pv) memh(##global) = Rt
2922 let mayStore = 1, neverHasSideEffects = 1 in
2923 def STh_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
2924 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2925 "if (!$src1) memh(##$global) = $src2.new",
2929 // if (Pv) memh(##global) = Rt
2930 let mayStore = 1, neverHasSideEffects = 1 in
2931 def STh_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
2932 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2933 "if ($src1.new) memh(##$global) = $src2.new",
2937 // if (!Pv) memh(##global) = Rt
2938 let mayStore = 1, neverHasSideEffects = 1 in
2939 def STh_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2940 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2941 "if (!$src1.new) memh(##$global) = $src2.new",
2945 // if (Pv) memw(##global) = Rt
2946 let mayStore = 1, neverHasSideEffects = 1 in
2947 def STw_GP_cPt_nv_V4 : NVInst_V4<(outs),
2948 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2949 "if ($src1) memw(##$global) = $src2.new",
2953 // if (!Pv) memw(##global) = Rt
2954 let mayStore = 1, neverHasSideEffects = 1 in
2955 def STw_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
2956 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2957 "if (!$src1) memw(##$global) = $src2.new",
2961 // if (Pv) memw(##global) = Rt
2962 let mayStore = 1, neverHasSideEffects = 1 in
2963 def STw_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
2964 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2965 "if ($src1.new) memw(##$global) = $src2.new",
2969 // if (!Pv) memw(##global) = Rt
2970 let mayStore = 1, neverHasSideEffects = 1 in
2971 def STw_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2972 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2973 "if (!$src1.new) memw(##$global) = $src2.new",
2977 let mayStore = 1, neverHasSideEffects = 1 in
2978 def STrib_GP_cPt_nv_V4 : NVInst_V4<(outs),
2979 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2981 "if ($src1) memb(##$global+$offset) = $src2.new",
2985 let mayStore = 1, neverHasSideEffects = 1 in
2986 def STrib_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
2987 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2989 "if (!$src1) memb(##$global+$offset) = $src2.new",
2993 let mayStore = 1, neverHasSideEffects = 1 in
2994 def STrib_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
2995 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2997 "if ($src1.new) memb(##$global+$offset) = $src2.new",
3001 let mayStore = 1, neverHasSideEffects = 1 in
3002 def STrib_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
3003 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
3005 "if (!$src1.new) memb(##$global+$offset) = $src2.new",
3009 let mayStore = 1, neverHasSideEffects = 1 in
3010 def STrih_GP_cPt_nv_V4 : NVInst_V4<(outs),
3011 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
3013 "if ($src1) memh(##$global+$offset) = $src2.new",
3017 let mayStore = 1, neverHasSideEffects = 1 in
3018 def STrih_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
3019 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
3021 "if (!$src1) memh(##$global+$offset) = $src2.new",
3025 let mayStore = 1, neverHasSideEffects = 1 in
3026 def STrih_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
3027 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
3029 "if ($src1.new) memh(##$global+$offset) = $src2.new",
3033 let mayStore = 1, neverHasSideEffects = 1 in
3034 def STrih_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
3035 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
3037 "if (!$src1.new) memh(##$global+$offset) = $src2.new",
3041 let mayStore = 1, neverHasSideEffects = 1 in
3042 def STriw_GP_cPt_nv_V4 : NVInst_V4<(outs),
3043 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
3045 "if ($src1) memw(##$global+$offset) = $src2.new",
3049 let mayStore = 1, neverHasSideEffects = 1 in
3050 def STriw_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
3051 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
3053 "if (!$src1) memw(##$global+$offset) = $src2.new",
3057 let mayStore = 1, neverHasSideEffects = 1 in
3058 def STriw_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
3059 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
3061 "if ($src1.new) memw(##$global+$offset) = $src2.new",
3065 let mayStore = 1, neverHasSideEffects = 1 in
3066 def STriw_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
3067 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
3069 "if (!$src1.new) memw(##$global+$offset) = $src2.new",
3073 //===----------------------------------------------------------------------===//
3075 //===----------------------------------------------------------------------===//
3077 //===----------------------------------------------------------------------===//
3079 //===----------------------------------------------------------------------===//
3081 multiclass NVJ_type_basic_reg<string NotStr, string OpcStr, string TakenStr> {
3082 def _ie_nv_V4 : NVInst_V4<(outs),
3083 (ins IntRegs:$src1, IntRegs:$src2, brtarget:$offset),
3084 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
3085 !strconcat("($src1.new, $src2)) jump:",
3086 !strconcat(TakenStr, " $offset"))))),
3090 def _nv_V4 : NVInst_V4<(outs),
3091 (ins IntRegs:$src1, IntRegs:$src2, brtarget:$offset),
3092 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
3093 !strconcat("($src1.new, $src2)) jump:",
3094 !strconcat(TakenStr, " $offset"))))),
3099 multiclass NVJ_type_basic_2ndDotNew<string NotStr, string OpcStr,
3101 def _ie_nv_V4 : NVInst_V4<(outs),
3102 (ins IntRegs:$src1, IntRegs:$src2, brtarget:$offset),
3103 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
3104 !strconcat("($src1, $src2.new)) jump:",
3105 !strconcat(TakenStr, " $offset"))))),
3109 def _nv_V4 : NVInst_V4<(outs),
3110 (ins IntRegs:$src1, IntRegs:$src2, brtarget:$offset),
3111 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
3112 !strconcat("($src1, $src2.new)) jump:",
3113 !strconcat(TakenStr, " $offset"))))),
3118 multiclass NVJ_type_basic_imm<string NotStr, string OpcStr, string TakenStr> {
3119 def _ie_nv_V4 : NVInst_V4<(outs),
3120 (ins IntRegs:$src1, u5Imm:$src2, brtarget:$offset),
3121 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
3122 !strconcat("($src1.new, #$src2)) jump:",
3123 !strconcat(TakenStr, " $offset"))))),
3127 def _nv_V4 : NVInst_V4<(outs),
3128 (ins IntRegs:$src1, u5Imm:$src2, brtarget:$offset),
3129 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
3130 !strconcat("($src1.new, #$src2)) jump:",
3131 !strconcat(TakenStr, " $offset"))))),
3136 multiclass NVJ_type_basic_neg<string NotStr, string OpcStr, string TakenStr> {
3137 def _ie_nv_V4 : NVInst_V4<(outs),
3138 (ins IntRegs:$src1, nOneImm:$src2, brtarget:$offset),
3139 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
3140 !strconcat("($src1.new, #$src2)) jump:",
3141 !strconcat(TakenStr, " $offset"))))),
3145 def _nv_V4 : NVInst_V4<(outs),
3146 (ins IntRegs:$src1, nOneImm:$src2, brtarget:$offset),
3147 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
3148 !strconcat("($src1.new, #$src2)) jump:",
3149 !strconcat(TakenStr, " $offset"))))),
3154 multiclass NVJ_type_basic_tstbit<string NotStr, string OpcStr,
3156 def _ie_nv_V4 : NVInst_V4<(outs),
3157 (ins IntRegs:$src1, u1Imm:$src2, brtarget:$offset),
3158 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
3159 !strconcat("($src1.new, #$src2)) jump:",
3160 !strconcat(TakenStr, " $offset"))))),
3164 def _nv_V4 : NVInst_V4<(outs),
3165 (ins IntRegs:$src1, u1Imm:$src2, brtarget:$offset),
3166 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
3167 !strconcat("($src1.new, #$src2)) jump:",
3168 !strconcat(TakenStr, " $offset"))))),
3173 // Multiclass for regular dot new of Ist operand register.
3174 multiclass NVJ_type_br_pred_reg<string NotStr, string OpcStr> {
3175 defm Pt : NVJ_type_basic_reg<NotStr, OpcStr, "t">;
3176 defm Pnt : NVJ_type_basic_reg<NotStr, OpcStr, "nt">;
3179 // Multiclass for dot new of 2nd operand register.
3180 multiclass NVJ_type_br_pred_2ndDotNew<string NotStr, string OpcStr> {
3181 defm Pt : NVJ_type_basic_2ndDotNew<NotStr, OpcStr, "t">;
3182 defm Pnt : NVJ_type_basic_2ndDotNew<NotStr, OpcStr, "nt">;
3185 // Multiclass for 2nd operand immediate, including -1.
3186 multiclass NVJ_type_br_pred_imm<string NotStr, string OpcStr> {
3187 defm Pt : NVJ_type_basic_imm<NotStr, OpcStr, "t">;
3188 defm Pnt : NVJ_type_basic_imm<NotStr, OpcStr, "nt">;
3189 defm Ptneg : NVJ_type_basic_neg<NotStr, OpcStr, "t">;
3190 defm Pntneg : NVJ_type_basic_neg<NotStr, OpcStr, "nt">;
3193 // Multiclass for 2nd operand immediate, excluding -1.
3194 multiclass NVJ_type_br_pred_imm_only<string NotStr, string OpcStr> {
3195 defm Pt : NVJ_type_basic_imm<NotStr, OpcStr, "t">;
3196 defm Pnt : NVJ_type_basic_imm<NotStr, OpcStr, "nt">;
3199 // Multiclass for tstbit, where 2nd operand is always #0.
3200 multiclass NVJ_type_br_pred_tstbit<string NotStr, string OpcStr> {
3201 defm Pt : NVJ_type_basic_tstbit<NotStr, OpcStr, "t">;
3202 defm Pnt : NVJ_type_basic_tstbit<NotStr, OpcStr, "nt">;
3205 // Multiclass for GT.
3206 multiclass NVJ_type_rr_ri<string OpcStr> {
3207 defm rrNot : NVJ_type_br_pred_reg<"!", OpcStr>;
3208 defm rr : NVJ_type_br_pred_reg<"", OpcStr>;
3209 defm rrdnNot : NVJ_type_br_pred_2ndDotNew<"!", OpcStr>;
3210 defm rrdn : NVJ_type_br_pred_2ndDotNew<"", OpcStr>;
3211 defm riNot : NVJ_type_br_pred_imm<"!", OpcStr>;
3212 defm ri : NVJ_type_br_pred_imm<"", OpcStr>;
3215 // Multiclass for EQ.
3216 multiclass NVJ_type_rr_ri_no_2ndDotNew<string OpcStr> {
3217 defm rrNot : NVJ_type_br_pred_reg<"!", OpcStr>;
3218 defm rr : NVJ_type_br_pred_reg<"", OpcStr>;
3219 defm riNot : NVJ_type_br_pred_imm<"!", OpcStr>;
3220 defm ri : NVJ_type_br_pred_imm<"", OpcStr>;
3223 // Multiclass for GTU.
3224 multiclass NVJ_type_rr_ri_no_nOne<string OpcStr> {
3225 defm rrNot : NVJ_type_br_pred_reg<"!", OpcStr>;
3226 defm rr : NVJ_type_br_pred_reg<"", OpcStr>;
3227 defm rrdnNot : NVJ_type_br_pred_2ndDotNew<"!", OpcStr>;
3228 defm rrdn : NVJ_type_br_pred_2ndDotNew<"", OpcStr>;
3229 defm riNot : NVJ_type_br_pred_imm_only<"!", OpcStr>;
3230 defm ri : NVJ_type_br_pred_imm_only<"", OpcStr>;
3233 // Multiclass for tstbit.
3234 multiclass NVJ_type_r0<string OpcStr> {
3235 defm r0Not : NVJ_type_br_pred_tstbit<"!", OpcStr>;
3236 defm r0 : NVJ_type_br_pred_tstbit<"", OpcStr>;
3239 // Base Multiclass for New Value Jump.
3240 multiclass NVJ_type {
3241 defm GT : NVJ_type_rr_ri<"cmp.gt">;
3242 defm EQ : NVJ_type_rr_ri_no_2ndDotNew<"cmp.eq">;
3243 defm GTU : NVJ_type_rr_ri_no_nOne<"cmp.gtu">;
3244 defm TSTBIT : NVJ_type_r0<"tstbit">;
3247 let isBranch = 1, isTerminator=1, neverHasSideEffects = 1, Defs = [PC] in {
3248 defm JMP_ : NVJ_type;
3251 //===----------------------------------------------------------------------===//
3253 //===----------------------------------------------------------------------===//
3255 //===----------------------------------------------------------------------===//
3257 //===----------------------------------------------------------------------===//
3259 // Add and accumulate.
3260 // Rd=add(Rs,add(Ru,#s6))
3261 def ADDr_ADDri_V4 : MInst<(outs IntRegs:$dst),
3262 (ins IntRegs:$src1, IntRegs:$src2, s6Imm:$src3),
3263 "$dst = add($src1, add($src2, #$src3))",
3264 [(set (i32 IntRegs:$dst),
3265 (add (i32 IntRegs:$src1), (add (i32 IntRegs:$src2),
3266 s6ImmPred:$src3)))]>,
3269 // Rd=add(Rs,sub(#s6,Ru))
3270 def ADDr_SUBri_V4 : MInst<(outs IntRegs:$dst),
3271 (ins IntRegs:$src1, s6Imm:$src2, IntRegs:$src3),
3272 "$dst = add($src1, sub(#$src2, $src3))",
3273 [(set (i32 IntRegs:$dst),
3274 (add (i32 IntRegs:$src1), (sub s6ImmPred:$src2,
3275 (i32 IntRegs:$src3))))]>,
3278 // Generates the same instruction as ADDr_SUBri_V4 but matches different
3280 // Rd=add(Rs,sub(#s6,Ru))
3281 def ADDri_SUBr_V4 : MInst<(outs IntRegs:$dst),
3282 (ins IntRegs:$src1, s6Imm:$src2, IntRegs:$src3),
3283 "$dst = add($src1, sub(#$src2, $src3))",
3284 [(set (i32 IntRegs:$dst),
3285 (sub (add (i32 IntRegs:$src1), s6ImmPred:$src2),
3286 (i32 IntRegs:$src3)))]>,
3290 // Add or subtract doublewords with carry.
3292 // Rdd=add(Rss,Rtt,Px):carry
3294 // Rdd=sub(Rss,Rtt,Px):carry
3297 // Logical doublewords.
3298 // Rdd=and(Rtt,~Rss)
3299 def ANDd_NOTd_V4 : MInst<(outs DoubleRegs:$dst),
3300 (ins DoubleRegs:$src1, DoubleRegs:$src2),
3301 "$dst = and($src1, ~$src2)",
3302 [(set (i64 DoubleRegs:$dst), (and (i64 DoubleRegs:$src1),
3303 (not (i64 DoubleRegs:$src2))))]>,
3307 def ORd_NOTd_V4 : MInst<(outs DoubleRegs:$dst),
3308 (ins DoubleRegs:$src1, DoubleRegs:$src2),
3309 "$dst = or($src1, ~$src2)",
3310 [(set (i64 DoubleRegs:$dst),
3311 (or (i64 DoubleRegs:$src1), (not (i64 DoubleRegs:$src2))))]>,
3315 // Logical-logical doublewords.
3316 // Rxx^=xor(Rss,Rtt)
3317 def XORd_XORdd: MInst_acc<(outs DoubleRegs:$dst),
3318 (ins DoubleRegs:$src1, DoubleRegs:$src2, DoubleRegs:$src3),
3319 "$dst ^= xor($src2, $src3)",
3320 [(set (i64 DoubleRegs:$dst),
3321 (xor (i64 DoubleRegs:$src1), (xor (i64 DoubleRegs:$src2),
3322 (i64 DoubleRegs:$src3))))],
3327 // Logical-logical words.
3328 // Rx=or(Ru,and(Rx,#s10))
3329 def ORr_ANDri_V4 : MInst_acc<(outs IntRegs:$dst),
3330 (ins IntRegs:$src1, IntRegs: $src2, s10Imm:$src3),
3331 "$dst = or($src1, and($src2, #$src3))",
3332 [(set (i32 IntRegs:$dst),
3333 (or (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
3334 s10ImmPred:$src3)))],
3338 // Rx[&|^]=and(Rs,Rt)
3340 def ANDr_ANDrr_V4 : MInst_acc<(outs IntRegs:$dst),
3341 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3342 "$dst &= and($src2, $src3)",
3343 [(set (i32 IntRegs:$dst),
3344 (and (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
3345 (i32 IntRegs:$src3))))],
3350 def ORr_ANDrr_V4 : MInst_acc<(outs IntRegs:$dst),
3351 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3352 "$dst |= and($src2, $src3)",
3353 [(set (i32 IntRegs:$dst),
3354 (or (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
3355 (i32 IntRegs:$src3))))],
3360 def XORr_ANDrr_V4 : MInst_acc<(outs IntRegs:$dst),
3361 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3362 "$dst ^= and($src2, $src3)",
3363 [(set (i32 IntRegs:$dst),
3364 (xor (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
3365 (i32 IntRegs:$src3))))],
3369 // Rx[&|^]=and(Rs,~Rt)
3371 def ANDr_ANDr_NOTr_V4 : MInst_acc<(outs IntRegs:$dst),
3372 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3373 "$dst &= and($src2, ~$src3)",
3374 [(set (i32 IntRegs:$dst),
3375 (and (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
3376 (not (i32 IntRegs:$src3)))))],
3381 def ORr_ANDr_NOTr_V4 : MInst_acc<(outs IntRegs:$dst),
3382 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3383 "$dst |= and($src2, ~$src3)",
3384 [(set (i32 IntRegs:$dst),
3385 (or (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
3386 (not (i32 IntRegs:$src3)))))],
3391 def XORr_ANDr_NOTr_V4 : MInst_acc<(outs IntRegs:$dst),
3392 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3393 "$dst ^= and($src2, ~$src3)",
3394 [(set (i32 IntRegs:$dst),
3395 (xor (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
3396 (not (i32 IntRegs:$src3)))))],
3400 // Rx[&|^]=or(Rs,Rt)
3402 def ANDr_ORrr_V4 : MInst_acc<(outs IntRegs:$dst),
3403 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3404 "$dst &= or($src2, $src3)",
3405 [(set (i32 IntRegs:$dst),
3406 (and (i32 IntRegs:$src1), (or (i32 IntRegs:$src2),
3407 (i32 IntRegs:$src3))))],
3412 def ORr_ORrr_V4 : MInst_acc<(outs IntRegs:$dst),
3413 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3414 "$dst |= or($src2, $src3)",
3415 [(set (i32 IntRegs:$dst),
3416 (or (i32 IntRegs:$src1), (or (i32 IntRegs:$src2),
3417 (i32 IntRegs:$src3))))],
3422 def XORr_ORrr_V4 : MInst_acc<(outs IntRegs:$dst),
3423 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3424 "$dst ^= or($src2, $src3)",
3425 [(set (i32 IntRegs:$dst),
3426 (xor (i32 IntRegs:$src1), (or (i32 IntRegs:$src2),
3427 (i32 IntRegs:$src3))))],
3431 // Rx[&|^]=xor(Rs,Rt)
3433 def ANDr_XORrr_V4 : MInst_acc<(outs IntRegs:$dst),
3434 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3435 "$dst &= xor($src2, $src3)",
3436 [(set (i32 IntRegs:$dst),
3437 (and (i32 IntRegs:$src1), (xor (i32 IntRegs:$src2),
3438 (i32 IntRegs:$src3))))],
3443 def ORr_XORrr_V4 : MInst_acc<(outs IntRegs:$dst),
3444 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3445 "$dst |= xor($src2, $src3)",
3446 [(set (i32 IntRegs:$dst),
3447 (and (i32 IntRegs:$src1), (xor (i32 IntRegs:$src2),
3448 (i32 IntRegs:$src3))))],
3453 def XORr_XORrr_V4 : MInst_acc<(outs IntRegs:$dst),
3454 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
3455 "$dst ^= xor($src2, $src3)",
3456 [(set (i32 IntRegs:$dst),
3457 (and (i32 IntRegs:$src1), (xor (i32 IntRegs:$src2),
3458 (i32 IntRegs:$src3))))],
3463 def ORr_ANDri2_V4 : MInst_acc<(outs IntRegs:$dst),
3464 (ins IntRegs:$src1, IntRegs: $src2, s10Imm:$src3),
3465 "$dst |= and($src2, #$src3)",
3466 [(set (i32 IntRegs:$dst),
3467 (or (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
3468 s10ImmPred:$src3)))],
3473 def ORr_ORri_V4 : MInst_acc<(outs IntRegs:$dst),
3474 (ins IntRegs:$src1, IntRegs: $src2, s10Imm:$src3),
3475 "$dst |= or($src2, #$src3)",
3476 [(set (i32 IntRegs:$dst),
3477 (or (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
3478 s10ImmPred:$src3)))],
3484 // Rd=modwrap(Rs,Rt)
3486 // Rd=cround(Rs,#u5)
3488 // Rd=round(Rs,#u5)[:sat]
3489 // Rd=round(Rs,Rt)[:sat]
3490 // Vector reduce add unsigned halfwords
3491 // Rd=vraddh(Rss,Rtt)
3493 // Rdd=vaddb(Rss,Rtt)
3494 // Vector conditional negate
3495 // Rdd=vcnegh(Rss,Rt)
3496 // Rxx+=vrcnegh(Rss,Rt)
3497 // Vector maximum bytes
3498 // Rdd=vmaxb(Rtt,Rss)
3499 // Vector reduce maximum halfwords
3500 // Rxx=vrmaxh(Rss,Ru)
3501 // Rxx=vrmaxuh(Rss,Ru)
3502 // Vector reduce maximum words
3503 // Rxx=vrmaxuw(Rss,Ru)
3504 // Rxx=vrmaxw(Rss,Ru)
3505 // Vector minimum bytes
3506 // Rdd=vminb(Rtt,Rss)
3507 // Vector reduce minimum halfwords
3508 // Rxx=vrminh(Rss,Ru)
3509 // Rxx=vrminuh(Rss,Ru)
3510 // Vector reduce minimum words
3511 // Rxx=vrminuw(Rss,Ru)
3512 // Rxx=vrminw(Rss,Ru)
3513 // Vector subtract bytes
3514 // Rdd=vsubb(Rss,Rtt)
3516 //===----------------------------------------------------------------------===//
3518 //===----------------------------------------------------------------------===//
3521 //===----------------------------------------------------------------------===//
3523 //===----------------------------------------------------------------------===//
3525 // Multiply and user lower result.
3526 // Rd=add(#u6,mpyi(Rs,#U6))
3527 def ADDi_MPYri_V4 : MInst<(outs IntRegs:$dst),
3528 (ins u6Imm:$src1, IntRegs:$src2, u6Imm:$src3),
3529 "$dst = add(#$src1, mpyi($src2, #$src3))",
3530 [(set (i32 IntRegs:$dst),
3531 (add (mul (i32 IntRegs:$src2), u6ImmPred:$src3),
3532 u6ImmPred:$src1))]>,
3535 // Rd=add(#u6,mpyi(Rs,Rt))
3537 def ADDi_MPYrr_V4 : MInst<(outs IntRegs:$dst),
3538 (ins u6Imm:$src1, IntRegs:$src2, IntRegs:$src3),
3539 "$dst = add(#$src1, mpyi($src2, $src3))",
3540 [(set (i32 IntRegs:$dst),
3541 (add (mul (i32 IntRegs:$src2), (i32 IntRegs:$src3)),
3542 u6ImmPred:$src1))]>,
3545 // Rd=add(Ru,mpyi(#u6:2,Rs))
3546 def ADDr_MPYir_V4 : MInst<(outs IntRegs:$dst),
3547 (ins IntRegs:$src1, u6Imm:$src2, IntRegs:$src3),
3548 "$dst = add($src1, mpyi(#$src2, $src3))",
3549 [(set (i32 IntRegs:$dst),
3550 (add (i32 IntRegs:$src1), (mul (i32 IntRegs:$src3),
3551 u6_2ImmPred:$src2)))]>,
3554 // Rd=add(Ru,mpyi(Rs,#u6))
3555 def ADDr_MPYri_V4 : MInst<(outs IntRegs:$dst),
3556 (ins IntRegs:$src1, IntRegs:$src2, u6Imm:$src3),
3557 "$dst = add($src1, mpyi($src2, #$src3))",
3558 [(set (i32 IntRegs:$dst),
3559 (add (i32 IntRegs:$src1), (mul (i32 IntRegs:$src2),
3560 u6ImmPred:$src3)))]>,
3563 // Rx=add(Ru,mpyi(Rx,Rs))
3564 def ADDr_MPYrr_V4 : MInst_acc<(outs IntRegs:$dst),
3565 (ins IntRegs:$src1, IntRegs:$src2, IntRegs:$src3),
3566 "$dst = add($src1, mpyi($src2, $src3))",
3567 [(set (i32 IntRegs:$dst),
3568 (add (i32 IntRegs:$src1), (mul (i32 IntRegs:$src2),
3569 (i32 IntRegs:$src3))))],
3574 // Polynomial multiply words
3576 // Rxx^=pmpyw(Rs,Rt)
3578 // Vector reduce multiply word by signed half (32x16)
3579 // Rdd=vrmpyweh(Rss,Rtt)[:<<1]
3580 // Rdd=vrmpywoh(Rss,Rtt)[:<<1]
3581 // Rxx+=vrmpyweh(Rss,Rtt)[:<<1]
3582 // Rxx+=vrmpywoh(Rss,Rtt)[:<<1]
3584 // Multiply and use upper result
3585 // Rd=mpy(Rs,Rt.H):<<1:sat
3586 // Rd=mpy(Rs,Rt.L):<<1:sat
3587 // Rd=mpy(Rs,Rt):<<1
3588 // Rd=mpy(Rs,Rt):<<1:sat
3590 // Rx+=mpy(Rs,Rt):<<1:sat
3591 // Rx-=mpy(Rs,Rt):<<1:sat
3593 // Vector multiply bytes
3594 // Rdd=vmpybsu(Rs,Rt)
3595 // Rdd=vmpybu(Rs,Rt)
3596 // Rxx+=vmpybsu(Rs,Rt)
3597 // Rxx+=vmpybu(Rs,Rt)
3599 // Vector polynomial multiply halfwords
3600 // Rdd=vpmpyh(Rs,Rt)
3601 // Rxx^=vpmpyh(Rs,Rt)
3603 //===----------------------------------------------------------------------===//
3605 //===----------------------------------------------------------------------===//
3608 //===----------------------------------------------------------------------===//
3610 //===----------------------------------------------------------------------===//
3612 // Shift by immediate and accumulate.
3613 // Rx=add(#u8,asl(Rx,#U5))
3614 def ADDi_ASLri_V4 : MInst_acc<(outs IntRegs:$dst),
3615 (ins u8Imm:$src1, IntRegs:$src2, u5Imm:$src3),
3616 "$dst = add(#$src1, asl($src2, #$src3))",
3617 [(set (i32 IntRegs:$dst),
3618 (add (shl (i32 IntRegs:$src2), u5ImmPred:$src3),
3623 // Rx=add(#u8,lsr(Rx,#U5))
3624 def ADDi_LSRri_V4 : MInst_acc<(outs IntRegs:$dst),
3625 (ins u8Imm:$src1, IntRegs:$src2, u5Imm:$src3),
3626 "$dst = add(#$src1, lsr($src2, #$src3))",
3627 [(set (i32 IntRegs:$dst),
3628 (add (srl (i32 IntRegs:$src2), u5ImmPred:$src3),
3633 // Rx=sub(#u8,asl(Rx,#U5))
3634 def SUBi_ASLri_V4 : MInst_acc<(outs IntRegs:$dst),
3635 (ins u8Imm:$src1, IntRegs:$src2, u5Imm:$src3),
3636 "$dst = sub(#$src1, asl($src2, #$src3))",
3637 [(set (i32 IntRegs:$dst),
3638 (sub (shl (i32 IntRegs:$src2), u5ImmPred:$src3),
3643 // Rx=sub(#u8,lsr(Rx,#U5))
3644 def SUBi_LSRri_V4 : MInst_acc<(outs IntRegs:$dst),
3645 (ins u8Imm:$src1, IntRegs:$src2, u5Imm:$src3),
3646 "$dst = sub(#$src1, lsr($src2, #$src3))",
3647 [(set (i32 IntRegs:$dst),
3648 (sub (srl (i32 IntRegs:$src2), u5ImmPred:$src3),
3654 //Shift by immediate and logical.
3655 //Rx=and(#u8,asl(Rx,#U5))
3656 def ANDi_ASLri_V4 : MInst_acc<(outs IntRegs:$dst),
3657 (ins u8Imm:$src1, IntRegs:$src2, u5Imm:$src3),
3658 "$dst = and(#$src1, asl($src2, #$src3))",
3659 [(set (i32 IntRegs:$dst),
3660 (and (shl (i32 IntRegs:$src2), u5ImmPred:$src3),
3665 //Rx=and(#u8,lsr(Rx,#U5))
3666 def ANDi_LSRri_V4 : MInst_acc<(outs IntRegs:$dst),
3667 (ins u8Imm:$src1, IntRegs:$src2, u5Imm:$src3),
3668 "$dst = and(#$src1, lsr($src2, #$src3))",
3669 [(set (i32 IntRegs:$dst),
3670 (and (srl (i32 IntRegs:$src2), u5ImmPred:$src3),
3675 //Rx=or(#u8,asl(Rx,#U5))
3676 let AddedComplexity = 30 in
3677 def ORi_ASLri_V4 : MInst_acc<(outs IntRegs:$dst),
3678 (ins u8Imm:$src1, IntRegs:$src2, u5Imm:$src3),
3679 "$dst = or(#$src1, asl($src2, #$src3))",
3680 [(set (i32 IntRegs:$dst),
3681 (or (shl (i32 IntRegs:$src2), u5ImmPred:$src3),
3686 //Rx=or(#u8,lsr(Rx,#U5))
3687 let AddedComplexity = 30 in
3688 def ORi_LSRri_V4 : MInst_acc<(outs IntRegs:$dst),
3689 (ins u8Imm:$src1, IntRegs:$src2, u5Imm:$src3),
3690 "$dst = or(#$src1, lsr($src2, #$src3))",
3691 [(set (i32 IntRegs:$dst),
3692 (or (srl (i32 IntRegs:$src2), u5ImmPred:$src3),
3698 //Shift by register.
3700 def LSLi_V4 : MInst<(outs IntRegs:$dst), (ins s6Imm:$src1, IntRegs:$src2),
3701 "$dst = lsl(#$src1, $src2)",
3702 [(set (i32 IntRegs:$dst), (shl s6ImmPred:$src1,
3703 (i32 IntRegs:$src2)))]>,
3707 //Shift by register and logical.
3709 def ASLd_rr_xor_V4 : MInst_acc<(outs DoubleRegs:$dst),
3710 (ins DoubleRegs:$src1, DoubleRegs:$src2, IntRegs:$src3),
3711 "$dst ^= asl($src2, $src3)",
3712 [(set (i64 DoubleRegs:$dst),
3713 (xor (i64 DoubleRegs:$src1), (shl (i64 DoubleRegs:$src2),
3714 (i32 IntRegs:$src3))))],
3719 def ASRd_rr_xor_V4 : MInst_acc<(outs DoubleRegs:$dst),
3720 (ins DoubleRegs:$src1, DoubleRegs:$src2, IntRegs:$src3),
3721 "$dst ^= asr($src2, $src3)",
3722 [(set (i64 DoubleRegs:$dst),
3723 (xor (i64 DoubleRegs:$src1), (sra (i64 DoubleRegs:$src2),
3724 (i32 IntRegs:$src3))))],
3729 def LSLd_rr_xor_V4 : MInst_acc<(outs DoubleRegs:$dst),
3730 (ins DoubleRegs:$src1, DoubleRegs:$src2, IntRegs:$src3),
3731 "$dst ^= lsl($src2, $src3)",
3732 [(set (i64 DoubleRegs:$dst), (xor (i64 DoubleRegs:$src1),
3733 (shl (i64 DoubleRegs:$src2),
3734 (i32 IntRegs:$src3))))],
3739 def LSRd_rr_xor_V4 : MInst_acc<(outs DoubleRegs:$dst),
3740 (ins DoubleRegs:$src1, DoubleRegs:$src2, IntRegs:$src3),
3741 "$dst ^= lsr($src2, $src3)",
3742 [(set (i64 DoubleRegs:$dst),
3743 (xor (i64 DoubleRegs:$src1), (srl (i64 DoubleRegs:$src2),
3744 (i32 IntRegs:$src3))))],
3749 //===----------------------------------------------------------------------===//
3751 //===----------------------------------------------------------------------===//
3753 //===----------------------------------------------------------------------===//
3754 // MEMOP: Word, Half, Byte
3755 //===----------------------------------------------------------------------===//
3757 //===----------------------------------------------------------------------===//
3761 // MEMw_ADDi_indexed_V4 : memw(Rs+#u6:2)+=#U5
3762 // MEMw_SUBi_indexed_V4 : memw(Rs+#u6:2)-=#U5
3763 // MEMw_ADDr_indexed_V4 : memw(Rs+#u6:2)+=Rt
3764 // MEMw_SUBr_indexed_V4 : memw(Rs+#u6:2)-=Rt
3765 // MEMw_CLRr_indexed_V4 : memw(Rs+#u6:2)&=Rt
3766 // MEMw_SETr_indexed_V4 : memw(Rs+#u6:2)|=Rt
3767 // MEMw_ADDi_V4 : memw(Rs+#u6:2)+=#U5
3768 // MEMw_SUBi_V4 : memw(Rs+#u6:2)-=#U5
3769 // MEMw_ADDr_V4 : memw(Rs+#u6:2)+=Rt
3770 // MEMw_SUBr_V4 : memw(Rs+#u6:2)-=Rt
3771 // MEMw_CLRr_V4 : memw(Rs+#u6:2)&=Rt
3772 // MEMw_SETr_V4 : memw(Rs+#u6:2)|=Rt
3775 // MEMw_CLRi_indexed_V4 : memw(Rs+#u6:2)=clrbit(#U5)
3776 // MEMw_SETi_indexed_V4 : memw(Rs+#u6:2)=setbit(#U5)
3777 // MEMw_CLRi_V4 : memw(Rs+#u6:2)=clrbit(#U5)
3778 // MEMw_SETi_V4 : memw(Rs+#u6:2)=setbit(#U5)
3779 //===----------------------------------------------------------------------===//
3783 // memw(Rs+#u6:2) += #U5
3784 let AddedComplexity = 30 in
3785 def MEMw_ADDi_indexed_MEM_V4 : MEMInst_V4<(outs),
3786 (ins IntRegs:$base, u6_2Imm:$offset, u5Imm:$addend),
3787 "memw($base+#$offset) += #$addend",
3789 Requires<[HasV4T, UseMEMOP]>;
3791 // memw(Rs+#u6:2) -= #U5
3792 let AddedComplexity = 30 in
3793 def MEMw_SUBi_indexed_MEM_V4 : MEMInst_V4<(outs),
3794 (ins IntRegs:$base, u6_2Imm:$offset, u5Imm:$subend),
3795 "memw($base+#$offset) -= #$subend",
3797 Requires<[HasV4T, UseMEMOP]>;
3799 // memw(Rs+#u6:2) += Rt
3800 let AddedComplexity = 30 in
3801 def MEMw_ADDr_indexed_MEM_V4 : MEMInst_V4<(outs),
3802 (ins IntRegs:$base, u6_2Imm:$offset, IntRegs:$addend),
3803 "memw($base+#$offset) += $addend",
3804 [(store (add (load (add (i32 IntRegs:$base), u6_2ImmPred:$offset)),
3805 (i32 IntRegs:$addend)),
3806 (add (i32 IntRegs:$base), u6_2ImmPred:$offset))]>,
3807 Requires<[HasV4T, UseMEMOP]>;
3809 // memw(Rs+#u6:2) -= Rt
3810 let AddedComplexity = 30 in
3811 def MEMw_SUBr_indexed_MEM_V4 : MEMInst_V4<(outs),
3812 (ins IntRegs:$base, u6_2Imm:$offset, IntRegs:$subend),
3813 "memw($base+#$offset) -= $subend",
3814 [(store (sub (load (add (i32 IntRegs:$base), u6_2ImmPred:$offset)),
3815 (i32 IntRegs:$subend)),
3816 (add (i32 IntRegs:$base), u6_2ImmPred:$offset))]>,
3817 Requires<[HasV4T, UseMEMOP]>;
3819 // memw(Rs+#u6:2) &= Rt
3820 let AddedComplexity = 30 in
3821 def MEMw_ANDr_indexed_MEM_V4 : MEMInst_V4<(outs),
3822 (ins IntRegs:$base, u6_2Imm:$offset, IntRegs:$andend),
3823 "memw($base+#$offset) &= $andend",
3824 [(store (and (load (add (i32 IntRegs:$base), u6_2ImmPred:$offset)),
3825 (i32 IntRegs:$andend)),
3826 (add (i32 IntRegs:$base), u6_2ImmPred:$offset))]>,
3827 Requires<[HasV4T, UseMEMOP]>;
3829 // memw(Rs+#u6:2) |= Rt
3830 let AddedComplexity = 30 in
3831 def MEMw_ORr_indexed_MEM_V4 : MEMInst_V4<(outs),
3832 (ins IntRegs:$base, u6_2Imm:$offset, IntRegs:$orend),
3833 "memw($base+#$offset) |= $orend",
3834 [(store (or (load (add (i32 IntRegs:$base), u6_2ImmPred:$offset)),
3835 (i32 IntRegs:$orend)),
3836 (add (i32 IntRegs:$base), u6_2ImmPred:$offset))]>,
3837 Requires<[HasV4T, UseMEMOP]>;
3839 // memw(Rs+#u6:2) += #U5
3840 let AddedComplexity = 30 in
3841 def MEMw_ADDi_MEM_V4 : MEMInst_V4<(outs),
3842 (ins MEMri:$addr, u5Imm:$addend),
3843 "memw($addr) += $addend",
3845 Requires<[HasV4T, UseMEMOP]>;
3847 // memw(Rs+#u6:2) -= #U5
3848 let AddedComplexity = 30 in
3849 def MEMw_SUBi_MEM_V4 : MEMInst_V4<(outs),
3850 (ins MEMri:$addr, u5Imm:$subend),
3851 "memw($addr) -= $subend",
3853 Requires<[HasV4T, UseMEMOP]>;
3855 // memw(Rs+#u6:2) += Rt
3856 let AddedComplexity = 30 in
3857 def MEMw_ADDr_MEM_V4 : MEMInst_V4<(outs),
3858 (ins MEMri:$addr, IntRegs:$addend),
3859 "memw($addr) += $addend",
3860 [(store (add (load ADDRriU6_2:$addr), (i32 IntRegs:$addend)),
3861 ADDRriU6_2:$addr)]>,
3862 Requires<[HasV4T, UseMEMOP]>;
3864 // memw(Rs+#u6:2) -= Rt
3865 let AddedComplexity = 30 in
3866 def MEMw_SUBr_MEM_V4 : MEMInst_V4<(outs),
3867 (ins MEMri:$addr, IntRegs:$subend),
3868 "memw($addr) -= $subend",
3869 [(store (sub (load ADDRriU6_2:$addr), (i32 IntRegs:$subend)),
3870 ADDRriU6_2:$addr)]>,
3871 Requires<[HasV4T, UseMEMOP]>;
3873 // memw(Rs+#u6:2) &= Rt
3874 let AddedComplexity = 30 in
3875 def MEMw_ANDr_MEM_V4 : MEMInst_V4<(outs),
3876 (ins MEMri:$addr, IntRegs:$andend),
3877 "memw($addr) &= $andend",
3878 [(store (and (load ADDRriU6_2:$addr), (i32 IntRegs:$andend)),
3879 ADDRriU6_2:$addr)]>,
3880 Requires<[HasV4T, UseMEMOP]>;
3882 // memw(Rs+#u6:2) |= Rt
3883 let AddedComplexity = 30 in
3884 def MEMw_ORr_MEM_V4 : MEMInst_V4<(outs),
3885 (ins MEMri:$addr, IntRegs:$orend),
3886 "memw($addr) |= $orend",
3887 [(store (or (load ADDRriU6_2:$addr), (i32 IntRegs:$orend)),
3888 ADDRriU6_2:$addr)]>,
3889 Requires<[HasV4T, UseMEMOP]>;
3891 //===----------------------------------------------------------------------===//
3895 // MEMh_ADDi_indexed_V4 : memw(Rs+#u6:2)+=#U5
3896 // MEMh_SUBi_indexed_V4 : memw(Rs+#u6:2)-=#U5
3897 // MEMh_ADDr_indexed_V4 : memw(Rs+#u6:2)+=Rt
3898 // MEMh_SUBr_indexed_V4 : memw(Rs+#u6:2)-=Rt
3899 // MEMh_CLRr_indexed_V4 : memw(Rs+#u6:2)&=Rt
3900 // MEMh_SETr_indexed_V4 : memw(Rs+#u6:2)|=Rt
3901 // MEMh_ADDi_V4 : memw(Rs+#u6:2)+=#U5
3902 // MEMh_SUBi_V4 : memw(Rs+#u6:2)-=#U5
3903 // MEMh_ADDr_V4 : memw(Rs+#u6:2)+=Rt
3904 // MEMh_SUBr_V4 : memw(Rs+#u6:2)-=Rt
3905 // MEMh_CLRr_V4 : memw(Rs+#u6:2)&=Rt
3906 // MEMh_SETr_V4 : memw(Rs+#u6:2)|=Rt
3909 // MEMh_CLRi_indexed_V4 : memw(Rs+#u6:2)=clrbit(#U5)
3910 // MEMh_SETi_indexed_V4 : memw(Rs+#u6:2)=setbit(#U5)
3911 // MEMh_CLRi_V4 : memw(Rs+#u6:2)=clrbit(#U5)
3912 // MEMh_SETi_V4 : memw(Rs+#u6:2)=setbit(#U5)
3913 //===----------------------------------------------------------------------===//
3916 // memh(Rs+#u6:1) += #U5
3917 let AddedComplexity = 30 in
3918 def MEMh_ADDi_indexed_MEM_V4 : MEMInst_V4<(outs),
3919 (ins IntRegs:$base, u6_1Imm:$offset, u5Imm:$addend),
3920 "memh($base+#$offset) += $addend",
3922 Requires<[HasV4T, UseMEMOP]>;
3924 // memh(Rs+#u6:1) -= #U5
3925 let AddedComplexity = 30 in
3926 def MEMh_SUBi_indexed_MEM_V4 : MEMInst_V4<(outs),
3927 (ins IntRegs:$base, u6_1Imm:$offset, u5Imm:$subend),
3928 "memh($base+#$offset) -= $subend",
3930 Requires<[HasV4T, UseMEMOP]>;
3932 // memh(Rs+#u6:1) += Rt
3933 let AddedComplexity = 30 in
3934 def MEMh_ADDr_indexed_MEM_V4 : MEMInst_V4<(outs),
3935 (ins IntRegs:$base, u6_1Imm:$offset, IntRegs:$addend),
3936 "memh($base+#$offset) += $addend",
3937 [(truncstorei16 (add (sextloadi16 (add (i32 IntRegs:$base),
3938 u6_1ImmPred:$offset)),
3939 (i32 IntRegs:$addend)),
3940 (add (i32 IntRegs:$base), u6_1ImmPred:$offset))]>,
3941 Requires<[HasV4T, UseMEMOP]>;
3943 // memh(Rs+#u6:1) -= Rt
3944 let AddedComplexity = 30 in
3945 def MEMh_SUBr_indexed_MEM_V4 : MEMInst_V4<(outs),
3946 (ins IntRegs:$base, u6_1Imm:$offset, IntRegs:$subend),
3947 "memh($base+#$offset) -= $subend",
3948 [(truncstorei16 (sub (sextloadi16 (add (i32 IntRegs:$base),
3949 u6_1ImmPred:$offset)),
3950 (i32 IntRegs:$subend)),
3951 (add (i32 IntRegs:$base), u6_1ImmPred:$offset))]>,
3952 Requires<[HasV4T, UseMEMOP]>;
3954 // memh(Rs+#u6:1) &= Rt
3955 let AddedComplexity = 30 in
3956 def MEMh_ANDr_indexed_MEM_V4 : MEMInst_V4<(outs),
3957 (ins IntRegs:$base, u6_1Imm:$offset, IntRegs:$andend),
3958 "memh($base+#$offset) += $andend",
3959 [(truncstorei16 (and (sextloadi16 (add (i32 IntRegs:$base),
3960 u6_1ImmPred:$offset)),
3961 (i32 IntRegs:$andend)),
3962 (add (i32 IntRegs:$base), u6_1ImmPred:$offset))]>,
3963 Requires<[HasV4T, UseMEMOP]>;
3965 // memh(Rs+#u6:1) |= Rt
3966 let AddedComplexity = 30 in
3967 def MEMh_ORr_indexed_MEM_V4 : MEMInst_V4<(outs),
3968 (ins IntRegs:$base, u6_1Imm:$offset, IntRegs:$orend),
3969 "memh($base+#$offset) |= $orend",
3970 [(truncstorei16 (or (sextloadi16 (add (i32 IntRegs:$base),
3971 u6_1ImmPred:$offset)),
3972 (i32 IntRegs:$orend)),
3973 (add (i32 IntRegs:$base), u6_1ImmPred:$offset))]>,
3974 Requires<[HasV4T, UseMEMOP]>;
3976 // memh(Rs+#u6:1) += #U5
3977 let AddedComplexity = 30 in
3978 def MEMh_ADDi_MEM_V4 : MEMInst_V4<(outs),
3979 (ins MEMri:$addr, u5Imm:$addend),
3980 "memh($addr) += $addend",
3982 Requires<[HasV4T, UseMEMOP]>;
3984 // memh(Rs+#u6:1) -= #U5
3985 let AddedComplexity = 30 in
3986 def MEMh_SUBi_MEM_V4 : MEMInst_V4<(outs),
3987 (ins MEMri:$addr, u5Imm:$subend),
3988 "memh($addr) -= $subend",
3990 Requires<[HasV4T, UseMEMOP]>;
3992 // memh(Rs+#u6:1) += Rt
3993 let AddedComplexity = 30 in
3994 def MEMh_ADDr_MEM_V4 : MEMInst_V4<(outs),
3995 (ins MEMri:$addr, IntRegs:$addend),
3996 "memh($addr) += $addend",
3997 [(truncstorei16 (add (sextloadi16 ADDRriU6_1:$addr),
3998 (i32 IntRegs:$addend)), ADDRriU6_1:$addr)]>,
3999 Requires<[HasV4T, UseMEMOP]>;
4001 // memh(Rs+#u6:1) -= Rt
4002 let AddedComplexity = 30 in
4003 def MEMh_SUBr_MEM_V4 : MEMInst_V4<(outs),
4004 (ins MEMri:$addr, IntRegs:$subend),
4005 "memh($addr) -= $subend",
4006 [(truncstorei16 (sub (sextloadi16 ADDRriU6_1:$addr),
4007 (i32 IntRegs:$subend)), ADDRriU6_1:$addr)]>,
4008 Requires<[HasV4T, UseMEMOP]>;
4010 // memh(Rs+#u6:1) &= Rt
4011 let AddedComplexity = 30 in
4012 def MEMh_ANDr_MEM_V4 : MEMInst_V4<(outs),
4013 (ins MEMri:$addr, IntRegs:$andend),
4014 "memh($addr) &= $andend",
4015 [(truncstorei16 (and (sextloadi16 ADDRriU6_1:$addr),
4016 (i32 IntRegs:$andend)), ADDRriU6_1:$addr)]>,
4017 Requires<[HasV4T, UseMEMOP]>;
4019 // memh(Rs+#u6:1) |= Rt
4020 let AddedComplexity = 30 in
4021 def MEMh_ORr_MEM_V4 : MEMInst_V4<(outs),
4022 (ins MEMri:$addr, IntRegs:$orend),
4023 "memh($addr) |= $orend",
4024 [(truncstorei16 (or (sextloadi16 ADDRriU6_1:$addr),
4025 (i32 IntRegs:$orend)), ADDRriU6_1:$addr)]>,
4026 Requires<[HasV4T, UseMEMOP]>;
4029 //===----------------------------------------------------------------------===//
4033 // MEMb_ADDi_indexed_V4 : memb(Rs+#u6:0)+=#U5
4034 // MEMb_SUBi_indexed_V4 : memb(Rs+#u6:0)-=#U5
4035 // MEMb_ADDr_indexed_V4 : memb(Rs+#u6:0)+=Rt
4036 // MEMb_SUBr_indexed_V4 : memb(Rs+#u6:0)-=Rt
4037 // MEMb_CLRr_indexed_V4 : memb(Rs+#u6:0)&=Rt
4038 // MEMb_SETr_indexed_V4 : memb(Rs+#u6:0)|=Rt
4039 // MEMb_ADDi_V4 : memb(Rs+#u6:0)+=#U5
4040 // MEMb_SUBi_V4 : memb(Rs+#u6:0)-=#U5
4041 // MEMb_ADDr_V4 : memb(Rs+#u6:0)+=Rt
4042 // MEMb_SUBr_V4 : memb(Rs+#u6:0)-=Rt
4043 // MEMb_CLRr_V4 : memb(Rs+#u6:0)&=Rt
4044 // MEMb_SETr_V4 : memb(Rs+#u6:0)|=Rt
4047 // MEMb_CLRi_indexed_V4 : memb(Rs+#u6:0)=clrbit(#U5)
4048 // MEMb_SETi_indexed_V4 : memb(Rs+#u6:0)=setbit(#U5)
4049 // MEMb_CLRi_V4 : memb(Rs+#u6:0)=clrbit(#U5)
4050 // MEMb_SETi_V4 : memb(Rs+#u6:0)=setbit(#U5)
4051 //===----------------------------------------------------------------------===//
4053 // memb(Rs+#u6:0) += #U5
4054 let AddedComplexity = 30 in
4055 def MEMb_ADDi_indexed_MEM_V4 : MEMInst_V4<(outs),
4056 (ins IntRegs:$base, u6_0Imm:$offset, u5Imm:$addend),
4057 "memb($base+#$offset) += $addend",
4059 Requires<[HasV4T, UseMEMOP]>;
4061 // memb(Rs+#u6:0) -= #U5
4062 let AddedComplexity = 30 in
4063 def MEMb_SUBi_indexed_MEM_V4 : MEMInst_V4<(outs),
4064 (ins IntRegs:$base, u6_0Imm:$offset, u5Imm:$subend),
4065 "memb($base+#$offset) -= $subend",
4067 Requires<[HasV4T, UseMEMOP]>;
4069 // memb(Rs+#u6:0) += Rt
4070 let AddedComplexity = 30 in
4071 def MEMb_ADDr_indexed_MEM_V4 : MEMInst_V4<(outs),
4072 (ins IntRegs:$base, u6_0Imm:$offset, IntRegs:$addend),
4073 "memb($base+#$offset) += $addend",
4074 [(truncstorei8 (add (sextloadi8 (add (i32 IntRegs:$base),
4075 u6_0ImmPred:$offset)),
4076 (i32 IntRegs:$addend)),
4077 (add (i32 IntRegs:$base), u6_0ImmPred:$offset))]>,
4078 Requires<[HasV4T, UseMEMOP]>;
4080 // memb(Rs+#u6:0) -= Rt
4081 let AddedComplexity = 30 in
4082 def MEMb_SUBr_indexed_MEM_V4 : MEMInst_V4<(outs),
4083 (ins IntRegs:$base, u6_0Imm:$offset, IntRegs:$subend),
4084 "memb($base+#$offset) -= $subend",
4085 [(truncstorei8 (sub (sextloadi8 (add (i32 IntRegs:$base),
4086 u6_0ImmPred:$offset)),
4087 (i32 IntRegs:$subend)),
4088 (add (i32 IntRegs:$base), u6_0ImmPred:$offset))]>,
4089 Requires<[HasV4T, UseMEMOP]>;
4091 // memb(Rs+#u6:0) &= Rt
4092 let AddedComplexity = 30 in
4093 def MEMb_ANDr_indexed_MEM_V4 : MEMInst_V4<(outs),
4094 (ins IntRegs:$base, u6_0Imm:$offset, IntRegs:$andend),
4095 "memb($base+#$offset) += $andend",
4096 [(truncstorei8 (and (sextloadi8 (add (i32 IntRegs:$base),
4097 u6_0ImmPred:$offset)),
4098 (i32 IntRegs:$andend)),
4099 (add (i32 IntRegs:$base), u6_0ImmPred:$offset))]>,
4100 Requires<[HasV4T, UseMEMOP]>;
4102 // memb(Rs+#u6:0) |= Rt
4103 let AddedComplexity = 30 in
4104 def MEMb_ORr_indexed_MEM_V4 : MEMInst_V4<(outs),
4105 (ins IntRegs:$base, u6_0Imm:$offset, IntRegs:$orend),
4106 "memb($base+#$offset) |= $orend",
4107 [(truncstorei8 (or (sextloadi8 (add (i32 IntRegs:$base),
4108 u6_0ImmPred:$offset)),
4109 (i32 IntRegs:$orend)),
4110 (add (i32 IntRegs:$base), u6_0ImmPred:$offset))]>,
4111 Requires<[HasV4T, UseMEMOP]>;
4113 // memb(Rs+#u6:0) += #U5
4114 let AddedComplexity = 30 in
4115 def MEMb_ADDi_MEM_V4 : MEMInst_V4<(outs),
4116 (ins MEMri:$addr, u5Imm:$addend),
4117 "memb($addr) += $addend",
4119 Requires<[HasV4T, UseMEMOP]>;
4121 // memb(Rs+#u6:0) -= #U5
4122 let AddedComplexity = 30 in
4123 def MEMb_SUBi_MEM_V4 : MEMInst_V4<(outs),
4124 (ins MEMri:$addr, u5Imm:$subend),
4125 "memb($addr) -= $subend",
4127 Requires<[HasV4T, UseMEMOP]>;
4129 // memb(Rs+#u6:0) += Rt
4130 let AddedComplexity = 30 in
4131 def MEMb_ADDr_MEM_V4 : MEMInst_V4<(outs),
4132 (ins MEMri:$addr, IntRegs:$addend),
4133 "memb($addr) += $addend",
4134 [(truncstorei8 (add (sextloadi8 ADDRriU6_0:$addr),
4135 (i32 IntRegs:$addend)), ADDRriU6_0:$addr)]>,
4136 Requires<[HasV4T, UseMEMOP]>;
4138 // memb(Rs+#u6:0) -= Rt
4139 let AddedComplexity = 30 in
4140 def MEMb_SUBr_MEM_V4 : MEMInst_V4<(outs),
4141 (ins MEMri:$addr, IntRegs:$subend),
4142 "memb($addr) -= $subend",
4143 [(truncstorei8 (sub (sextloadi8 ADDRriU6_0:$addr),
4144 (i32 IntRegs:$subend)), ADDRriU6_0:$addr)]>,
4145 Requires<[HasV4T, UseMEMOP]>;
4147 // memb(Rs+#u6:0) &= Rt
4148 let AddedComplexity = 30 in
4149 def MEMb_ANDr_MEM_V4 : MEMInst_V4<(outs),
4150 (ins MEMri:$addr, IntRegs:$andend),
4151 "memb($addr) &= $andend",
4152 [(truncstorei8 (and (sextloadi8 ADDRriU6_0:$addr),
4153 (i32 IntRegs:$andend)), ADDRriU6_0:$addr)]>,
4154 Requires<[HasV4T, UseMEMOP]>;
4156 // memb(Rs+#u6:0) |= Rt
4157 let AddedComplexity = 30 in
4158 def MEMb_ORr_MEM_V4 : MEMInst_V4<(outs),
4159 (ins MEMri:$addr, IntRegs:$orend),
4160 "memb($addr) |= $orend",
4161 [(truncstorei8 (or (sextloadi8 ADDRriU6_0:$addr),
4162 (i32 IntRegs:$orend)), ADDRriU6_0:$addr)]>,
4163 Requires<[HasV4T, UseMEMOP]>;
4166 //===----------------------------------------------------------------------===//
4168 //===----------------------------------------------------------------------===//
4170 // Hexagon V4 only supports these flavors of byte/half compare instructions:
4171 // EQ/GT/GTU. Other flavors like GE/GEU/LT/LTU/LE/LEU are not supported by
4172 // hardware. However, compiler can still implement these patterns through
4173 // appropriate patterns combinations based on current implemented patterns.
4174 // The implemented patterns are: EQ/GT/GTU.
4175 // Missing patterns are: GE/GEU/LT/LTU/LE/LEU.
4177 // Following instruction is not being extended as it results into the
4178 // incorrect code for negative numbers.
4179 // Pd=cmpb.eq(Rs,#u8)
4181 let isCompare = 1 in
4182 def CMPbEQri_V4 : MInst<(outs PredRegs:$dst),
4183 (ins IntRegs:$src1, u8Imm:$src2),
4184 "$dst = cmpb.eq($src1, #$src2)",
4185 [(set (i1 PredRegs:$dst),
4186 (seteq (and (i32 IntRegs:$src1), 255), u8ImmPred:$src2))]>,
4189 // Pd=cmpb.eq(Rs,Rt)
4190 let isCompare = 1 in
4191 def CMPbEQrr_ubub_V4 : MInst<(outs PredRegs:$dst),
4192 (ins IntRegs:$src1, IntRegs:$src2),
4193 "$dst = cmpb.eq($src1, $src2)",
4194 [(set (i1 PredRegs:$dst),
4195 (seteq (and (xor (i32 IntRegs:$src1),
4196 (i32 IntRegs:$src2)), 255), 0))]>,
4199 // Pd=cmpb.eq(Rs,Rt)
4200 let isCompare = 1 in
4201 def CMPbEQrr_sbsb_V4 : MInst<(outs PredRegs:$dst),
4202 (ins IntRegs:$src1, IntRegs:$src2),
4203 "$dst = cmpb.eq($src1, $src2)",
4204 [(set (i1 PredRegs:$dst),
4205 (seteq (shl (i32 IntRegs:$src1), (i32 24)),
4206 (shl (i32 IntRegs:$src2), (i32 24))))]>,
4209 // Pd=cmpb.gt(Rs,Rt)
4210 let isCompare = 1 in
4211 def CMPbGTrr_V4 : MInst<(outs PredRegs:$dst),
4212 (ins IntRegs:$src1, IntRegs:$src2),
4213 "$dst = cmpb.gt($src1, $src2)",
4214 [(set (i1 PredRegs:$dst),
4215 (setgt (shl (i32 IntRegs:$src1), (i32 24)),
4216 (shl (i32 IntRegs:$src2), (i32 24))))]>,
4219 // Pd=cmpb.gtu(Rs,#u7)
4220 let isCompare = 1 in
4221 def CMPbGTUri_V4 : MInst<(outs PredRegs:$dst),
4222 (ins IntRegs:$src1, u7Imm:$src2),
4223 "$dst = cmpb.gtu($src1, #$src2)",
4224 [(set (i1 PredRegs:$dst), (setugt (and (i32 IntRegs:$src1), 255),
4225 u7ImmPred:$src2))]>,
4228 // Pd=cmpb.gtu(Rs,Rt)
4229 let isCompare = 1 in
4230 def CMPbGTUrr_V4 : MInst<(outs PredRegs:$dst),
4231 (ins IntRegs:$src1, IntRegs:$src2),
4232 "$dst = cmpb.gtu($src1, $src2)",
4233 [(set (i1 PredRegs:$dst), (setugt (and (i32 IntRegs:$src1), 255),
4234 (and (i32 IntRegs:$src2), 255)))]>,
4237 // Following instruction is not being extended as it results into the incorrect
4238 // code for negative numbers.
4240 // Signed half compare(.eq) ri.
4241 // Pd=cmph.eq(Rs,#s8)
4242 let isCompare = 1 in
4243 def CMPhEQri_V4 : MInst<(outs PredRegs:$dst),
4244 (ins IntRegs:$src1, s8Imm:$src2),
4245 "$dst = cmph.eq($src1, #$src2)",
4246 [(set (i1 PredRegs:$dst), (seteq (and (i32 IntRegs:$src1), 65535),
4247 s8ImmPred:$src2))]>,
4250 // Signed half compare(.eq) rr.
4251 // Case 1: xor + and, then compare:
4253 // r0=and(r0,#0xffff)
4255 // Pd=cmph.eq(Rs,Rt)
4256 let isCompare = 1 in
4257 def CMPhEQrr_xor_V4 : MInst<(outs PredRegs:$dst),
4258 (ins IntRegs:$src1, IntRegs:$src2),
4259 "$dst = cmph.eq($src1, $src2)",
4260 [(set (i1 PredRegs:$dst), (seteq (and (xor (i32 IntRegs:$src1),
4261 (i32 IntRegs:$src2)),
4265 // Signed half compare(.eq) rr.
4266 // Case 2: shift left 16 bits then compare:
4270 // Pd=cmph.eq(Rs,Rt)
4271 let isCompare = 1 in
4272 def CMPhEQrr_shl_V4 : MInst<(outs PredRegs:$dst),
4273 (ins IntRegs:$src1, IntRegs:$src2),
4274 "$dst = cmph.eq($src1, $src2)",
4275 [(set (i1 PredRegs:$dst),
4276 (seteq (shl (i32 IntRegs:$src1), (i32 16)),
4277 (shl (i32 IntRegs:$src2), (i32 16))))]>,
4280 /* Incorrect Pattern -- immediate should be right shifted before being
4281 used in the cmph.gt instruction.
4282 // Signed half compare(.gt) ri.
4283 // Pd=cmph.gt(Rs,#s8)
4285 let isCompare = 1 in
4286 def CMPhGTri_V4 : MInst<(outs PredRegs:$dst),
4287 (ins IntRegs:$src1, s8Imm:$src2),
4288 "$dst = cmph.gt($src1, #$src2)",
4289 [(set (i1 PredRegs:$dst),
4290 (setgt (shl (i32 IntRegs:$src1), (i32 16)),
4291 s8ImmPred:$src2))]>,
4295 // Signed half compare(.gt) rr.
4296 // Pd=cmph.gt(Rs,Rt)
4297 let isCompare = 1 in
4298 def CMPhGTrr_shl_V4 : MInst<(outs PredRegs:$dst),
4299 (ins IntRegs:$src1, IntRegs:$src2),
4300 "$dst = cmph.gt($src1, $src2)",
4301 [(set (i1 PredRegs:$dst),
4302 (setgt (shl (i32 IntRegs:$src1), (i32 16)),
4303 (shl (i32 IntRegs:$src2), (i32 16))))]>,
4306 // Unsigned half compare rr (.gtu).
4307 // Pd=cmph.gtu(Rs,Rt)
4308 let isCompare = 1 in
4309 def CMPhGTUrr_V4 : MInst<(outs PredRegs:$dst),
4310 (ins IntRegs:$src1, IntRegs:$src2),
4311 "$dst = cmph.gtu($src1, $src2)",
4312 [(set (i1 PredRegs:$dst),
4313 (setugt (and (i32 IntRegs:$src1), 65535),
4314 (and (i32 IntRegs:$src2), 65535)))]>,
4317 // Unsigned half compare ri (.gtu).
4318 // Pd=cmph.gtu(Rs,#u7)
4319 let isCompare = 1 in
4320 def CMPhGTUri_V4 : MInst<(outs PredRegs:$dst),
4321 (ins IntRegs:$src1, u7Imm:$src2),
4322 "$dst = cmph.gtu($src1, #$src2)",
4323 [(set (i1 PredRegs:$dst), (setugt (and (i32 IntRegs:$src1), 65535),
4324 u7ImmPred:$src2))]>,
4327 //===----------------------------------------------------------------------===//
4329 //===----------------------------------------------------------------------===//
4331 //Deallocate frame and return.
4333 let isReturn = 1, isTerminator = 1, isBarrier = 1, isPredicable = 1,
4334 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1 in {
4335 def DEALLOC_RET_V4 : NVInst_V4<(outs), (ins i32imm:$amt1),
4341 // Restore registers and dealloc return function call.
4342 let isCall = 1, isBarrier = 1, isReturn = 1, isTerminator = 1,
4343 Defs = [R29, R30, R31, PC] in {
4344 def RESTORE_DEALLOC_RET_JMP_V4 : JInst<(outs),
4345 (ins calltarget:$dst),
4346 "jump $dst // Restore_and_dealloc_return",
4351 // Restore registers and dealloc frame before a tail call.
4352 let isCall = 1, isBarrier = 1,
4353 Defs = [R29, R30, R31, PC] in {
4354 def RESTORE_DEALLOC_BEFORE_TAILCALL_V4 : JInst<(outs),
4355 (ins calltarget:$dst),
4356 "call $dst // Restore_and_dealloc_before_tailcall",
4361 // Save registers function call.
4362 let isCall = 1, isBarrier = 1,
4363 Uses = [R29, R31] in {
4364 def SAVE_REGISTERS_CALL_V4 : JInst<(outs),
4365 (ins calltarget:$dst),
4366 "call $dst // Save_calle_saved_registers",
4371 // if (Ps) dealloc_return
4372 let isReturn = 1, isTerminator = 1,
4373 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
4374 isPredicated = 1 in {
4375 def DEALLOC_RET_cPt_V4 : NVInst_V4<(outs),
4376 (ins PredRegs:$src1, i32imm:$amt1),
4377 "if ($src1) dealloc_return",
4382 // if (!Ps) dealloc_return
4383 let isReturn = 1, isTerminator = 1,
4384 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
4385 isPredicated = 1 in {
4386 def DEALLOC_RET_cNotPt_V4 : NVInst_V4<(outs), (ins PredRegs:$src1,
4388 "if (!$src1) dealloc_return",
4393 // if (Ps.new) dealloc_return:nt
4394 let isReturn = 1, isTerminator = 1,
4395 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
4396 isPredicated = 1 in {
4397 def DEALLOC_RET_cdnPnt_V4 : NVInst_V4<(outs), (ins PredRegs:$src1,
4399 "if ($src1.new) dealloc_return:nt",
4404 // if (!Ps.new) dealloc_return:nt
4405 let isReturn = 1, isTerminator = 1,
4406 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
4407 isPredicated = 1 in {
4408 def DEALLOC_RET_cNotdnPnt_V4 : NVInst_V4<(outs), (ins PredRegs:$src1,
4410 "if (!$src1.new) dealloc_return:nt",
4415 // if (Ps.new) dealloc_return:t
4416 let isReturn = 1, isTerminator = 1,
4417 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
4418 isPredicated = 1 in {
4419 def DEALLOC_RET_cdnPt_V4 : NVInst_V4<(outs), (ins PredRegs:$src1,
4421 "if ($src1.new) dealloc_return:t",
4426 // if (!Ps.new) dealloc_return:nt
4427 let isReturn = 1, isTerminator = 1,
4428 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
4429 isPredicated = 1 in {
4430 def DEALLOC_RET_cNotdnPt_V4 : NVInst_V4<(outs), (ins PredRegs:$src1,
4432 "if (!$src1.new) dealloc_return:t",
4438 // Load/Store with absolute addressing mode
4441 multiclass ST_abs<string OpcStr> {
4442 let isPredicable = 1 in
4443 def _abs_V4 : STInst2<(outs),
4444 (ins globaladdress:$absaddr, IntRegs:$src),
4445 !strconcat(OpcStr, "(##$absaddr) = $src"),
4449 let isPredicated = 1 in
4450 def _abs_cPt_V4 : STInst2<(outs),
4451 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
4452 !strconcat("if ($src1)",
4453 !strconcat(OpcStr, "(##$absaddr) = $src2")),
4457 let isPredicated = 1 in
4458 def _abs_cNotPt_V4 : STInst2<(outs),
4459 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
4460 !strconcat("if (!$src1)",
4461 !strconcat(OpcStr, "(##$absaddr) = $src2")),
4465 let isPredicated = 1 in
4466 def _abs_cdnPt_V4 : STInst2<(outs),
4467 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
4468 !strconcat("if ($src1.new)",
4469 !strconcat(OpcStr, "(##$absaddr) = $src2")),
4473 let isPredicated = 1 in
4474 def _abs_cdnNotPt_V4 : STInst2<(outs),
4475 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
4476 !strconcat("if (!$src1.new)",
4477 !strconcat(OpcStr, "(##$absaddr) = $src2")),
4481 def _abs_nv_V4 : STInst2<(outs),
4482 (ins globaladdress:$absaddr, IntRegs:$src),
4483 !strconcat(OpcStr, "(##$absaddr) = $src.new"),
4487 let isPredicated = 1 in
4488 def _abs_cPt_nv_V4 : STInst2<(outs),
4489 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
4490 !strconcat("if ($src1)",
4491 !strconcat(OpcStr, "(##$absaddr) = $src2.new")),
4495 let isPredicated = 1 in
4496 def _abs_cNotPt_nv_V4 : STInst2<(outs),
4497 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
4498 !strconcat("if (!$src1)",
4499 !strconcat(OpcStr, "(##$absaddr) = $src2.new")),
4503 let isPredicated = 1 in
4504 def _abs_cdnPt_nv_V4 : STInst2<(outs),
4505 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
4506 !strconcat("if ($src1.new)",
4507 !strconcat(OpcStr, "(##$absaddr) = $src2.new")),
4511 let isPredicated = 1 in
4512 def _abs_cdnNotPt_nv_V4 : STInst2<(outs),
4513 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
4514 !strconcat("if (!$src1.new)",
4515 !strconcat(OpcStr, "(##$absaddr) = $src2.new")),
4520 let AddedComplexity = 30, isPredicable = 1 in
4521 def STrid_abs_V4 : STInst<(outs),
4522 (ins globaladdress:$absaddr, DoubleRegs:$src),
4523 "memd(##$absaddr) = $src",
4524 [(store (i64 DoubleRegs:$src),
4525 (HexagonCONST32 tglobaladdr:$absaddr))]>,
4528 let AddedComplexity = 30, isPredicated = 1 in
4529 def STrid_abs_cPt_V4 : STInst2<(outs),
4530 (ins PredRegs:$src1, globaladdress:$absaddr, DoubleRegs:$src2),
4531 "if ($src1) memd(##$absaddr) = $src2",
4535 let AddedComplexity = 30, isPredicated = 1 in
4536 def STrid_abs_cNotPt_V4 : STInst2<(outs),
4537 (ins PredRegs:$src1, globaladdress:$absaddr, DoubleRegs:$src2),
4538 "if (!$src1) memd(##$absaddr) = $src2",
4542 let AddedComplexity = 30, isPredicated = 1 in
4543 def STrid_abs_cdnPt_V4 : STInst2<(outs),
4544 (ins PredRegs:$src1, globaladdress:$absaddr, DoubleRegs:$src2),
4545 "if ($src1.new) memd(##$absaddr) = $src2",
4549 let AddedComplexity = 30, isPredicated = 1 in
4550 def STrid_abs_cdnNotPt_V4 : STInst2<(outs),
4551 (ins PredRegs:$src1, globaladdress:$absaddr, DoubleRegs:$src2),
4552 "if (!$src1.new) memd(##$absaddr) = $src2",
4556 defm STrib : ST_abs<"memb">;
4557 defm STrih : ST_abs<"memh">;
4558 defm STriw : ST_abs<"memw">;
4560 let Predicates = [HasV4T], AddedComplexity = 30 in
4561 def : Pat<(truncstorei8 (i32 IntRegs:$src1),
4562 (HexagonCONST32 tglobaladdr:$absaddr)),
4563 (STrib_abs_V4 tglobaladdr: $absaddr, IntRegs: $src1)>;
4565 let Predicates = [HasV4T], AddedComplexity = 30 in
4566 def : Pat<(truncstorei16 (i32 IntRegs:$src1),
4567 (HexagonCONST32 tglobaladdr:$absaddr)),
4568 (STrih_abs_V4 tglobaladdr: $absaddr, IntRegs: $src1)>;
4570 let Predicates = [HasV4T], AddedComplexity = 30 in
4571 def : Pat<(store (i32 IntRegs:$src1), (HexagonCONST32 tglobaladdr:$absaddr)),
4572 (STriw_abs_V4 tglobaladdr: $absaddr, IntRegs: $src1)>;
4575 multiclass LD_abs<string OpcStr> {
4576 let isPredicable = 1 in
4577 def _abs_V4 : LDInst2<(outs IntRegs:$dst),
4578 (ins globaladdress:$absaddr),
4579 !strconcat("$dst = ", !strconcat(OpcStr, "(##$absaddr)")),
4583 let isPredicated = 1 in
4584 def _abs_cPt_V4 : LDInst2<(outs IntRegs:$dst),
4585 (ins PredRegs:$src1, globaladdress:$absaddr),
4586 !strconcat("if ($src1) $dst = ",
4587 !strconcat(OpcStr, "(##$absaddr)")),
4591 let isPredicated = 1 in
4592 def _abs_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
4593 (ins PredRegs:$src1, globaladdress:$absaddr),
4594 !strconcat("if (!$src1) $dst = ",
4595 !strconcat(OpcStr, "(##$absaddr)")),
4599 let isPredicated = 1 in
4600 def _abs_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
4601 (ins PredRegs:$src1, globaladdress:$absaddr),
4602 !strconcat("if ($src1.new) $dst = ",
4603 !strconcat(OpcStr, "(##$absaddr)")),
4607 let isPredicated = 1 in
4608 def _abs_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
4609 (ins PredRegs:$src1, globaladdress:$absaddr),
4610 !strconcat("if (!$src1.new) $dst = ",
4611 !strconcat(OpcStr, "(##$absaddr)")),
4616 let AddedComplexity = 30 in
4617 def LDrid_abs_V4 : LDInst<(outs DoubleRegs:$dst),
4618 (ins globaladdress:$absaddr),
4619 "$dst = memd(##$absaddr)",
4620 [(set (i64 DoubleRegs:$dst),
4621 (load (HexagonCONST32 tglobaladdr:$absaddr)))]>,
4624 let AddedComplexity = 30, isPredicated = 1 in
4625 def LDrid_abs_cPt_V4 : LDInst2<(outs DoubleRegs:$dst),
4626 (ins PredRegs:$src1, globaladdress:$absaddr),
4627 "if ($src1) $dst = memd(##$absaddr)",
4631 let AddedComplexity = 30, isPredicated = 1 in
4632 def LDrid_abs_cNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
4633 (ins PredRegs:$src1, globaladdress:$absaddr),
4634 "if (!$src1) $dst = memd(##$absaddr)",
4638 let AddedComplexity = 30, isPredicated = 1 in
4639 def LDrid_abs_cdnPt_V4 : LDInst2<(outs DoubleRegs:$dst),
4640 (ins PredRegs:$src1, globaladdress:$absaddr),
4641 "if ($src1.new) $dst = memd(##$absaddr)",
4645 let AddedComplexity = 30, isPredicated = 1 in
4646 def LDrid_abs_cdnNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
4647 (ins PredRegs:$src1, globaladdress:$absaddr),
4648 "if (!$src1.new) $dst = memd(##$absaddr)",
4652 defm LDrib : LD_abs<"memb">;
4653 defm LDriub : LD_abs<"memub">;
4654 defm LDrih : LD_abs<"memh">;
4655 defm LDriuh : LD_abs<"memuh">;
4656 defm LDriw : LD_abs<"memw">;
4659 let Predicates = [HasV4T], AddedComplexity = 30 in
4660 def : Pat<(i32 (load (HexagonCONST32 tglobaladdr:$absaddr))),
4661 (LDriw_abs_V4 tglobaladdr: $absaddr)>;
4663 let Predicates = [HasV4T], AddedComplexity=30 in
4664 def : Pat<(i32 (sextloadi8 (HexagonCONST32 tglobaladdr:$absaddr))),
4665 (LDrib_abs_V4 tglobaladdr:$absaddr)>;
4667 let Predicates = [HasV4T], AddedComplexity=30 in
4668 def : Pat<(i32 (zextloadi8 (HexagonCONST32 tglobaladdr:$absaddr))),
4669 (LDriub_abs_V4 tglobaladdr:$absaddr)>;
4671 let Predicates = [HasV4T], AddedComplexity=30 in
4672 def : Pat<(i32 (sextloadi16 (HexagonCONST32 tglobaladdr:$absaddr))),
4673 (LDrih_abs_V4 tglobaladdr:$absaddr)>;
4675 let Predicates = [HasV4T], AddedComplexity=30 in
4676 def : Pat<(i32 (zextloadi16 (HexagonCONST32 tglobaladdr:$absaddr))),
4677 (LDriuh_abs_V4 tglobaladdr:$absaddr)>;
4679 // Transfer global address into a register
4680 let AddedComplexity=50, isMoveImm = 1, isReMaterializable = 1 in
4681 def TFRI_V4 : ALU32_ri<(outs IntRegs:$dst), (ins globaladdress:$src1),
4683 [(set IntRegs:$dst, (HexagonCONST32 tglobaladdr:$src1))]>,
4686 let AddedComplexity=50, neverHasSideEffects = 1, isPredicated = 1 in
4687 def TFRI_cPt_V4 : ALU32_ri<(outs IntRegs:$dst),
4688 (ins PredRegs:$src1, globaladdress:$src2),
4689 "if($src1) $dst = ##$src2",
4693 let AddedComplexity=50, neverHasSideEffects = 1, isPredicated = 1 in
4694 def TFRI_cNotPt_V4 : ALU32_ri<(outs IntRegs:$dst),
4695 (ins PredRegs:$src1, globaladdress:$src2),
4696 "if(!$src1) $dst = ##$src2",
4700 let AddedComplexity=50, neverHasSideEffects = 1, isPredicated = 1 in
4701 def TFRI_cdnPt_V4 : ALU32_ri<(outs IntRegs:$dst),
4702 (ins PredRegs:$src1, globaladdress:$src2),
4703 "if($src1.new) $dst = ##$src2",
4707 let AddedComplexity=50, neverHasSideEffects = 1, isPredicated = 1 in
4708 def TFRI_cdnNotPt_V4 : ALU32_ri<(outs IntRegs:$dst),
4709 (ins PredRegs:$src1, globaladdress:$src2),
4710 "if(!$src1.new) $dst = ##$src2",
4714 let AddedComplexity = 50, Predicates = [HasV4T] in
4715 def : Pat<(HexagonCONST32_GP tglobaladdr:$src1),
4716 (TFRI_V4 tglobaladdr:$src1)>;
4719 // Load - Indirect with long offset: These instructions take global address
4721 let AddedComplexity = 10 in
4722 def LDrid_ind_lo_V4 : LDInst<(outs DoubleRegs:$dst),
4723 (ins IntRegs:$src1, u2Imm:$src2, globaladdress:$offset),
4724 "$dst=memd($src1<<#$src2+##$offset)",
4725 [(set (i64 DoubleRegs:$dst),
4726 (load (add (shl IntRegs:$src1, u2ImmPred:$src2),
4727 (HexagonCONST32 tglobaladdr:$offset))))]>,
4730 let AddedComplexity = 10 in
4731 multiclass LD_indirect_lo<string OpcStr, PatFrag OpNode> {
4732 def _lo_V4 : LDInst<(outs IntRegs:$dst),
4733 (ins IntRegs:$src1, u2Imm:$src2, globaladdress:$offset),
4734 !strconcat("$dst = ",
4735 !strconcat(OpcStr, "($src1<<#$src2+##$offset)")),
4737 (i32 (OpNode (add (shl IntRegs:$src1, u2ImmPred:$src2),
4738 (HexagonCONST32 tglobaladdr:$offset)))))]>,
4742 defm LDrib_ind : LD_indirect_lo<"memb", sextloadi8>;
4743 defm LDriub_ind : LD_indirect_lo<"memub", zextloadi8>;
4744 defm LDrih_ind : LD_indirect_lo<"memh", sextloadi16>;
4745 defm LDriuh_ind : LD_indirect_lo<"memuh", zextloadi16>;
4746 defm LDriw_ind : LD_indirect_lo<"memw", load>;
4748 // Store - Indirect with long offset: These instructions take global address
4750 let AddedComplexity = 10 in
4751 def STrid_ind_lo_V4 : STInst<(outs),
4752 (ins IntRegs:$src1, u2Imm:$src2, globaladdress:$src3,
4754 "memd($src1<<#$src2+#$src3) = $src4",
4755 [(store (i64 DoubleRegs:$src4),
4756 (add (shl IntRegs:$src1, u2ImmPred:$src2),
4757 (HexagonCONST32 tglobaladdr:$src3)))]>,
4760 let AddedComplexity = 10 in
4761 multiclass ST_indirect_lo<string OpcStr, PatFrag OpNode> {
4762 def _lo_V4 : STInst<(outs),
4763 (ins IntRegs:$src1, u2Imm:$src2, globaladdress:$src3,
4765 !strconcat(OpcStr, "($src1<<#$src2+##$src3) = $src4"),
4766 [(OpNode (i32 IntRegs:$src4),
4767 (add (shl IntRegs:$src1, u2ImmPred:$src2),
4768 (HexagonCONST32 tglobaladdr:$src3)))]>,
4772 defm STrib_ind : ST_indirect_lo<"memb", truncstorei8>;
4773 defm STrih_ind : ST_indirect_lo<"memh", truncstorei16>;
4774 defm STriw_ind : ST_indirect_lo<"memw", store>;
4776 // Store - absolute addressing mode: These instruction take constant
4777 // value as the extended operand
4778 multiclass ST_absimm<string OpcStr> {
4779 let isPredicable = 1 in
4780 def _abs_V4 : STInst2<(outs),
4781 (ins u6Imm:$src1, IntRegs:$src2),
4782 !strconcat(OpcStr, "(#$src1) = $src2"),
4786 let isPredicated = 1 in
4787 def _abs_cPt_V4 : STInst2<(outs),
4788 (ins PredRegs:$src1, u6Imm:$src2, IntRegs:$src3),
4789 !strconcat("if ($src1)", !strconcat(OpcStr, "(#$src2) = $src3")),
4793 let isPredicated = 1 in
4794 def _abs_cNotPt_V4 : STInst2<(outs),
4795 (ins PredRegs:$src1, u6Imm:$src2, IntRegs:$src3),
4796 !strconcat("if (!$src1)", !strconcat(OpcStr, "(#$src2) = $src3")),
4800 let isPredicated = 1 in
4801 def _abs_cdnPt_V4 : STInst2<(outs),
4802 (ins PredRegs:$src1, u6Imm:$src2, IntRegs:$src3),
4803 !strconcat("if ($src1.new)",
4804 !strconcat(OpcStr, "(#$src2) = $src3")),
4808 let isPredicated = 1 in
4809 def _abs_cdnNotPt_V4 : STInst2<(outs),
4810 (ins PredRegs:$src1, u6Imm:$src2, IntRegs:$src3),
4811 !strconcat("if (!$src1.new)",
4812 !strconcat(OpcStr, "(#$src2) = $src3")),
4816 def _abs_nv_V4 : STInst2<(outs),
4817 (ins u6Imm:$src1, IntRegs:$src2),
4818 !strconcat(OpcStr, "(#$src1) = $src2.new"),
4822 let isPredicated = 1 in
4823 def _abs_cPt_nv_V4 : STInst2<(outs),
4824 (ins PredRegs:$src1, u6Imm:$src2, IntRegs:$src3),
4825 !strconcat("if ($src1)",
4826 !strconcat(OpcStr, "(#$src2) = $src3.new")),
4830 let isPredicated = 1 in
4831 def _abs_cNotPt_nv_V4 : STInst2<(outs),
4832 (ins PredRegs:$src1, u6Imm:$src2, IntRegs:$src3),
4833 !strconcat("if (!$src1)",
4834 !strconcat(OpcStr, "(#$src2) = $src3.new")),
4838 let isPredicated = 1 in
4839 def _abs_cdnPt_nv_V4 : STInst2<(outs),
4840 (ins PredRegs:$src1, u6Imm:$src2, IntRegs:$src3),
4841 !strconcat("if ($src1.new)",
4842 !strconcat(OpcStr, "(#$src2) = $src3.new")),
4846 let isPredicated = 1 in
4847 def _abs_cdnNotPt_nv_V4 : STInst2<(outs),
4848 (ins PredRegs:$src1, u6Imm:$src2, IntRegs:$src3),
4849 !strconcat("if (!$src1.new)",
4850 !strconcat(OpcStr, "(#$src2) = $src3.new")),
4855 defm STrib_imm : ST_absimm<"memb">;
4856 defm STrih_imm : ST_absimm<"memh">;
4857 defm STriw_imm : ST_absimm<"memw">;
4859 let Predicates = [HasV4T], AddedComplexity = 30 in
4860 def : Pat<(truncstorei8 (i32 IntRegs:$src1), u6ImmPred:$src2),
4861 (STrib_imm_abs_V4 u6ImmPred:$src2, IntRegs: $src1)>;
4863 let Predicates = [HasV4T], AddedComplexity = 30 in
4864 def : Pat<(truncstorei16 (i32 IntRegs:$src1), u6ImmPred:$src2),
4865 (STrih_imm_abs_V4 u6ImmPred:$src2, IntRegs: $src1)>;
4867 let Predicates = [HasV4T], AddedComplexity = 30 in
4868 def : Pat<(store (i32 IntRegs:$src1), u6ImmPred:$src2),
4869 (STriw_imm_abs_V4 u6ImmPred:$src2, IntRegs: $src1)>;
4872 // Load - absolute addressing mode: These instruction take constant
4873 // value as the extended operand
4875 multiclass LD_absimm<string OpcStr> {
4876 let isPredicable = 1 in
4877 def _abs_V4 : LDInst2<(outs IntRegs:$dst),
4879 !strconcat("$dst = ",
4880 !strconcat(OpcStr, "(#$src)")),
4884 let isPredicated = 1 in
4885 def _abs_cPt_V4 : LDInst2<(outs IntRegs:$dst),
4886 (ins PredRegs:$src1, u6Imm:$src2),
4887 !strconcat("if ($src1) $dst = ",
4888 !strconcat(OpcStr, "(#$src2)")),
4892 let isPredicated = 1 in
4893 def _abs_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
4894 (ins PredRegs:$src1, u6Imm:$src2),
4895 !strconcat("if (!$src1) $dst = ",
4896 !strconcat(OpcStr, "(#$src2)")),
4900 let isPredicated = 1 in
4901 def _abs_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
4902 (ins PredRegs:$src1, u6Imm:$src2),
4903 !strconcat("if ($src1.new) $dst = ",
4904 !strconcat(OpcStr, "(#$src2)")),
4908 let isPredicated = 1 in
4909 def _abs_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
4910 (ins PredRegs:$src1, u6Imm:$src2),
4911 !strconcat("if (!$src1.new) $dst = ",
4912 !strconcat(OpcStr, "(#$src2)")),
4917 defm LDrib_imm : LD_absimm<"memb">;
4918 defm LDriub_imm : LD_absimm<"memub">;
4919 defm LDrih_imm : LD_absimm<"memh">;
4920 defm LDriuh_imm : LD_absimm<"memuh">;
4921 defm LDriw_imm : LD_absimm<"memw">;
4923 let Predicates = [HasV4T], AddedComplexity = 30 in
4924 def : Pat<(i32 (load u6ImmPred:$src)),
4925 (LDriw_imm_abs_V4 u6ImmPred:$src)>;
4927 let Predicates = [HasV4T], AddedComplexity=30 in
4928 def : Pat<(i32 (sextloadi8 u6ImmPred:$src)),
4929 (LDrib_imm_abs_V4 u6ImmPred:$src)>;
4931 let Predicates = [HasV4T], AddedComplexity=30 in
4932 def : Pat<(i32 (zextloadi8 u6ImmPred:$src)),
4933 (LDriub_imm_abs_V4 u6ImmPred:$src)>;
4935 let Predicates = [HasV4T], AddedComplexity=30 in
4936 def : Pat<(i32 (sextloadi16 u6ImmPred:$src)),
4937 (LDrih_imm_abs_V4 u6ImmPred:$src)>;
4939 let Predicates = [HasV4T], AddedComplexity=30 in
4940 def : Pat<(i32 (zextloadi16 u6ImmPred:$src)),
4941 (LDriuh_imm_abs_V4 u6ImmPred:$src)>;
4944 // Indexed store double word - global address.
4945 // memw(Rs+#u6:2)=#S8
4946 let AddedComplexity = 10 in
4947 def STriw_offset_ext_V4 : STInst<(outs),
4948 (ins IntRegs:$src1, u6_2Imm:$src2, globaladdress:$src3),
4949 "memw($src1+#$src2) = ##$src3",
4950 [(store (HexagonCONST32 tglobaladdr:$src3),
4951 (add IntRegs:$src1, u6_2ImmPred:$src2))]>,
4955 // Indexed store double word - global address.
4956 // memw(Rs+#u6:2)=#S8
4957 let AddedComplexity = 10 in
4958 def STrih_offset_ext_V4 : STInst<(outs),
4959 (ins IntRegs:$src1, u6_1Imm:$src2, globaladdress:$src3),
4960 "memh($src1+#$src2) = ##$src3",
4961 [(truncstorei16 (HexagonCONST32 tglobaladdr:$src3),
4962 (add IntRegs:$src1, u6_1ImmPred:$src2))]>,