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 class T_Immext<dag ins> :
16 EXTENDERInst<(outs), ins, "immext(#$imm)", []>,
19 def IMMEXT_b : T_Immext<(ins brtarget:$imm)>;
20 def IMMEXT_c : T_Immext<(ins calltarget:$imm)>;
21 def IMMEXT_g : T_Immext<(ins globaladdress:$imm)>;
22 def IMMEXT_i : T_Immext<(ins u26_6Imm:$imm)>;
24 // Hexagon V4 Architecture spec defines 8 instruction classes:
25 // LD ST ALU32 XTYPE J JR MEMOP NV CR SYSTEM(system is not implemented in the
29 // ========================================
30 // Loads (8/16/32/64 bit)
34 // ========================================
35 // Stores (8/16/32/64 bit)
38 // ALU32 Instructions:
39 // ========================================
40 // Arithmetic / Logical (32 bit)
43 // XTYPE Instructions (32/64 bit):
44 // ========================================
45 // Arithmetic, Logical, Bit Manipulation
46 // Multiply (Integer, Fractional, Complex)
47 // Permute / Vector Permute Operations
48 // Predicate Operations
49 // Shift / Shift with Add/Sub/Logical
51 // Vector Halfword (ALU, Shift, Multiply)
52 // Vector Word (ALU, Shift)
55 // ========================================
56 // Jump/Call PC-relative
59 // ========================================
62 // MEMOP Instructions:
63 // ========================================
64 // Operation on memory (8/16/32 bit)
67 // ========================================
72 // ========================================
73 // Control-Register Transfers
74 // Hardware Loop Setup
75 // Predicate Logicals & Reductions
77 // SYSTEM Instructions (not implemented in the compiler):
78 // ========================================
84 //===----------------------------------------------------------------------===//
86 //===----------------------------------------------------------------------===//
90 let isPredicated = 1, neverHasSideEffects = 1, validSubTargets = HasV4SubT in {
91 def ASLH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
92 (ins PredRegs:$src1, IntRegs:$src2),
93 "if ($src1) $dst = aslh($src2)",
97 def ASLH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
98 (ins PredRegs:$src1, IntRegs:$src2),
99 "if (!$src1) $dst = aslh($src2)",
103 def ASLH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
104 (ins PredRegs:$src1, IntRegs:$src2),
105 "if ($src1.new) $dst = aslh($src2)",
109 def ASLH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
110 (ins PredRegs:$src1, IntRegs:$src2),
111 "if (!$src1.new) $dst = aslh($src2)",
115 def ASRH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
116 (ins PredRegs:$src1, IntRegs:$src2),
117 "if ($src1) $dst = asrh($src2)",
121 def ASRH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
122 (ins PredRegs:$src1, IntRegs:$src2),
123 "if (!$src1) $dst = asrh($src2)",
127 def ASRH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
128 (ins PredRegs:$src1, IntRegs:$src2),
129 "if ($src1.new) $dst = asrh($src2)",
133 def ASRH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
134 (ins PredRegs:$src1, IntRegs:$src2),
135 "if (!$src1.new) $dst = asrh($src2)",
142 let isPredicated = 1, neverHasSideEffects = 1, validSubTargets = HasV4SubT in {
143 def SXTB_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
144 (ins PredRegs:$src1, IntRegs:$src2),
145 "if ($src1) $dst = sxtb($src2)",
149 def SXTB_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
150 (ins PredRegs:$src1, IntRegs:$src2),
151 "if (!$src1) $dst = sxtb($src2)",
155 def SXTB_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
156 (ins PredRegs:$src1, IntRegs:$src2),
157 "if ($src1.new) $dst = sxtb($src2)",
161 def SXTB_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
162 (ins PredRegs:$src1, IntRegs:$src2),
163 "if (!$src1.new) $dst = sxtb($src2)",
168 def SXTH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
169 (ins PredRegs:$src1, IntRegs:$src2),
170 "if ($src1) $dst = sxth($src2)",
174 def SXTH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
175 (ins PredRegs:$src1, IntRegs:$src2),
176 "if (!$src1) $dst = sxth($src2)",
180 def SXTH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
181 (ins PredRegs:$src1, IntRegs:$src2),
182 "if ($src1.new) $dst = sxth($src2)",
186 def SXTH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
187 (ins PredRegs:$src1, IntRegs:$src2),
188 "if (!$src1.new) $dst = sxth($src2)",
195 let neverHasSideEffects = 1, isPredicated = 1, validSubTargets = HasV4SubT in {
196 def ZXTB_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
197 (ins PredRegs:$src1, IntRegs:$src2),
198 "if ($src1) $dst = zxtb($src2)",
202 def ZXTB_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
203 (ins PredRegs:$src1, IntRegs:$src2),
204 "if (!$src1) $dst = zxtb($src2)",
208 def ZXTB_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
209 (ins PredRegs:$src1, IntRegs:$src2),
210 "if ($src1.new) $dst = zxtb($src2)",
214 def ZXTB_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
215 (ins PredRegs:$src1, IntRegs:$src2),
216 "if (!$src1.new) $dst = zxtb($src2)",
220 def ZXTH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
221 (ins PredRegs:$src1, IntRegs:$src2),
222 "if ($src1) $dst = zxth($src2)",
226 def ZXTH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
227 (ins PredRegs:$src1, IntRegs:$src2),
228 "if (!$src1) $dst = zxth($src2)",
232 def ZXTH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
233 (ins PredRegs:$src1, IntRegs:$src2),
234 "if ($src1.new) $dst = zxth($src2)",
238 def ZXTH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
239 (ins PredRegs:$src1, IntRegs:$src2),
240 "if (!$src1.new) $dst = zxth($src2)",
245 // Generate frame index addresses.
246 let neverHasSideEffects = 1, isReMaterializable = 1,
247 isExtended = 1, opExtendable = 2, validSubTargets = HasV4SubT in
248 def TFR_FI_immext_V4 : ALU32_ri<(outs IntRegs:$dst),
249 (ins IntRegs:$src1, s32Imm:$offset),
250 "$dst = add($src1, ##$offset)",
255 //===----------------------------------------------------------------------===//
257 //===----------------------------------------------------------------------===//
260 //===----------------------------------------------------------------------===//
262 //===----------------------------------------------------------------------===//
265 // Rdd=combine(Rs, #s8)
266 let isExtendable = 1, opExtendable = 2, isExtentSigned = 1, opExtentBits = 8,
267 neverHasSideEffects = 1, validSubTargets = HasV4SubT in
268 def COMBINE_rI_V4 : ALU32_ri<(outs DoubleRegs:$dst),
269 (ins IntRegs:$src1, s8Ext:$src2),
270 "$dst = combine($src1, #$src2)",
274 // Rdd=combine(#s8, Rs)
275 let isExtendable = 1, opExtendable = 1, isExtentSigned = 1, opExtentBits = 8,
276 neverHasSideEffects = 1, validSubTargets = HasV4SubT in
277 def COMBINE_Ir_V4 : ALU32_ir<(outs DoubleRegs:$dst),
278 (ins s8Ext:$src1, IntRegs:$src2),
279 "$dst = combine(#$src1, $src2)",
283 def HexagonWrapperCombineRI_V4 :
284 SDNode<"HexagonISD::WrapperCombineRI_V4", SDTHexagonI64I32I32>;
285 def HexagonWrapperCombineIR_V4 :
286 SDNode<"HexagonISD::WrapperCombineIR_V4", SDTHexagonI64I32I32>;
288 def : Pat <(HexagonWrapperCombineRI_V4 IntRegs:$r, s8ExtPred:$i),
289 (COMBINE_rI_V4 IntRegs:$r, s8ExtPred:$i)>,
292 def : Pat <(HexagonWrapperCombineIR_V4 s8ExtPred:$i, IntRegs:$r),
293 (COMBINE_Ir_V4 s8ExtPred:$i, IntRegs:$r)>,
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 isExtended = 1, opExtendable = 2, neverHasSideEffects = 1,
316 validSubTargets = HasV4SubT in {
317 def LDrid_abs_setimm_V4 : LDInst2<(outs DoubleRegs:$dst1, IntRegs:$dst2),
318 (ins u0AlwaysExt:$addr),
319 "$dst1 = memd($dst2=##$addr)",
324 def LDrib_abs_setimm_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
325 (ins u0AlwaysExt:$addr),
326 "$dst1 = memb($dst2=##$addr)",
331 def LDrih_abs_setimm_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
332 (ins u0AlwaysExt:$addr),
333 "$dst1 = memh($dst2=##$addr)",
338 def LDriub_abs_setimm_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
339 (ins u0AlwaysExt:$addr),
340 "$dst1 = memub($dst2=##$addr)",
345 def LDriuh_abs_setimm_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
346 (ins u0AlwaysExt:$addr),
347 "$dst1 = memuh($dst2=##$addr)",
352 def LDriw_abs_setimm_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
353 (ins u0AlwaysExt:$addr),
354 "$dst1 = memw($dst2=##$addr)",
359 // Following patterns are defined for absolute set addressing mode
360 // instruction which take global address as operand.
361 let isExtended = 1, opExtendable = 2, neverHasSideEffects = 1,
362 validSubTargets = HasV4SubT in {
363 def LDrid_abs_set_V4 : LDInst2<(outs DoubleRegs:$dst1, IntRegs:$dst2),
364 (ins globaladdressExt:$addr),
365 "$dst1 = memd($dst2=##$addr)",
370 def LDrib_abs_set_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
371 (ins globaladdressExt:$addr),
372 "$dst1 = memb($dst2=##$addr)",
377 def LDrih_abs_set_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
378 (ins globaladdressExt:$addr),
379 "$dst1 = memh($dst2=##$addr)",
384 def LDriub_abs_set_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
385 (ins globaladdressExt:$addr),
386 "$dst1 = memub($dst2=##$addr)",
391 def LDriuh_abs_set_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
392 (ins globaladdressExt:$addr),
393 "$dst1 = memuh($dst2=##$addr)",
398 def LDriw_abs_set_V4 : LDInst2<(outs IntRegs:$dst1, IntRegs:$dst2),
399 (ins globaladdressExt:$addr),
400 "$dst1 = memw($dst2=##$addr)",
405 // multiclass for load instructions with base + register offset
407 multiclass ld_idxd_shl_pbase<string mnemonic, RegisterClass RC, bit isNot,
409 let PNewValue = !if(isPredNew, "new", "") in
410 def NAME : LDInst2<(outs RC:$dst),
411 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, u2Imm:$offset),
412 !if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
413 ") ")#"$dst = "#mnemonic#"($src2+$src3<<#$offset)",
414 []>, Requires<[HasV4T]>;
417 multiclass ld_idxd_shl_pred<string mnemonic, RegisterClass RC, bit PredNot> {
418 let PredSense = !if(PredNot, "false", "true") in {
419 defm _c#NAME : ld_idxd_shl_pbase<mnemonic, RC, PredNot, 0>;
421 defm _cdn#NAME : ld_idxd_shl_pbase<mnemonic, RC, PredNot, 1>;
425 let neverHasSideEffects = 1 in
426 multiclass ld_idxd_shl<string mnemonic, string CextOp, RegisterClass RC> {
427 let CextOpcode = CextOp, BaseOpcode = CextOp#_indexed_shl in {
428 let isPredicable = 1 in
429 def NAME#_V4 : LDInst2<(outs RC:$dst),
430 (ins IntRegs:$src1, IntRegs:$src2, u2Imm:$offset),
431 "$dst = "#mnemonic#"($src1+$src2<<#$offset)",
432 []>, Requires<[HasV4T]>;
434 let isPredicated = 1 in {
435 defm Pt_V4 : ld_idxd_shl_pred<mnemonic, RC, 0 >;
436 defm NotPt_V4 : ld_idxd_shl_pred<mnemonic, RC, 1>;
441 let addrMode = BaseRegOffset in {
442 defm LDrib_indexed_shl: ld_idxd_shl<"memb", "LDrib", IntRegs>, AddrModeRel;
443 defm LDriub_indexed_shl: ld_idxd_shl<"memub", "LDriub", IntRegs>, AddrModeRel;
444 defm LDrih_indexed_shl: ld_idxd_shl<"memh", "LDrih", IntRegs>, AddrModeRel;
445 defm LDriuh_indexed_shl: ld_idxd_shl<"memuh", "LDriuh", IntRegs>, AddrModeRel;
446 defm LDriw_indexed_shl: ld_idxd_shl<"memw", "LDriw", IntRegs>, AddrModeRel;
447 defm LDrid_indexed_shl: ld_idxd_shl<"memd", "LDrid", DoubleRegs>, AddrModeRel;
450 // 'def pats' for load instructions with base + register offset and non-zero
451 // immediate value. Immediate value is used to left-shift the second
453 let AddedComplexity = 40 in {
454 def : Pat <(i32 (sextloadi8 (add IntRegs:$src1,
455 (shl IntRegs:$src2, u2ImmPred:$offset)))),
456 (LDrib_indexed_shl_V4 IntRegs:$src1,
457 IntRegs:$src2, u2ImmPred:$offset)>,
460 def : Pat <(i32 (zextloadi8 (add IntRegs:$src1,
461 (shl IntRegs:$src2, u2ImmPred:$offset)))),
462 (LDriub_indexed_shl_V4 IntRegs:$src1,
463 IntRegs:$src2, u2ImmPred:$offset)>,
466 def : Pat <(i32 (extloadi8 (add IntRegs:$src1,
467 (shl IntRegs:$src2, u2ImmPred:$offset)))),
468 (LDriub_indexed_shl_V4 IntRegs:$src1,
469 IntRegs:$src2, u2ImmPred:$offset)>,
472 def : Pat <(i32 (sextloadi16 (add IntRegs:$src1,
473 (shl IntRegs:$src2, u2ImmPred:$offset)))),
474 (LDrih_indexed_shl_V4 IntRegs:$src1,
475 IntRegs:$src2, u2ImmPred:$offset)>,
478 def : Pat <(i32 (zextloadi16 (add IntRegs:$src1,
479 (shl IntRegs:$src2, u2ImmPred:$offset)))),
480 (LDriuh_indexed_shl_V4 IntRegs:$src1,
481 IntRegs:$src2, u2ImmPred:$offset)>,
484 def : Pat <(i32 (extloadi16 (add IntRegs:$src1,
485 (shl IntRegs:$src2, u2ImmPred:$offset)))),
486 (LDriuh_indexed_shl_V4 IntRegs:$src1,
487 IntRegs:$src2, u2ImmPred:$offset)>,
490 def : Pat <(i32 (load (add IntRegs:$src1,
491 (shl IntRegs:$src2, u2ImmPred:$offset)))),
492 (LDriw_indexed_shl_V4 IntRegs:$src1,
493 IntRegs:$src2, u2ImmPred:$offset)>,
496 def : Pat <(i64 (load (add IntRegs:$src1,
497 (shl IntRegs:$src2, u2ImmPred:$offset)))),
498 (LDrid_indexed_shl_V4 IntRegs:$src1,
499 IntRegs:$src2, u2ImmPred:$offset)>,
504 // 'def pats' for load instruction base + register offset and
505 // zero immediate value.
506 let AddedComplexity = 10 in {
507 def : Pat <(i64 (load (add IntRegs:$src1, IntRegs:$src2))),
508 (LDrid_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2, 0)>,
511 def : Pat <(i32 (sextloadi8 (add IntRegs:$src1, IntRegs:$src2))),
512 (LDrib_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2, 0)>,
515 def : Pat <(i32 (zextloadi8 (add IntRegs:$src1, IntRegs:$src2))),
516 (LDriub_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2, 0)>,
519 def : Pat <(i32 (extloadi8 (add IntRegs:$src1, IntRegs:$src2))),
520 (LDriub_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2, 0)>,
523 def : Pat <(i32 (sextloadi16 (add IntRegs:$src1, IntRegs:$src2))),
524 (LDrih_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2, 0)>,
527 def : Pat <(i32 (zextloadi16 (add IntRegs:$src1, IntRegs:$src2))),
528 (LDriuh_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2, 0)>,
531 def : Pat <(i32 (extloadi16 (add IntRegs:$src1, IntRegs:$src2))),
532 (LDriuh_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2, 0)>,
535 def : Pat <(i32 (load (add IntRegs:$src1, IntRegs:$src2))),
536 (LDriw_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2, 0)>,
540 /// Load from global offset
542 let isPredicable = 1, neverHasSideEffects = 1 in
543 def LDrid_GP_V4 : LDInst2<(outs DoubleRegs:$dst),
544 (ins globaladdress:$global, u16Imm:$offset),
545 "$dst=memd(#$global+$offset)",
549 let neverHasSideEffects = 1, isPredicated = 1 in
550 def LDrid_GP_cPt_V4 : LDInst2<(outs DoubleRegs:$dst),
551 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
552 "if ($src1) $dst=memd(##$global+$offset)",
556 let neverHasSideEffects = 1, isPredicated = 1 in
557 def LDrid_GP_cNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
558 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
559 "if (!$src1) $dst=memd(##$global+$offset)",
563 let neverHasSideEffects = 1, isPredicated = 1 in
564 def LDrid_GP_cdnPt_V4 : LDInst2<(outs DoubleRegs:$dst),
565 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
566 "if ($src1.new) $dst=memd(##$global+$offset)",
570 let neverHasSideEffects = 1, isPredicated = 1 in
571 def LDrid_GP_cdnNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
572 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
573 "if (!$src1.new) $dst=memd(##$global+$offset)",
577 let isPredicable = 1, neverHasSideEffects = 1 in
578 def LDrib_GP_V4 : LDInst2<(outs IntRegs:$dst),
579 (ins globaladdress:$global, u16Imm:$offset),
580 "$dst=memb(#$global+$offset)",
584 let neverHasSideEffects = 1, isPredicated = 1 in
585 def LDrib_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
586 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
587 "if ($src1) $dst=memb(##$global+$offset)",
591 let neverHasSideEffects = 1, isPredicated = 1 in
592 def LDrib_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
593 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
594 "if (!$src1) $dst=memb(##$global+$offset)",
598 let neverHasSideEffects = 1, isPredicated = 1 in
599 def LDrib_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
600 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
601 "if ($src1.new) $dst=memb(##$global+$offset)",
605 let neverHasSideEffects = 1, isPredicated = 1 in
606 def LDrib_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
607 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
608 "if (!$src1.new) $dst=memb(##$global+$offset)",
613 let isPredicable = 1, neverHasSideEffects = 1 in
614 def LDriub_GP_V4 : LDInst2<(outs IntRegs:$dst),
615 (ins globaladdress:$global, u16Imm:$offset),
616 "$dst=memub(#$global+$offset)",
621 let neverHasSideEffects = 1, isPredicated = 1 in
622 def LDriub_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
623 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
624 "if ($src1) $dst=memub(##$global+$offset)",
628 let neverHasSideEffects = 1, isPredicated = 1 in
629 def LDriub_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
630 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
631 "if (!$src1) $dst=memub(##$global+$offset)",
635 let neverHasSideEffects = 1, isPredicated = 1 in
636 def LDriub_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
637 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
638 "if ($src1.new) $dst=memub(##$global+$offset)",
642 let neverHasSideEffects = 1, isPredicated = 1 in
643 def LDriub_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
644 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
645 "if (!$src1.new) $dst=memub(##$global+$offset)",
650 let isPredicable = 1, neverHasSideEffects = 1 in
651 def LDrih_GP_V4 : LDInst2<(outs IntRegs:$dst),
652 (ins globaladdress:$global, u16Imm:$offset),
653 "$dst=memh(#$global+$offset)",
658 let neverHasSideEffects = 1, isPredicated = 1 in
659 def LDrih_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
660 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
661 "if ($src1) $dst=memh(##$global+$offset)",
665 let neverHasSideEffects = 1, isPredicated = 1 in
666 def LDrih_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
667 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
668 "if (!$src1) $dst=memh(##$global+$offset)",
672 let neverHasSideEffects = 1, isPredicated = 1 in
673 def LDrih_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
674 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
675 "if ($src1.new) $dst=memh(##$global+$offset)",
679 let neverHasSideEffects = 1, isPredicated = 1 in
680 def LDrih_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
681 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
682 "if (!$src1.new) $dst=memh(##$global+$offset)",
687 let isPredicable = 1, neverHasSideEffects = 1 in
688 def LDriuh_GP_V4 : LDInst2<(outs IntRegs:$dst),
689 (ins globaladdress:$global, u16Imm:$offset),
690 "$dst=memuh(#$global+$offset)",
694 let neverHasSideEffects = 1, isPredicated = 1 in
695 def LDriuh_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
696 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
697 "if ($src1) $dst=memuh(##$global+$offset)",
701 let neverHasSideEffects = 1, isPredicated = 1 in
702 def LDriuh_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
703 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
704 "if (!$src1) $dst=memuh(##$global+$offset)",
708 let neverHasSideEffects = 1, isPredicated = 1 in
709 def LDriuh_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
710 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
711 "if ($src1.new) $dst=memuh(##$global+$offset)",
715 let neverHasSideEffects = 1, isPredicated = 1 in
716 def LDriuh_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
717 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
718 "if (!$src1.new) $dst=memuh(##$global+$offset)",
722 let isPredicable = 1, neverHasSideEffects = 1 in
723 def LDriw_GP_V4 : LDInst2<(outs IntRegs:$dst),
724 (ins globaladdress:$global, u16Imm:$offset),
725 "$dst=memw(#$global+$offset)",
730 let neverHasSideEffects = 1, isPredicated = 1 in
731 def LDriw_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
732 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
733 "if ($src1) $dst=memw(##$global+$offset)",
737 let neverHasSideEffects = 1, isPredicated = 1 in
738 def LDriw_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
739 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
740 "if (!$src1) $dst=memw(##$global+$offset)",
745 let neverHasSideEffects = 1, isPredicated = 1 in
746 def LDriw_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
747 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
748 "if ($src1.new) $dst=memw(##$global+$offset)",
752 let neverHasSideEffects = 1, isPredicated = 1 in
753 def LDriw_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
754 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset),
755 "if (!$src1.new) $dst=memw(##$global+$offset)",
760 let isPredicable = 1, neverHasSideEffects = 1, validSubTargets = HasV4SubT in
761 def LDd_GP_V4 : LDInst2<(outs DoubleRegs:$dst),
762 (ins globaladdress:$global),
763 "$dst=memd(#$global)",
767 // if (Pv) Rtt=memd(##global)
768 let neverHasSideEffects = 1, isPredicated = 1, isExtended = 1, opExtendable = 2,
769 validSubTargets = HasV4SubT in {
770 def LDd_GP_cPt_V4 : LDInst2<(outs DoubleRegs:$dst),
771 (ins PredRegs:$src1, globaladdress:$global),
772 "if ($src1) $dst=memd(##$global)",
777 // if (!Pv) Rtt=memd(##global)
778 def LDd_GP_cNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
779 (ins PredRegs:$src1, globaladdress:$global),
780 "if (!$src1) $dst=memd(##$global)",
784 // if (Pv) Rtt=memd(##global)
785 def LDd_GP_cdnPt_V4 : LDInst2<(outs DoubleRegs:$dst),
786 (ins PredRegs:$src1, globaladdress:$global),
787 "if ($src1.new) $dst=memd(##$global)",
792 // if (!Pv) Rtt=memd(##global)
793 def LDd_GP_cdnNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
794 (ins PredRegs:$src1, globaladdress:$global),
795 "if (!$src1.new) $dst=memd(##$global)",
800 let isPredicable = 1, neverHasSideEffects = 1, validSubTargets = HasV4SubT in
801 def LDb_GP_V4 : LDInst2<(outs IntRegs:$dst),
802 (ins globaladdress:$global),
803 "$dst=memb(#$global)",
807 // if (Pv) Rt=memb(##global)
808 let neverHasSideEffects = 1, isPredicated = 1, isExtended = 1, opExtendable = 2,
809 validSubTargets = HasV4SubT in {
810 def LDb_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
811 (ins PredRegs:$src1, globaladdress:$global),
812 "if ($src1) $dst=memb(##$global)",
816 // if (!Pv) Rt=memb(##global)
817 def LDb_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
818 (ins PredRegs:$src1, globaladdress:$global),
819 "if (!$src1) $dst=memb(##$global)",
823 // if (Pv) Rt=memb(##global)
824 def LDb_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
825 (ins PredRegs:$src1, globaladdress:$global),
826 "if ($src1.new) $dst=memb(##$global)",
830 // if (!Pv) Rt=memb(##global)
831 def LDb_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
832 (ins PredRegs:$src1, globaladdress:$global),
833 "if (!$src1.new) $dst=memb(##$global)",
838 let isPredicable = 1, neverHasSideEffects = 1, validSubTargets = HasV4SubT in
839 def LDub_GP_V4 : LDInst2<(outs IntRegs:$dst),
840 (ins globaladdress:$global),
841 "$dst=memub(#$global)",
845 // if (Pv) Rt=memub(##global)
846 let neverHasSideEffects = 1, isPredicated = 1, isExtended = 1, opExtendable = 2,
847 validSubTargets = HasV4SubT in {
848 def LDub_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
849 (ins PredRegs:$src1, globaladdress:$global),
850 "if ($src1) $dst=memub(##$global)",
855 // if (!Pv) Rt=memub(##global)
856 def LDub_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
857 (ins PredRegs:$src1, globaladdress:$global),
858 "if (!$src1) $dst=memub(##$global)",
862 // if (Pv) Rt=memub(##global)
863 def LDub_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
864 (ins PredRegs:$src1, globaladdress:$global),
865 "if ($src1.new) $dst=memub(##$global)",
870 // if (!Pv) Rt=memub(##global)
871 def LDub_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
872 (ins PredRegs:$src1, globaladdress:$global),
873 "if (!$src1.new) $dst=memub(##$global)",
878 let isPredicable = 1, neverHasSideEffects = 1, validSubTargets = HasV4SubT in
879 def LDh_GP_V4 : LDInst2<(outs IntRegs:$dst),
880 (ins globaladdress:$global),
881 "$dst=memh(#$global)",
885 // if (Pv) Rt=memh(##global)
886 let neverHasSideEffects = 1, isPredicated = 1, isExtended = 1, opExtendable = 2,
887 validSubTargets = HasV4SubT in {
888 def LDh_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
889 (ins PredRegs:$src1, globaladdress:$global),
890 "if ($src1) $dst=memh(##$global)",
894 // if (!Pv) Rt=memh(##global)
895 def LDh_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
896 (ins PredRegs:$src1, globaladdress:$global),
897 "if (!$src1) $dst=memh(##$global)",
901 // if (Pv) Rt=memh(##global)
902 def LDh_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
903 (ins PredRegs:$src1, globaladdress:$global),
904 "if ($src1.new) $dst=memh(##$global)",
908 // if (!Pv) Rt=memh(##global)
909 def LDh_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
910 (ins PredRegs:$src1, globaladdress:$global),
911 "if (!$src1.new) $dst=memh(##$global)",
916 let isPredicable = 1, neverHasSideEffects = 1, validSubTargets = HasV4SubT in
917 def LDuh_GP_V4 : LDInst2<(outs IntRegs:$dst),
918 (ins globaladdress:$global),
919 "$dst=memuh(#$global)",
923 // if (Pv) Rt=memuh(##global)
924 let neverHasSideEffects = 1, isPredicated = 1, isExtended = 1, opExtendable = 2,
925 validSubTargets = HasV4SubT in {
926 def LDuh_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
927 (ins PredRegs:$src1, globaladdress:$global),
928 "if ($src1) $dst=memuh(##$global)",
932 // if (!Pv) Rt=memuh(##global)
933 def LDuh_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
934 (ins PredRegs:$src1, globaladdress:$global),
935 "if (!$src1) $dst=memuh(##$global)",
939 // if (Pv) Rt=memuh(##global)
940 def LDuh_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
941 (ins PredRegs:$src1, globaladdress:$global),
942 "if ($src1.new) $dst=memuh(##$global)",
946 // if (!Pv) Rt=memuh(##global)
947 def LDuh_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
948 (ins PredRegs:$src1, globaladdress:$global),
949 "if (!$src1.new) $dst=memuh(##$global)",
954 let isPredicable = 1, neverHasSideEffects = 1, validSubTargets = HasV4SubT in
955 def LDw_GP_V4 : LDInst2<(outs IntRegs:$dst),
956 (ins globaladdress:$global),
957 "$dst=memw(#$global)",
961 // if (Pv) Rt=memw(##global)
962 let neverHasSideEffects = 1, isPredicated = 1, isExtended = 1, opExtendable = 2,
963 validSubTargets = HasV4SubT in {
964 def LDw_GP_cPt_V4 : LDInst2<(outs IntRegs:$dst),
965 (ins PredRegs:$src1, globaladdress:$global),
966 "if ($src1) $dst=memw(##$global)",
971 // if (!Pv) Rt=memw(##global)
972 def LDw_GP_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
973 (ins PredRegs:$src1, globaladdress:$global),
974 "if (!$src1) $dst=memw(##$global)",
978 // if (Pv) Rt=memw(##global)
979 def LDw_GP_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
980 (ins PredRegs:$src1, globaladdress:$global),
981 "if ($src1.new) $dst=memw(##$global)",
986 // if (!Pv) Rt=memw(##global)
987 def LDw_GP_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
988 (ins PredRegs:$src1, globaladdress:$global),
989 "if (!$src1.new) $dst=memw(##$global)",
995 def : Pat <(atomic_load_64 (HexagonCONST32_GP tglobaladdr:$global)),
996 (i64 (LDd_GP_V4 tglobaladdr:$global))>,
999 def : Pat <(atomic_load_32 (HexagonCONST32_GP tglobaladdr:$global)),
1000 (i32 (LDw_GP_V4 tglobaladdr:$global))>,
1003 def : Pat <(atomic_load_16 (HexagonCONST32_GP tglobaladdr:$global)),
1004 (i32 (LDuh_GP_V4 tglobaladdr:$global))>,
1007 def : Pat <(atomic_load_8 (HexagonCONST32_GP tglobaladdr:$global)),
1008 (i32 (LDub_GP_V4 tglobaladdr:$global))>,
1011 // Map from load(globaladdress) -> memw(#foo + 0)
1012 let AddedComplexity = 100 in
1013 def : Pat <(i64 (load (HexagonCONST32_GP tglobaladdr:$global))),
1014 (i64 (LDd_GP_V4 tglobaladdr:$global))>,
1017 // Map from Pd = load(globaladdress) -> Rd = memb(globaladdress), Pd = Rd
1018 let AddedComplexity = 100 in
1019 def : Pat <(i1 (load (HexagonCONST32_GP tglobaladdr:$global))),
1020 (i1 (TFR_PdRs (i32 (LDb_GP_V4 tglobaladdr:$global))))>,
1023 // When the Interprocedural Global Variable optimizer realizes that a certain
1024 // global variable takes only two constant values, it shrinks the global to
1025 // a boolean. Catch those loads here in the following 3 patterns.
1026 let AddedComplexity = 100 in
1027 def : Pat <(i32 (extloadi1 (HexagonCONST32_GP tglobaladdr:$global))),
1028 (i32 (LDb_GP_V4 tglobaladdr:$global))>,
1031 let AddedComplexity = 100 in
1032 def : Pat <(i32 (sextloadi1 (HexagonCONST32_GP tglobaladdr:$global))),
1033 (i32 (LDb_GP_V4 tglobaladdr:$global))>,
1036 // Map from load(globaladdress) -> memb(#foo)
1037 let AddedComplexity = 100 in
1038 def : Pat <(i32 (extloadi8 (HexagonCONST32_GP tglobaladdr:$global))),
1039 (i32 (LDb_GP_V4 tglobaladdr:$global))>,
1042 // Map from load(globaladdress) -> memb(#foo)
1043 let AddedComplexity = 100 in
1044 def : Pat <(i32 (sextloadi8 (HexagonCONST32_GP tglobaladdr:$global))),
1045 (i32 (LDb_GP_V4 tglobaladdr:$global))>,
1048 let AddedComplexity = 100 in
1049 def : Pat <(i32 (zextloadi1 (HexagonCONST32_GP tglobaladdr:$global))),
1050 (i32 (LDub_GP_V4 tglobaladdr:$global))>,
1053 // Map from load(globaladdress) -> memub(#foo)
1054 let AddedComplexity = 100 in
1055 def : Pat <(i32 (zextloadi8 (HexagonCONST32_GP tglobaladdr:$global))),
1056 (i32 (LDub_GP_V4 tglobaladdr:$global))>,
1059 // Map from load(globaladdress) -> memh(#foo)
1060 let AddedComplexity = 100 in
1061 def : Pat <(i32 (extloadi16 (HexagonCONST32_GP tglobaladdr:$global))),
1062 (i32 (LDh_GP_V4 tglobaladdr:$global))>,
1065 // Map from load(globaladdress) -> memh(#foo)
1066 let AddedComplexity = 100 in
1067 def : Pat <(i32 (sextloadi16 (HexagonCONST32_GP tglobaladdr:$global))),
1068 (i32 (LDh_GP_V4 tglobaladdr:$global))>,
1071 // Map from load(globaladdress) -> memuh(#foo)
1072 let AddedComplexity = 100 in
1073 def : Pat <(i32 (zextloadi16 (HexagonCONST32_GP tglobaladdr:$global))),
1074 (i32 (LDuh_GP_V4 tglobaladdr:$global))>,
1077 // Map from load(globaladdress) -> memw(#foo)
1078 let AddedComplexity = 100 in
1079 def : Pat <(i32 (load (HexagonCONST32_GP tglobaladdr:$global))),
1080 (i32 (LDw_GP_V4 tglobaladdr:$global))>,
1083 def : Pat <(atomic_load_64 (add (HexagonCONST32_GP tglobaladdr:$global),
1084 u16ImmPred:$offset)),
1085 (i64 (LDrid_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1088 def : Pat <(atomic_load_32 (add (HexagonCONST32_GP tglobaladdr:$global),
1089 u16ImmPred:$offset)),
1090 (i32 (LDriw_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1093 def : Pat <(atomic_load_16 (add (HexagonCONST32_GP tglobaladdr:$global),
1094 u16ImmPred:$offset)),
1095 (i32 (LDriuh_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1098 def : Pat <(atomic_load_8 (add (HexagonCONST32_GP tglobaladdr:$global),
1099 u16ImmPred:$offset)),
1100 (i32 (LDriub_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1103 // Map from load(globaladdress + x) -> memd(#foo + x)
1104 let AddedComplexity = 100 in
1105 def : Pat <(i64 (load (add (HexagonCONST32_GP tglobaladdr:$global),
1106 u16ImmPred:$offset))),
1107 (i64 (LDrid_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1110 // Map from load(globaladdress + x) -> memb(#foo + x)
1111 let AddedComplexity = 100 in
1112 def : Pat <(i32 (extloadi8 (add (HexagonCONST32_GP tglobaladdr:$global),
1113 u16ImmPred:$offset))),
1114 (i32 (LDrib_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1117 // Map from load(globaladdress + x) -> memb(#foo + x)
1118 let AddedComplexity = 100 in
1119 def : Pat <(i32 (sextloadi8 (add (HexagonCONST32_GP tglobaladdr:$global),
1120 u16ImmPred:$offset))),
1121 (i32 (LDrib_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1124 // Map from load(globaladdress + x) -> memub(#foo + x)
1125 let AddedComplexity = 100 in
1126 def : Pat <(i32 (zextloadi8 (add (HexagonCONST32_GP tglobaladdr:$global),
1127 u16ImmPred:$offset))),
1128 (i32 (LDriub_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1131 // Map from load(globaladdress + x) -> memuh(#foo + x)
1132 let AddedComplexity = 100 in
1133 def : Pat <(i32 (extloadi16 (add (HexagonCONST32_GP tglobaladdr:$global),
1134 u16ImmPred:$offset))),
1135 (i32 (LDrih_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1138 // Map from load(globaladdress + x) -> memh(#foo + x)
1139 let AddedComplexity = 100 in
1140 def : Pat <(i32 (sextloadi16 (add (HexagonCONST32_GP tglobaladdr:$global),
1141 u16ImmPred:$offset))),
1142 (i32 (LDrih_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1146 // Map from load(globaladdress + x) -> memuh(#foo + x)
1147 let AddedComplexity = 100 in
1148 def : Pat <(i32 (zextloadi16 (add (HexagonCONST32_GP tglobaladdr:$global),
1149 u16ImmPred:$offset))),
1150 (i32 (LDriuh_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1153 // Map from load(globaladdress + x) -> memw(#foo + x)
1154 let AddedComplexity = 100 in
1155 def : Pat <(i32 (load (add (HexagonCONST32_GP tglobaladdr:$global),
1156 u16ImmPred:$offset))),
1157 (i32 (LDriw_GP_V4 tglobaladdr:$global, u16ImmPred:$offset))>,
1160 def : Pat <(i64 (zext (i1 PredRegs:$src1))),
1161 (i64 (COMBINE_Ir_V4 0, (MUX_ii (i1 PredRegs:$src1), 1, 0)))>,
1165 def : Pat <(i64 (zext (i32 IntRegs:$src1))),
1166 (i64 (COMBINE_Ir_V4 0, (i32 IntRegs:$src1)))>,
1169 def: Pat <(i64 (zextloadi8 ADDRriS11_0:$src1)),
1170 (i64 (COMBINE_Ir_V4 0, (LDriub ADDRriS11_0:$src1)))>,
1173 let AddedComplexity = 20 in
1174 def: Pat <(i64 (zextloadi8 (add (i32 IntRegs:$src1),
1175 s11_0ExtPred:$offset))),
1176 (i64 (COMBINE_Ir_V4 0, (LDriub_indexed IntRegs:$src1,
1177 s11_0ExtPred:$offset)))>,
1181 def: Pat <(i64 (zextloadi16 ADDRriS11_1:$src1)),
1182 (i64 (COMBINE_Ir_V4 0, (LDriuh ADDRriS11_1:$src1)))>,
1185 let AddedComplexity = 20 in
1186 def: Pat <(i64 (zextloadi16 (add (i32 IntRegs:$src1),
1187 s11_1ExtPred:$offset))),
1188 (i64 (COMBINE_Ir_V4 0, (LDriuh_indexed IntRegs:$src1,
1189 s11_1ExtPred:$offset)))>,
1193 def: Pat <(i64 (extloadi16 ADDRriS11_2:$src1)),
1194 (i64 (COMBINE_Ir_V4 0, (LDrih ADDRriS11_2:$src1)))>,
1197 let AddedComplexity = 20 in
1198 def: Pat <(i64 (extloadi16 (add (i32 IntRegs:$src1),
1199 s11_1ExtPred:$offset))),
1200 (i64 (COMBINE_Ir_V4 0, (LDrih_indexed IntRegs:$src1,
1201 s11_1ExtPred:$offset)))>,
1205 def: Pat <(i64 (zextloadi32 ADDRriS11_2:$src1)),
1206 (i64 (COMBINE_Ir_V4 0, (LDriw ADDRriS11_2:$src1)))>,
1209 let AddedComplexity = 100 in
1210 def: Pat <(i64 (zextloadi32 (i32 (add IntRegs:$src1, s11_2ExtPred:$offset)))),
1211 (i64 (COMBINE_Ir_V4 0, (LDriw_indexed IntRegs:$src1,
1212 s11_2ExtPred:$offset)))>,
1216 def: Pat <(i64 (extloadi32 ADDRriS11_2:$src1)),
1217 (i64 (COMBINE_Ir_V4 0, (LDriw ADDRriS11_2:$src1)))>,
1220 let AddedComplexity = 100 in
1221 def: Pat <(i64 (extloadi32 (i32 (add IntRegs:$src1, s11_2ExtPred:$offset)))),
1222 (i64 (COMBINE_Ir_V4 0, (LDriw_indexed IntRegs:$src1,
1223 s11_2ExtPred:$offset)))>,
1228 //===----------------------------------------------------------------------===//
1230 //===----------------------------------------------------------------------===//
1232 //===----------------------------------------------------------------------===//
1234 //===----------------------------------------------------------------------===//
1236 /// Assumptions::: ****** DO NOT IGNORE ********
1237 /// 1. Make sure that in post increment store, the zero'th operand is always the
1238 /// post increment operand.
1239 /// 2. Make sure that the store value operand(Rt/Rtt) in a store is always the
1244 let isExtended = 1, opExtendable = 2, validSubTargets = HasV4SubT in {
1245 def STrid_abs_setimm_V4 : STInst2<(outs IntRegs:$dst1),
1246 (ins DoubleRegs:$src1, u0AlwaysExt:$src2),
1247 "memd($dst1=##$src2) = $src1",
1252 def STrib_abs_setimm_V4 : STInst2<(outs IntRegs:$dst1),
1253 (ins IntRegs:$src1, u0AlwaysExt:$src2),
1254 "memb($dst1=##$src2) = $src1",
1259 def STrih_abs_setimm_V4 : STInst2<(outs IntRegs:$dst1),
1260 (ins IntRegs:$src1, u0AlwaysExt:$src2),
1261 "memh($dst1=##$src2) = $src1",
1266 def STriw_abs_setimm_V4 : STInst2<(outs IntRegs:$dst1),
1267 (ins IntRegs:$src1, u0AlwaysExt:$src2),
1268 "memw($dst1=##$src2) = $src1",
1274 let isExtended = 1, opExtendable = 2, validSubTargets = HasV4SubT in {
1275 def STrid_abs_set_V4 : STInst2<(outs IntRegs:$dst1),
1276 (ins DoubleRegs:$src1, globaladdressExt:$src2),
1277 "memd($dst1=##$src2) = $src1",
1282 def STrib_abs_set_V4 : STInst2<(outs IntRegs:$dst1),
1283 (ins IntRegs:$src1, globaladdressExt:$src2),
1284 "memb($dst1=##$src2) = $src1",
1289 def STrih_abs_set_V4 : STInst2<(outs IntRegs:$dst1),
1290 (ins IntRegs:$src1, globaladdressExt:$src2),
1291 "memh($dst1=##$src2) = $src1",
1296 def STriw_abs_set_V4 : STInst2<(outs IntRegs:$dst1),
1297 (ins IntRegs:$src1, globaladdressExt:$src2),
1298 "memw($dst1=##$src2) = $src1",
1303 // multiclass for store instructions with base + register offset addressing
1305 multiclass ST_Idxd_shl_Pbase<string mnemonic, RegisterClass RC, bit isNot,
1307 let PNewValue = !if(isPredNew, "new", "") in
1308 def NAME : STInst2<(outs),
1309 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, u2Imm:$src4,
1311 !if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
1312 ") ")#mnemonic#"($src2+$src3<<#$src4) = $src5",
1317 multiclass ST_Idxd_shl_Pred<string mnemonic, RegisterClass RC, bit PredNot> {
1318 let PredSense = !if(PredNot, "false", "true") in {
1319 defm _c#NAME : ST_Idxd_shl_Pbase<mnemonic, RC, PredNot, 0>;
1321 defm _cdn#NAME : ST_Idxd_shl_Pbase<mnemonic, RC, PredNot, 1>;
1325 let isNVStorable = 1 in
1326 multiclass ST_Idxd_shl<string mnemonic, string CextOp, RegisterClass RC> {
1327 let CextOpcode = CextOp, BaseOpcode = CextOp#_indexed_shl in {
1328 let isPredicable = 1 in
1329 def NAME#_V4 : STInst2<(outs),
1330 (ins IntRegs:$src1, IntRegs:$src2, u2Imm:$src3, RC:$src4),
1331 mnemonic#"($src1+$src2<<#$src3) = $src4",
1335 let isPredicated = 1 in {
1336 defm Pt_V4 : ST_Idxd_shl_Pred<mnemonic, RC, 0 >;
1337 defm NotPt_V4 : ST_Idxd_shl_Pred<mnemonic, RC, 1>;
1342 // multiclass for new-value store instructions with base + register offset
1344 multiclass ST_Idxd_shl_Pbase_nv<string mnemonic, RegisterClass RC, bit isNot,
1346 let PNewValue = !if(isPredNew, "new", "") in
1347 def NAME#_nv_V4 : NVInst_V4<(outs),
1348 (ins PredRegs:$src1, IntRegs:$src2, IntRegs:$src3, u2Imm:$src4,
1350 !if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
1351 ") ")#mnemonic#"($src2+$src3<<#$src4) = $src5.new",
1356 multiclass ST_Idxd_shl_Pred_nv<string mnemonic, RegisterClass RC, bit PredNot> {
1357 let PredSense = !if(PredNot, "false", "true") in {
1358 defm _c#NAME : ST_Idxd_shl_Pbase_nv<mnemonic, RC, PredNot, 0>;
1360 defm _cdn#NAME : ST_Idxd_shl_Pbase_nv<mnemonic, RC, PredNot, 1>;
1364 let mayStore = 1, isNVStore = 1 in
1365 multiclass ST_Idxd_shl_nv<string mnemonic, string CextOp, RegisterClass RC> {
1366 let CextOpcode = CextOp, BaseOpcode = CextOp#_indexed_shl in {
1367 let isPredicable = 1 in
1368 def NAME#_nv_V4 : NVInst_V4<(outs),
1369 (ins IntRegs:$src1, IntRegs:$src2, u2Imm:$src3, RC:$src4),
1370 mnemonic#"($src1+$src2<<#$src3) = $src4.new",
1374 let isPredicated = 1 in {
1375 defm Pt : ST_Idxd_shl_Pred_nv<mnemonic, RC, 0 >;
1376 defm NotPt : ST_Idxd_shl_Pred_nv<mnemonic, RC, 1>;
1381 let addrMode = BaseRegOffset, neverHasSideEffects = 1,
1382 validSubTargets = HasV4SubT in {
1383 defm STrib_indexed_shl: ST_Idxd_shl<"memb", "STrib", IntRegs>,
1384 ST_Idxd_shl_nv<"memb", "STrib", IntRegs>, AddrModeRel;
1386 defm STrih_indexed_shl: ST_Idxd_shl<"memh", "STrih", IntRegs>,
1387 ST_Idxd_shl_nv<"memh", "STrih", IntRegs>, AddrModeRel;
1389 defm STriw_indexed_shl: ST_Idxd_shl<"memw", "STriw", IntRegs>,
1390 ST_Idxd_shl_nv<"memw", "STriw", IntRegs>, AddrModeRel;
1392 let isNVStorable = 0 in
1393 defm STrid_indexed_shl: ST_Idxd_shl<"memd", "STrid", DoubleRegs>, AddrModeRel;
1396 let Predicates = [HasV4T], AddedComplexity = 10 in {
1397 def : Pat<(truncstorei8 (i32 IntRegs:$src4),
1398 (add IntRegs:$src1, (shl IntRegs:$src2,
1400 (STrib_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2,
1401 u2ImmPred:$src3, IntRegs:$src4)>;
1403 def : Pat<(truncstorei16 (i32 IntRegs:$src4),
1404 (add IntRegs:$src1, (shl IntRegs:$src2,
1406 (STrih_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2,
1407 u2ImmPred:$src3, IntRegs:$src4)>;
1409 def : Pat<(store (i32 IntRegs:$src4),
1410 (add IntRegs:$src1, (shl IntRegs:$src2, u2ImmPred:$src3))),
1411 (STriw_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2,
1412 u2ImmPred:$src3, IntRegs:$src4)>;
1414 def : Pat<(store (i64 DoubleRegs:$src4),
1415 (add IntRegs:$src1, (shl IntRegs:$src2, u2ImmPred:$src3))),
1416 (STrid_indexed_shl_V4 IntRegs:$src1, IntRegs:$src2,
1417 u2ImmPred:$src3, DoubleRegs:$src4)>;
1420 // memd(Ru<<#u2+#U6)=Rtt
1421 let isExtended = 1, opExtendable = 2, AddedComplexity = 10,
1422 validSubTargets = HasV4SubT in
1423 def STrid_shl_V4 : STInst<(outs),
1424 (ins IntRegs:$src1, u2Imm:$src2, u0AlwaysExt:$src3, DoubleRegs:$src4),
1425 "memd($src1<<#$src2+#$src3) = $src4",
1426 [(store (i64 DoubleRegs:$src4),
1427 (add (shl (i32 IntRegs:$src1), u2ImmPred:$src2),
1428 u0AlwaysExtPred:$src3))]>,
1431 // memd(Rx++#s4:3)=Rtt
1432 // memd(Rx++#s4:3:circ(Mu))=Rtt
1433 // memd(Rx++I:circ(Mu))=Rtt
1435 // memd(Rx++Mu:brev)=Rtt
1436 // memd(gp+#u16:3)=Rtt
1438 // Store doubleword conditionally.
1439 // if ([!]Pv[.new]) memd(#u6)=Rtt
1440 // TODO: needs to be implemented.
1442 //===----------------------------------------------------------------------===//
1443 // multiclass for store instructions with base + immediate offset
1444 // addressing mode and immediate stored value.
1445 // mem[bhw](Rx++#s4:3)=#s8
1446 // if ([!]Pv[.new]) mem[bhw](Rx++#s4:3)=#s6
1447 //===----------------------------------------------------------------------===//
1448 multiclass ST_Imm_Pbase<string mnemonic, Operand OffsetOp, bit isNot,
1450 let PNewValue = !if(isPredNew, "new", "") in
1451 def NAME : STInst2<(outs),
1452 (ins PredRegs:$src1, IntRegs:$src2, OffsetOp:$src3, s6Ext:$src4),
1453 !if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
1454 ") ")#mnemonic#"($src2+#$src3) = #$src4",
1459 multiclass ST_Imm_Pred<string mnemonic, Operand OffsetOp, bit PredNot> {
1460 let PredSense = !if(PredNot, "false", "true") in {
1461 defm _c#NAME : ST_Imm_Pbase<mnemonic, OffsetOp, PredNot, 0>;
1463 defm _cdn#NAME : ST_Imm_Pbase<mnemonic, OffsetOp, PredNot, 1>;
1467 let isExtendable = 1, isExtentSigned = 1, neverHasSideEffects = 1 in
1468 multiclass ST_Imm<string mnemonic, string CextOp, Operand OffsetOp> {
1469 let CextOpcode = CextOp, BaseOpcode = CextOp#_imm in {
1470 let opExtendable = 2, opExtentBits = 8, isPredicable = 1 in
1471 def NAME#_V4 : STInst2<(outs),
1472 (ins IntRegs:$src1, OffsetOp:$src2, s8Ext:$src3),
1473 mnemonic#"($src1+#$src2) = #$src3",
1477 let opExtendable = 3, opExtentBits = 6, isPredicated = 1 in {
1478 defm Pt_V4 : ST_Imm_Pred<mnemonic, OffsetOp, 0>;
1479 defm NotPt_V4 : ST_Imm_Pred<mnemonic, OffsetOp, 1 >;
1484 let addrMode = BaseImmOffset, InputType = "imm",
1485 validSubTargets = HasV4SubT in {
1486 defm STrib_imm : ST_Imm<"memb", "STrib", u6_0Imm>, ImmRegRel, PredNewRel;
1487 defm STrih_imm : ST_Imm<"memh", "STrih", u6_1Imm>, ImmRegRel, PredNewRel;
1488 defm STriw_imm : ST_Imm<"memw", "STriw", u6_2Imm>, ImmRegRel, PredNewRel;
1491 let Predicates = [HasV4T], AddedComplexity = 10 in {
1492 def: Pat<(truncstorei8 s8ExtPred:$src3, (add IntRegs:$src1, u6_0ImmPred:$src2)),
1493 (STrib_imm_V4 IntRegs:$src1, u6_0ImmPred:$src2, s8ExtPred:$src3)>;
1495 def: Pat<(truncstorei16 s8ExtPred:$src3, (add IntRegs:$src1,
1496 u6_1ImmPred:$src2)),
1497 (STrih_imm_V4 IntRegs:$src1, u6_1ImmPred:$src2, s8ExtPred:$src3)>;
1499 def: Pat<(store s8ExtPred:$src3, (add IntRegs:$src1, u6_2ImmPred:$src2)),
1500 (STriw_imm_V4 IntRegs:$src1, u6_2ImmPred:$src2, s8ExtPred:$src3)>;
1503 let AddedComplexity = 6 in
1504 def : Pat <(truncstorei8 s8ExtPred:$src2, (i32 IntRegs:$src1)),
1505 (STrib_imm_V4 IntRegs:$src1, 0, s8ExtPred:$src2)>,
1508 // memb(Ru<<#u2+#U6)=Rt
1509 let isExtended = 1, opExtendable = 2, AddedComplexity = 10, isNVStorable = 1,
1510 validSubTargets = HasV4SubT in
1511 def STrib_shl_V4 : STInst<(outs),
1512 (ins IntRegs:$src1, u2Imm:$src2, u0AlwaysExt:$src3, IntRegs:$src4),
1513 "memb($src1<<#$src2+#$src3) = $src4",
1514 [(truncstorei8 (i32 IntRegs:$src4),
1515 (add (shl (i32 IntRegs:$src1), u2ImmPred:$src2),
1516 u0AlwaysExtPred:$src3))]>,
1519 // memb(Rx++#s4:0:circ(Mu))=Rt
1520 // memb(Rx++I:circ(Mu))=Rt
1522 // memb(Rx++Mu:brev)=Rt
1523 // memb(gp+#u16:0)=Rt
1527 // TODO: needs to be implemented
1528 // memh(Re=#U6)=Rt.H
1529 // memh(Rs+#s11:1)=Rt.H
1530 let AddedComplexity = 6 in
1531 def : Pat <(truncstorei16 s8ExtPred:$src2, (i32 IntRegs:$src1)),
1532 (STrih_imm_V4 IntRegs:$src1, 0, s8ExtPred:$src2)>,
1535 // memh(Rs+Ru<<#u2)=Rt.H
1536 // TODO: needs to be implemented.
1538 // memh(Ru<<#u2+#U6)=Rt.H
1539 // memh(Ru<<#u2+#U6)=Rt
1540 let isExtended = 1, opExtendable = 2, AddedComplexity = 10, isNVStorable = 1,
1541 validSubTargets = HasV4SubT in
1542 def STrih_shl_V4 : STInst<(outs),
1543 (ins IntRegs:$src1, u2Imm:$src2, u0AlwaysExt:$src3, IntRegs:$src4),
1544 "memh($src1<<#$src2+#$src3) = $src4",
1545 [(truncstorei16 (i32 IntRegs:$src4),
1546 (add (shl (i32 IntRegs:$src1), u2ImmPred:$src2),
1547 u0AlwaysExtPred:$src3))]>,
1550 // memh(Rx++#s4:1:circ(Mu))=Rt.H
1551 // memh(Rx++#s4:1:circ(Mu))=Rt
1552 // memh(Rx++I:circ(Mu))=Rt.H
1553 // memh(Rx++I:circ(Mu))=Rt
1554 // memh(Rx++Mu)=Rt.H
1556 // memh(Rx++Mu:brev)=Rt.H
1557 // memh(Rx++Mu:brev)=Rt
1558 // memh(gp+#u16:1)=Rt
1559 // if ([!]Pv[.new]) memh(#u6)=Rt.H
1560 // if ([!]Pv[.new]) memh(#u6)=Rt
1563 // if ([!]Pv[.new]) memh(Rs+#u6:1)=Rt.H
1564 // TODO: needs to be implemented.
1566 // if ([!]Pv[.new]) memh(Rx++#s4:1)=Rt.H
1567 // TODO: Needs to be implemented.
1571 // TODO: Needs to be implemented.
1574 let neverHasSideEffects = 1 in
1575 def STriw_pred_V4 : STInst2<(outs),
1576 (ins MEMri:$addr, PredRegs:$src1),
1577 "Error; should not emit",
1581 let AddedComplexity = 6 in
1582 def : Pat <(store s8ExtPred:$src2, (i32 IntRegs:$src1)),
1583 (STriw_imm_V4 IntRegs:$src1, 0, s8ExtPred:$src2)>,
1586 // memw(Ru<<#u2+#U6)=Rt
1587 let isExtended = 1, opExtendable = 2, AddedComplexity = 10, isNVStorable = 1,
1588 validSubTargets = HasV4SubT in
1589 def STriw_shl_V4 : STInst<(outs),
1590 (ins IntRegs:$src1, u2Imm:$src2, u0AlwaysExt:$src3, IntRegs:$src4),
1591 "memw($src1<<#$src2+#$src3) = $src4",
1592 [(store (i32 IntRegs:$src4),
1593 (add (shl (i32 IntRegs:$src1), u2ImmPred:$src2),
1594 u0AlwaysExtPred:$src3))]>,
1597 // memw(Rx++#s4:2)=Rt
1598 // memw(Rx++#s4:2:circ(Mu))=Rt
1599 // memw(Rx++I:circ(Mu))=Rt
1601 // memw(Rx++Mu:brev)=Rt
1602 // memw(gp+#u16:2)=Rt
1604 /// store to global address
1606 let isPredicable = 1, neverHasSideEffects = 1 in
1607 def STrid_GP_V4 : STInst2<(outs),
1608 (ins globaladdress:$global, u16Imm:$offset, DoubleRegs:$src),
1609 "memd(#$global+$offset) = $src",
1613 let neverHasSideEffects = 1, isPredicated = 1 in
1614 def STrid_GP_cPt_V4 : STInst2<(outs),
1615 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1617 "if ($src1) memd(##$global+$offset) = $src2",
1621 let neverHasSideEffects = 1, isPredicated = 1 in
1622 def STrid_GP_cNotPt_V4 : STInst2<(outs),
1623 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1625 "if (!$src1) memd(##$global+$offset) = $src2",
1629 let neverHasSideEffects = 1, isPredicated = 1 in
1630 def STrid_GP_cdnPt_V4 : STInst2<(outs),
1631 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1633 "if ($src1.new) memd(##$global+$offset) = $src2",
1637 let neverHasSideEffects = 1, isPredicated = 1 in
1638 def STrid_GP_cdnNotPt_V4 : STInst2<(outs),
1639 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1641 "if (!$src1.new) memd(##$global+$offset) = $src2",
1645 let isPredicable = 1, neverHasSideEffects = 1 in
1646 def STrib_GP_V4 : STInst2<(outs),
1647 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
1648 "memb(#$global+$offset) = $src",
1652 let neverHasSideEffects = 1, isPredicated = 1 in
1653 def STrib_GP_cPt_V4 : STInst2<(outs),
1654 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1656 "if ($src1) memb(##$global+$offset) = $src2",
1660 let neverHasSideEffects = 1, isPredicated = 1 in
1661 def STrib_GP_cNotPt_V4 : STInst2<(outs),
1662 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1664 "if (!$src1) memb(##$global+$offset) = $src2",
1668 let neverHasSideEffects = 1, isPredicated = 1 in
1669 def STrib_GP_cdnPt_V4 : STInst2<(outs),
1670 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1672 "if ($src1.new) memb(##$global+$offset) = $src2",
1676 let neverHasSideEffects = 1, isPredicated = 1 in
1677 def STrib_GP_cdnNotPt_V4 : STInst2<(outs),
1678 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1680 "if (!$src1.new) memb(##$global+$offset) = $src2",
1684 let isPredicable = 1, neverHasSideEffects = 1 in
1685 def STrih_GP_V4 : STInst2<(outs),
1686 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
1687 "memh(#$global+$offset) = $src",
1691 let neverHasSideEffects = 1, isPredicated = 1 in
1692 def STrih_GP_cPt_V4 : STInst2<(outs),
1693 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1695 "if ($src1) memh(##$global+$offset) = $src2",
1699 let neverHasSideEffects = 1, isPredicated = 1 in
1700 def STrih_GP_cNotPt_V4 : STInst2<(outs),
1701 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1703 "if (!$src1) memh(##$global+$offset) = $src2",
1707 let neverHasSideEffects = 1, isPredicated = 1 in
1708 def STrih_GP_cdnPt_V4 : STInst2<(outs),
1709 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1711 "if ($src1.new) memh(##$global+$offset) = $src2",
1715 let neverHasSideEffects = 1, isPredicated = 1 in
1716 def STrih_GP_cdnNotPt_V4 : STInst2<(outs),
1717 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1719 "if (!$src1.new) memh(##$global+$offset) = $src2",
1723 let isPredicable = 1, neverHasSideEffects = 1 in
1724 def STriw_GP_V4 : STInst2<(outs),
1725 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
1726 "memw(#$global+$offset) = $src",
1730 let neverHasSideEffects = 1, isPredicated = 1 in
1731 def STriw_GP_cPt_V4 : STInst2<(outs),
1732 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1734 "if ($src1) memw(##$global+$offset) = $src2",
1738 let neverHasSideEffects = 1, isPredicated = 1 in
1739 def STriw_GP_cNotPt_V4 : STInst2<(outs),
1740 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1742 "if (!$src1) memw(##$global+$offset) = $src2",
1746 let neverHasSideEffects = 1, isPredicated = 1 in
1747 def STriw_GP_cdnPt_V4 : STInst2<(outs),
1748 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1750 "if ($src1.new) memw(##$global+$offset) = $src2",
1754 let neverHasSideEffects = 1, isPredicated = 1 in
1755 def STriw_GP_cdnNotPt_V4 : STInst2<(outs),
1756 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
1758 "if (!$src1.new) memw(##$global+$offset) = $src2",
1762 // memd(#global)=Rtt
1763 let isPredicable = 1, neverHasSideEffects = 1 in
1764 def STd_GP_V4 : STInst2<(outs),
1765 (ins globaladdress:$global, DoubleRegs:$src),
1766 "memd(#$global) = $src",
1770 // if (Pv) memd(##global) = Rtt
1771 let neverHasSideEffects = 1, isPredicated = 1 in
1772 def STd_GP_cPt_V4 : STInst2<(outs),
1773 (ins PredRegs:$src1, globaladdress:$global, DoubleRegs:$src2),
1774 "if ($src1) memd(##$global) = $src2",
1778 // if (!Pv) memd(##global) = Rtt
1779 let neverHasSideEffects = 1, isPredicated = 1 in
1780 def STd_GP_cNotPt_V4 : STInst2<(outs),
1781 (ins PredRegs:$src1, globaladdress:$global, DoubleRegs:$src2),
1782 "if (!$src1) memd(##$global) = $src2",
1786 // if (Pv) memd(##global) = Rtt
1787 let neverHasSideEffects = 1, isPredicated = 1 in
1788 def STd_GP_cdnPt_V4 : STInst2<(outs),
1789 (ins PredRegs:$src1, globaladdress:$global, DoubleRegs:$src2),
1790 "if ($src1.new) memd(##$global) = $src2",
1794 // if (!Pv) memd(##global) = Rtt
1795 let neverHasSideEffects = 1, isPredicated = 1 in
1796 def STd_GP_cdnNotPt_V4 : STInst2<(outs),
1797 (ins PredRegs:$src1, globaladdress:$global, DoubleRegs:$src2),
1798 "if (!$src1.new) memd(##$global) = $src2",
1803 let isPredicable = 1, neverHasSideEffects = 1 in
1804 def STb_GP_V4 : STInst2<(outs),
1805 (ins globaladdress:$global, IntRegs:$src),
1806 "memb(#$global) = $src",
1810 // if (Pv) memb(##global) = Rt
1811 let neverHasSideEffects = 1, isPredicated = 1 in
1812 def STb_GP_cPt_V4 : STInst2<(outs),
1813 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1814 "if ($src1) memb(##$global) = $src2",
1818 // if (!Pv) memb(##global) = Rt
1819 let neverHasSideEffects = 1, isPredicated = 1 in
1820 def STb_GP_cNotPt_V4 : STInst2<(outs),
1821 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1822 "if (!$src1) memb(##$global) = $src2",
1826 // if (Pv) memb(##global) = Rt
1827 let neverHasSideEffects = 1, isPredicated = 1 in
1828 def STb_GP_cdnPt_V4 : STInst2<(outs),
1829 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1830 "if ($src1.new) memb(##$global) = $src2",
1834 // if (!Pv) memb(##global) = Rt
1835 let neverHasSideEffects = 1, isPredicated = 1 in
1836 def STb_GP_cdnNotPt_V4 : STInst2<(outs),
1837 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1838 "if (!$src1.new) memb(##$global) = $src2",
1843 let isPredicable = 1, neverHasSideEffects = 1 in
1844 def STh_GP_V4 : STInst2<(outs),
1845 (ins globaladdress:$global, IntRegs:$src),
1846 "memh(#$global) = $src",
1850 // if (Pv) memh(##global) = Rt
1851 let neverHasSideEffects = 1, isPredicated = 1 in
1852 def STh_GP_cPt_V4 : STInst2<(outs),
1853 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1854 "if ($src1) memh(##$global) = $src2",
1858 // if (!Pv) memh(##global) = Rt
1859 let neverHasSideEffects = 1, isPredicated = 1 in
1860 def STh_GP_cNotPt_V4 : STInst2<(outs),
1861 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1862 "if (!$src1) memh(##$global) = $src2",
1866 // if (Pv) memh(##global) = Rt
1867 let neverHasSideEffects = 1, isPredicated = 1 in
1868 def STh_GP_cdnPt_V4 : STInst2<(outs),
1869 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1870 "if ($src1.new) memh(##$global) = $src2",
1874 // if (!Pv) memh(##global) = Rt
1875 let neverHasSideEffects = 1, isPredicated = 1 in
1876 def STh_GP_cdnNotPt_V4 : STInst2<(outs),
1877 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1878 "if (!$src1.new) memh(##$global) = $src2",
1883 let isPredicable = 1, neverHasSideEffects = 1 in
1884 def STw_GP_V4 : STInst2<(outs),
1885 (ins globaladdress:$global, IntRegs:$src),
1886 "memw(#$global) = $src",
1890 // if (Pv) memw(##global) = Rt
1891 let neverHasSideEffects = 1, isPredicated = 1 in
1892 def STw_GP_cPt_V4 : STInst2<(outs),
1893 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1894 "if ($src1) memw(##$global) = $src2",
1898 // if (!Pv) memw(##global) = Rt
1899 let neverHasSideEffects = 1, isPredicated = 1 in
1900 def STw_GP_cNotPt_V4 : STInst2<(outs),
1901 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1902 "if (!$src1) memw(##$global) = $src2",
1906 // if (Pv) memw(##global) = Rt
1907 let neverHasSideEffects = 1, isPredicated = 1 in
1908 def STw_GP_cdnPt_V4 : STInst2<(outs),
1909 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1910 "if ($src1.new) memw(##$global) = $src2",
1914 // if (!Pv) memw(##global) = Rt
1915 let neverHasSideEffects = 1, isPredicated = 1 in
1916 def STw_GP_cdnNotPt_V4 : STInst2<(outs),
1917 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
1918 "if (!$src1.new) memw(##$global) = $src2",
1922 // 64 bit atomic store
1923 def : Pat <(atomic_store_64 (HexagonCONST32_GP tglobaladdr:$global),
1924 (i64 DoubleRegs:$src1)),
1925 (STd_GP_V4 tglobaladdr:$global, (i64 DoubleRegs:$src1))>,
1928 // Map from store(globaladdress) -> memd(#foo)
1929 let AddedComplexity = 100 in
1930 def : Pat <(store (i64 DoubleRegs:$src1),
1931 (HexagonCONST32_GP tglobaladdr:$global)),
1932 (STd_GP_V4 tglobaladdr:$global, (i64 DoubleRegs:$src1))>,
1935 // 8 bit atomic store
1936 def : Pat < (atomic_store_8 (HexagonCONST32_GP tglobaladdr:$global),
1937 (i32 IntRegs:$src1)),
1938 (STb_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
1941 // Map from store(globaladdress) -> memb(#foo)
1942 let AddedComplexity = 100 in
1943 def : Pat<(truncstorei8 (i32 IntRegs:$src1),
1944 (HexagonCONST32_GP tglobaladdr:$global)),
1945 (STb_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
1948 // Map from "i1 = constant<-1>; memw(CONST32(#foo)) = i1"
1949 // to "r0 = 1; memw(#foo) = r0"
1950 let AddedComplexity = 100 in
1951 def : Pat<(store (i1 -1), (HexagonCONST32_GP tglobaladdr:$global)),
1952 (STb_GP_V4 tglobaladdr:$global, (TFRI 1))>,
1955 def : Pat<(atomic_store_16 (HexagonCONST32_GP tglobaladdr:$global),
1956 (i32 IntRegs:$src1)),
1957 (STh_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
1960 // Map from store(globaladdress) -> memh(#foo)
1961 let AddedComplexity = 100 in
1962 def : Pat<(truncstorei16 (i32 IntRegs:$src1),
1963 (HexagonCONST32_GP tglobaladdr:$global)),
1964 (STh_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
1967 // 32 bit atomic store
1968 def : Pat<(atomic_store_32 (HexagonCONST32_GP tglobaladdr:$global),
1969 (i32 IntRegs:$src1)),
1970 (STw_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
1973 // Map from store(globaladdress) -> memw(#foo)
1974 let AddedComplexity = 100 in
1975 def : Pat<(store (i32 IntRegs:$src1), (HexagonCONST32_GP tglobaladdr:$global)),
1976 (STw_GP_V4 tglobaladdr:$global, (i32 IntRegs:$src1))>,
1979 def : Pat<(atomic_store_64 (add (HexagonCONST32_GP tglobaladdr:$global),
1980 u16ImmPred:$offset),
1981 (i64 DoubleRegs:$src1)),
1982 (STrid_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
1983 (i64 DoubleRegs:$src1))>,
1986 def : Pat<(atomic_store_32 (add (HexagonCONST32_GP tglobaladdr:$global),
1987 u16ImmPred:$offset),
1988 (i32 IntRegs:$src1)),
1989 (STriw_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
1990 (i32 IntRegs:$src1))>,
1993 def : Pat<(atomic_store_16 (add (HexagonCONST32_GP tglobaladdr:$global),
1994 u16ImmPred:$offset),
1995 (i32 IntRegs:$src1)),
1996 (STrih_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
1997 (i32 IntRegs:$src1))>,
2000 def : Pat<(atomic_store_8 (add (HexagonCONST32_GP tglobaladdr:$global),
2001 u16ImmPred:$offset),
2002 (i32 IntRegs:$src1)),
2003 (STrib_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2004 (i32 IntRegs:$src1))>,
2007 // Map from store(globaladdress + x) -> memd(#foo + x)
2008 let AddedComplexity = 100 in
2009 def : Pat<(store (i64 DoubleRegs:$src1),
2010 (add (HexagonCONST32_GP tglobaladdr:$global),
2011 u16ImmPred:$offset)),
2012 (STrid_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2013 (i64 DoubleRegs:$src1))>,
2016 // Map from store(globaladdress + x) -> memb(#foo + x)
2017 let AddedComplexity = 100 in
2018 def : Pat<(truncstorei8 (i32 IntRegs:$src1),
2019 (add (HexagonCONST32_GP tglobaladdr:$global),
2020 u16ImmPred:$offset)),
2021 (STrib_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2022 (i32 IntRegs:$src1))>,
2025 // Map from store(globaladdress + x) -> memh(#foo + x)
2026 let AddedComplexity = 100 in
2027 def : Pat<(truncstorei16 (i32 IntRegs:$src1),
2028 (add (HexagonCONST32_GP tglobaladdr:$global),
2029 u16ImmPred:$offset)),
2030 (STrih_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2031 (i32 IntRegs:$src1))>,
2034 // Map from store(globaladdress + x) -> memw(#foo + x)
2035 let AddedComplexity = 100 in
2036 def : Pat<(store (i32 IntRegs:$src1),
2037 (add (HexagonCONST32_GP tglobaladdr:$global),
2038 u16ImmPred:$offset)),
2039 (STriw_GP_V4 tglobaladdr:$global, u16ImmPred:$offset,
2040 (i32 IntRegs:$src1))>,
2045 //===----------------------------------------------------------------------===
2047 //===----------------------------------------------------------------------===
2050 //===----------------------------------------------------------------------===//
2052 //===----------------------------------------------------------------------===//
2054 // multiclass for new-value store instructions with base + immediate offset.
2056 multiclass ST_Idxd_Pbase_nv<string mnemonic, RegisterClass RC,
2057 Operand predImmOp, bit isNot, bit isPredNew> {
2058 let PNewValue = !if(isPredNew, "new", "") in
2059 def NAME#_nv_V4 : NVInst_V4<(outs),
2060 (ins PredRegs:$src1, IntRegs:$src2, predImmOp:$src3, RC: $src4),
2061 !if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
2062 ") ")#mnemonic#"($src2+#$src3) = $src4.new",
2067 multiclass ST_Idxd_Pred_nv<string mnemonic, RegisterClass RC, Operand predImmOp,
2069 let PredSense = !if(PredNot, "false", "true") in {
2070 defm _c#NAME : ST_Idxd_Pbase_nv<mnemonic, RC, predImmOp, PredNot, 0>;
2072 defm _cdn#NAME : ST_Idxd_Pbase_nv<mnemonic, RC, predImmOp, PredNot, 1>;
2076 let mayStore = 1, isNVStore = 1, neverHasSideEffects = 1, isExtendable = 1 in
2077 multiclass ST_Idxd_nv<string mnemonic, string CextOp, RegisterClass RC,
2078 Operand ImmOp, Operand predImmOp, bits<5> ImmBits,
2079 bits<5> PredImmBits> {
2081 let CextOpcode = CextOp, BaseOpcode = CextOp#_indexed in {
2082 let opExtendable = 1, isExtentSigned = 1, opExtentBits = ImmBits,
2084 def NAME#_nv_V4 : NVInst_V4<(outs),
2085 (ins IntRegs:$src1, ImmOp:$src2, RC:$src3),
2086 mnemonic#"($src1+#$src2) = $src3.new",
2090 let opExtendable = 2, isExtentSigned = 0, opExtentBits = PredImmBits,
2091 isPredicated = 1 in {
2092 defm Pt : ST_Idxd_Pred_nv<mnemonic, RC, predImmOp, 0>;
2093 defm NotPt : ST_Idxd_Pred_nv<mnemonic, RC, predImmOp, 1>;
2098 let addrMode = BaseImmOffset, validSubTargets = HasV4SubT in {
2099 defm STrib_indexed: ST_Idxd_nv<"memb", "STrib", IntRegs, s11_0Ext,
2100 u6_0Ext, 11, 6>, AddrModeRel;
2101 defm STrih_indexed: ST_Idxd_nv<"memh", "STrih", IntRegs, s11_1Ext,
2102 u6_1Ext, 12, 7>, AddrModeRel;
2103 defm STriw_indexed: ST_Idxd_nv<"memw", "STriw", IntRegs, s11_2Ext,
2104 u6_2Ext, 13, 8>, AddrModeRel;
2107 // multiclass for new-value store instructions with base + immediate offset.
2108 // and MEMri operand.
2109 multiclass ST_MEMri_Pbase_nv<string mnemonic, RegisterClass RC, bit isNot,
2111 let PNewValue = !if(isPredNew, "new", "") in
2112 def NAME#_nv_V4 : NVInst_V4<(outs),
2113 (ins PredRegs:$src1, MEMri:$addr, RC: $src2),
2114 !if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
2115 ") ")#mnemonic#"($addr) = $src2.new",
2120 multiclass ST_MEMri_Pred_nv<string mnemonic, RegisterClass RC, bit PredNot> {
2121 let PredSense = !if(PredNot, "false", "true") in {
2122 defm _c#NAME : ST_MEMri_Pbase_nv<mnemonic, RC, PredNot, 0>;
2125 defm _cdn#NAME : ST_MEMri_Pbase_nv<mnemonic, RC, PredNot, 1>;
2129 let mayStore = 1, isNVStore = 1, isExtendable = 1, neverHasSideEffects = 1 in
2130 multiclass ST_MEMri_nv<string mnemonic, string CextOp, RegisterClass RC,
2131 bits<5> ImmBits, bits<5> PredImmBits> {
2133 let CextOpcode = CextOp, BaseOpcode = CextOp in {
2134 let opExtendable = 1, isExtentSigned = 1, opExtentBits = ImmBits,
2136 def NAME#_nv_V4 : NVInst_V4<(outs),
2137 (ins MEMri:$addr, RC:$src),
2138 mnemonic#"($addr) = $src.new",
2142 let opExtendable = 2, isExtentSigned = 0, opExtentBits = PredImmBits,
2143 neverHasSideEffects = 1, isPredicated = 1 in {
2144 defm Pt : ST_MEMri_Pred_nv<mnemonic, RC, 0>;
2145 defm NotPt : ST_MEMri_Pred_nv<mnemonic, RC, 1>;
2150 let addrMode = BaseImmOffset, isMEMri = "true", validSubTargets = HasV4SubT,
2152 defm STrib: ST_MEMri_nv<"memb", "STrib", IntRegs, 11, 6>, AddrModeRel;
2153 defm STrih: ST_MEMri_nv<"memh", "STrih", IntRegs, 12, 7>, AddrModeRel;
2154 defm STriw: ST_MEMri_nv<"memw", "STriw", IntRegs, 13, 8>, AddrModeRel;
2157 // memb(Ru<<#u2+#U6)=Nt.new
2158 let isExtended = 1, opExtendable = 2, mayStore = 1, AddedComplexity = 10,
2159 isNVStore = 1, validSubTargets = HasV4SubT in
2160 def STrib_shl_nv_V4 : NVInst_V4<(outs),
2161 (ins IntRegs:$src1, u2Imm:$src2, u0AlwaysExt:$src3, IntRegs:$src4),
2162 "memb($src1<<#$src2+#$src3) = $src4.new",
2166 //===----------------------------------------------------------------------===//
2167 // Post increment store
2168 // mem[bhwd](Rx++#s4:[0123])=Nt.new
2169 //===----------------------------------------------------------------------===//
2171 multiclass ST_PostInc_Pbase_nv<string mnemonic, RegisterClass RC, Operand ImmOp,
2172 bit isNot, bit isPredNew> {
2173 let PNewValue = !if(isPredNew, "new", "") in
2174 def NAME#_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2175 (ins PredRegs:$src1, IntRegs:$src2, ImmOp:$offset, RC:$src3),
2176 !if(isNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
2177 ") ")#mnemonic#"($src2++#$offset) = $src3.new",
2183 multiclass ST_PostInc_Pred_nv<string mnemonic, RegisterClass RC,
2184 Operand ImmOp, bit PredNot> {
2185 let PredSense = !if(PredNot, "false", "true") in {
2186 defm _c#NAME : ST_PostInc_Pbase_nv<mnemonic, RC, ImmOp, PredNot, 0>;
2188 let Predicates = [HasV4T], validSubTargets = HasV4SubT in
2189 defm _cdn#NAME : ST_PostInc_Pbase_nv<mnemonic, RC, ImmOp, PredNot, 1>;
2193 let hasCtrlDep = 1, isNVStore = 1, neverHasSideEffects = 1 in
2194 multiclass ST_PostInc_nv<string mnemonic, string BaseOp, RegisterClass RC,
2197 let BaseOpcode = "POST_"#BaseOp in {
2198 let isPredicable = 1 in
2199 def NAME#_nv_V4 : NVInstPI_V4<(outs IntRegs:$dst),
2200 (ins IntRegs:$src1, ImmOp:$offset, RC:$src2),
2201 mnemonic#"($src1++#$offset) = $src2.new",
2206 let isPredicated = 1 in {
2207 defm Pt : ST_PostInc_Pred_nv<mnemonic, RC, ImmOp, 0 >;
2208 defm NotPt : ST_PostInc_Pred_nv<mnemonic, RC, ImmOp, 1 >;
2213 let validSubTargets = HasV4SubT in {
2214 defm POST_STbri: ST_PostInc_nv <"memb", "STrib", IntRegs, s4_0Imm>, AddrModeRel;
2215 defm POST_SThri: ST_PostInc_nv <"memh", "STrih", IntRegs, s4_1Imm>, AddrModeRel;
2216 defm POST_STwri: ST_PostInc_nv <"memw", "STriw", IntRegs, s4_2Imm>, AddrModeRel;
2219 // memb(Rx++#s4:0:circ(Mu))=Nt.new
2220 // memb(Rx++I:circ(Mu))=Nt.new
2221 // memb(Rx++Mu)=Nt.new
2222 // memb(Rx++Mu:brev)=Nt.new
2224 // memb(gp+#u16:0)=Nt.new
2225 let mayStore = 1, neverHasSideEffects = 1 in
2226 def STrib_GP_nv_V4 : NVInst_V4<(outs),
2227 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
2228 "memb(#$global+$offset) = $src.new",
2232 // memb(#global)=Nt.new
2233 let mayStore = 1, neverHasSideEffects = 1 in
2234 def STb_GP_nv_V4 : NVInst_V4<(outs),
2235 (ins globaladdress:$global, IntRegs:$src),
2236 "memb(#$global) = $src.new",
2240 // memh(Ru<<#u2+#U6)=Nt.new
2241 let isExtended = 1, opExtendable = 2, mayStore = 1, AddedComplexity = 10,
2242 isNVStore = 1, validSubTargets = HasV4SubT in
2243 def STrih_shl_nv_V4 : NVInst_V4<(outs),
2244 (ins IntRegs:$src1, u2Imm:$src2, u0AlwaysExt:$src3, IntRegs:$src4),
2245 "memh($src1<<#$src2+#$src3) = $src4.new",
2249 // memh(Rx++#s4:1:circ(Mu))=Nt.new
2250 // memh(Rx++I:circ(Mu))=Nt.new
2251 // memh(Rx++Mu)=Nt.new
2252 // memh(Rx++Mu:brev)=Nt.new
2254 // memh(gp+#u16:1)=Nt.new
2255 let mayStore = 1, neverHasSideEffects = 1 in
2256 def STrih_GP_nv_V4 : NVInst_V4<(outs),
2257 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
2258 "memh(#$global+$offset) = $src.new",
2262 // memh(#global)=Nt.new
2263 let mayStore = 1, neverHasSideEffects = 1 in
2264 def STh_GP_nv_V4 : NVInst_V4<(outs),
2265 (ins globaladdress:$global, IntRegs:$src),
2266 "memh(#$global) = $src.new",
2270 // memw(Ru<<#u2+#U6)=Nt.new
2271 let isExtended = 1, opExtendable = 2, mayStore = 1, AddedComplexity = 10,
2272 isNVStore = 1, validSubTargets = HasV4SubT in
2273 def STriw_shl_nv_V4 : NVInst_V4<(outs),
2274 (ins IntRegs:$src1, u2Imm:$src2, u0AlwaysExt:$src3, IntRegs:$src4),
2275 "memw($src1<<#$src2+#$src3) = $src4.new",
2279 // memw(Rx++#s4:2:circ(Mu))=Nt.new
2280 // memw(Rx++I:circ(Mu))=Nt.new
2281 // memw(Rx++Mu)=Nt.new
2282 // memw(Rx++Mu:brev)=Nt.new
2283 // memw(gp+#u16:2)=Nt.new
2284 let mayStore = 1, neverHasSideEffects = 1 in
2285 def STriw_GP_nv_V4 : NVInst_V4<(outs),
2286 (ins globaladdress:$global, u16Imm:$offset, IntRegs:$src),
2287 "memw(#$global+$offset) = $src.new",
2291 let mayStore = 1, neverHasSideEffects = 1 in
2292 def STw_GP_nv_V4 : NVInst_V4<(outs),
2293 (ins globaladdress:$global, IntRegs:$src),
2294 "memw(#$global) = $src.new",
2298 // if (Pv) memb(##global) = Rt
2299 let mayStore = 1, neverHasSideEffects = 1 in
2300 def STb_GP_cPt_nv_V4 : NVInst_V4<(outs),
2301 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2302 "if ($src1) memb(##$global) = $src2.new",
2306 // if (!Pv) memb(##global) = Rt
2307 let mayStore = 1, neverHasSideEffects = 1 in
2308 def STb_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
2309 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2310 "if (!$src1) memb(##$global) = $src2.new",
2314 // if (Pv) memb(##global) = Rt
2315 let mayStore = 1, neverHasSideEffects = 1 in
2316 def STb_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
2317 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2318 "if ($src1.new) memb(##$global) = $src2.new",
2322 // if (!Pv) memb(##global) = Rt
2323 let mayStore = 1, neverHasSideEffects = 1 in
2324 def STb_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2325 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2326 "if (!$src1.new) memb(##$global) = $src2.new",
2330 // if (Pv) memh(##global) = Rt
2331 let mayStore = 1, neverHasSideEffects = 1 in
2332 def STh_GP_cPt_nv_V4 : NVInst_V4<(outs),
2333 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2334 "if ($src1) memh(##$global) = $src2.new",
2338 // if (!Pv) memh(##global) = Rt
2339 let mayStore = 1, neverHasSideEffects = 1 in
2340 def STh_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
2341 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2342 "if (!$src1) memh(##$global) = $src2.new",
2346 // if (Pv) memh(##global) = Rt
2347 let mayStore = 1, neverHasSideEffects = 1 in
2348 def STh_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
2349 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2350 "if ($src1.new) memh(##$global) = $src2.new",
2354 // if (!Pv) memh(##global) = Rt
2355 let mayStore = 1, neverHasSideEffects = 1 in
2356 def STh_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2357 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2358 "if (!$src1.new) memh(##$global) = $src2.new",
2362 // if (Pv) memw(##global) = Rt
2363 let mayStore = 1, neverHasSideEffects = 1 in
2364 def STw_GP_cPt_nv_V4 : NVInst_V4<(outs),
2365 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2366 "if ($src1) memw(##$global) = $src2.new",
2370 // if (!Pv) memw(##global) = Rt
2371 let mayStore = 1, neverHasSideEffects = 1 in
2372 def STw_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
2373 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2374 "if (!$src1) memw(##$global) = $src2.new",
2378 // if (Pv) memw(##global) = Rt
2379 let mayStore = 1, neverHasSideEffects = 1 in
2380 def STw_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
2381 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2382 "if ($src1.new) memw(##$global) = $src2.new",
2386 // if (!Pv) memw(##global) = Rt
2387 let mayStore = 1, neverHasSideEffects = 1 in
2388 def STw_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2389 (ins PredRegs:$src1, globaladdress:$global, IntRegs:$src2),
2390 "if (!$src1.new) memw(##$global) = $src2.new",
2394 let mayStore = 1, neverHasSideEffects = 1 in
2395 def STrib_GP_cPt_nv_V4 : NVInst_V4<(outs),
2396 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2398 "if ($src1) memb(##$global+$offset) = $src2.new",
2402 let mayStore = 1, neverHasSideEffects = 1 in
2403 def STrib_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
2404 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2406 "if (!$src1) memb(##$global+$offset) = $src2.new",
2410 let mayStore = 1, neverHasSideEffects = 1 in
2411 def STrib_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
2412 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2414 "if ($src1.new) memb(##$global+$offset) = $src2.new",
2418 let mayStore = 1, neverHasSideEffects = 1 in
2419 def STrib_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2420 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2422 "if (!$src1.new) memb(##$global+$offset) = $src2.new",
2426 let mayStore = 1, neverHasSideEffects = 1 in
2427 def STrih_GP_cPt_nv_V4 : NVInst_V4<(outs),
2428 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2430 "if ($src1) memh(##$global+$offset) = $src2.new",
2434 let mayStore = 1, neverHasSideEffects = 1 in
2435 def STrih_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
2436 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2438 "if (!$src1) memh(##$global+$offset) = $src2.new",
2442 let mayStore = 1, neverHasSideEffects = 1 in
2443 def STrih_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
2444 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2446 "if ($src1.new) memh(##$global+$offset) = $src2.new",
2450 let mayStore = 1, neverHasSideEffects = 1 in
2451 def STrih_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2452 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2454 "if (!$src1.new) memh(##$global+$offset) = $src2.new",
2458 let mayStore = 1, neverHasSideEffects = 1 in
2459 def STriw_GP_cPt_nv_V4 : NVInst_V4<(outs),
2460 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2462 "if ($src1) memw(##$global+$offset) = $src2.new",
2466 let mayStore = 1, neverHasSideEffects = 1 in
2467 def STriw_GP_cNotPt_nv_V4 : NVInst_V4<(outs),
2468 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2470 "if (!$src1) memw(##$global+$offset) = $src2.new",
2474 let mayStore = 1, neverHasSideEffects = 1 in
2475 def STriw_GP_cdnPt_nv_V4 : NVInst_V4<(outs),
2476 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2478 "if ($src1.new) memw(##$global+$offset) = $src2.new",
2482 let mayStore = 1, neverHasSideEffects = 1 in
2483 def STriw_GP_cdnNotPt_nv_V4 : NVInst_V4<(outs),
2484 (ins PredRegs:$src1, globaladdress:$global, u16Imm:$offset,
2486 "if (!$src1.new) memw(##$global+$offset) = $src2.new",
2490 //===----------------------------------------------------------------------===//
2492 //===----------------------------------------------------------------------===//
2494 //===----------------------------------------------------------------------===//
2496 //===----------------------------------------------------------------------===//
2498 multiclass NVJ_type_basic_reg<string NotStr, string OpcStr, string TakenStr> {
2499 def _ie_nv_V4 : NVInst_V4<(outs),
2500 (ins IntRegs:$src1, IntRegs:$src2, brtarget:$offset),
2501 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
2502 !strconcat("($src1.new, $src2)) jump:",
2503 !strconcat(TakenStr, " $offset"))))),
2507 def _nv_V4 : NVInst_V4<(outs),
2508 (ins IntRegs:$src1, IntRegs:$src2, brtarget:$offset),
2509 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
2510 !strconcat("($src1.new, $src2)) jump:",
2511 !strconcat(TakenStr, " $offset"))))),
2516 multiclass NVJ_type_basic_2ndDotNew<string NotStr, string OpcStr,
2518 def _ie_nv_V4 : NVInst_V4<(outs),
2519 (ins IntRegs:$src1, IntRegs:$src2, brtarget:$offset),
2520 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
2521 !strconcat("($src1, $src2.new)) jump:",
2522 !strconcat(TakenStr, " $offset"))))),
2526 def _nv_V4 : NVInst_V4<(outs),
2527 (ins IntRegs:$src1, IntRegs:$src2, brtarget:$offset),
2528 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
2529 !strconcat("($src1, $src2.new)) jump:",
2530 !strconcat(TakenStr, " $offset"))))),
2535 multiclass NVJ_type_basic_imm<string NotStr, string OpcStr, string TakenStr> {
2536 def _ie_nv_V4 : NVInst_V4<(outs),
2537 (ins IntRegs:$src1, u5Imm:$src2, brtarget:$offset),
2538 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
2539 !strconcat("($src1.new, #$src2)) jump:",
2540 !strconcat(TakenStr, " $offset"))))),
2544 def _nv_V4 : NVInst_V4<(outs),
2545 (ins IntRegs:$src1, u5Imm:$src2, brtarget:$offset),
2546 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
2547 !strconcat("($src1.new, #$src2)) jump:",
2548 !strconcat(TakenStr, " $offset"))))),
2553 multiclass NVJ_type_basic_neg<string NotStr, string OpcStr, string TakenStr> {
2554 def _ie_nv_V4 : NVInst_V4<(outs),
2555 (ins IntRegs:$src1, nOneImm:$src2, brtarget:$offset),
2556 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
2557 !strconcat("($src1.new, #$src2)) jump:",
2558 !strconcat(TakenStr, " $offset"))))),
2562 def _nv_V4 : NVInst_V4<(outs),
2563 (ins IntRegs:$src1, nOneImm:$src2, brtarget:$offset),
2564 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
2565 !strconcat("($src1.new, #$src2)) jump:",
2566 !strconcat(TakenStr, " $offset"))))),
2571 multiclass NVJ_type_basic_tstbit<string NotStr, string OpcStr,
2573 def _ie_nv_V4 : NVInst_V4<(outs),
2574 (ins IntRegs:$src1, u1Imm:$src2, brtarget:$offset),
2575 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
2576 !strconcat("($src1.new, #$src2)) jump:",
2577 !strconcat(TakenStr, " $offset"))))),
2581 def _nv_V4 : NVInst_V4<(outs),
2582 (ins IntRegs:$src1, u1Imm:$src2, brtarget:$offset),
2583 !strconcat("if (", !strconcat(NotStr, !strconcat(OpcStr,
2584 !strconcat("($src1.new, #$src2)) jump:",
2585 !strconcat(TakenStr, " $offset"))))),
2590 // Multiclass for regular dot new of Ist operand register.
2591 multiclass NVJ_type_br_pred_reg<string NotStr, string OpcStr> {
2592 defm Pt : NVJ_type_basic_reg<NotStr, OpcStr, "t">;
2593 defm Pnt : NVJ_type_basic_reg<NotStr, OpcStr, "nt">;
2596 // Multiclass for dot new of 2nd operand register.
2597 multiclass NVJ_type_br_pred_2ndDotNew<string NotStr, string OpcStr> {
2598 defm Pt : NVJ_type_basic_2ndDotNew<NotStr, OpcStr, "t">;
2599 defm Pnt : NVJ_type_basic_2ndDotNew<NotStr, OpcStr, "nt">;
2602 // Multiclass for 2nd operand immediate, including -1.
2603 multiclass NVJ_type_br_pred_imm<string NotStr, string OpcStr> {
2604 defm Pt : NVJ_type_basic_imm<NotStr, OpcStr, "t">;
2605 defm Pnt : NVJ_type_basic_imm<NotStr, OpcStr, "nt">;
2606 defm Ptneg : NVJ_type_basic_neg<NotStr, OpcStr, "t">;
2607 defm Pntneg : NVJ_type_basic_neg<NotStr, OpcStr, "nt">;
2610 // Multiclass for 2nd operand immediate, excluding -1.
2611 multiclass NVJ_type_br_pred_imm_only<string NotStr, string OpcStr> {
2612 defm Pt : NVJ_type_basic_imm<NotStr, OpcStr, "t">;
2613 defm Pnt : NVJ_type_basic_imm<NotStr, OpcStr, "nt">;
2616 // Multiclass for tstbit, where 2nd operand is always #0.
2617 multiclass NVJ_type_br_pred_tstbit<string NotStr, string OpcStr> {
2618 defm Pt : NVJ_type_basic_tstbit<NotStr, OpcStr, "t">;
2619 defm Pnt : NVJ_type_basic_tstbit<NotStr, OpcStr, "nt">;
2622 // Multiclass for GT.
2623 multiclass NVJ_type_rr_ri<string OpcStr> {
2624 defm rrNot : NVJ_type_br_pred_reg<"!", OpcStr>;
2625 defm rr : NVJ_type_br_pred_reg<"", OpcStr>;
2626 defm rrdnNot : NVJ_type_br_pred_2ndDotNew<"!", OpcStr>;
2627 defm rrdn : NVJ_type_br_pred_2ndDotNew<"", OpcStr>;
2628 defm riNot : NVJ_type_br_pred_imm<"!", OpcStr>;
2629 defm ri : NVJ_type_br_pred_imm<"", OpcStr>;
2632 // Multiclass for EQ.
2633 multiclass NVJ_type_rr_ri_no_2ndDotNew<string OpcStr> {
2634 defm rrNot : NVJ_type_br_pred_reg<"!", OpcStr>;
2635 defm rr : NVJ_type_br_pred_reg<"", OpcStr>;
2636 defm riNot : NVJ_type_br_pred_imm<"!", OpcStr>;
2637 defm ri : NVJ_type_br_pred_imm<"", OpcStr>;
2640 // Multiclass for GTU.
2641 multiclass NVJ_type_rr_ri_no_nOne<string OpcStr> {
2642 defm rrNot : NVJ_type_br_pred_reg<"!", OpcStr>;
2643 defm rr : NVJ_type_br_pred_reg<"", OpcStr>;
2644 defm rrdnNot : NVJ_type_br_pred_2ndDotNew<"!", OpcStr>;
2645 defm rrdn : NVJ_type_br_pred_2ndDotNew<"", OpcStr>;
2646 defm riNot : NVJ_type_br_pred_imm_only<"!", OpcStr>;
2647 defm ri : NVJ_type_br_pred_imm_only<"", OpcStr>;
2650 // Multiclass for tstbit.
2651 multiclass NVJ_type_r0<string OpcStr> {
2652 defm r0Not : NVJ_type_br_pred_tstbit<"!", OpcStr>;
2653 defm r0 : NVJ_type_br_pred_tstbit<"", OpcStr>;
2656 // Base Multiclass for New Value Jump.
2657 multiclass NVJ_type {
2658 defm GT : NVJ_type_rr_ri<"cmp.gt">;
2659 defm EQ : NVJ_type_rr_ri_no_2ndDotNew<"cmp.eq">;
2660 defm GTU : NVJ_type_rr_ri_no_nOne<"cmp.gtu">;
2661 defm TSTBIT : NVJ_type_r0<"tstbit">;
2664 let isBranch = 1, isTerminator=1, neverHasSideEffects = 1, Defs = [PC] in {
2665 defm JMP_ : NVJ_type;
2668 //===----------------------------------------------------------------------===//
2670 //===----------------------------------------------------------------------===//
2672 //===----------------------------------------------------------------------===//
2674 //===----------------------------------------------------------------------===//
2676 // Add and accumulate.
2677 // Rd=add(Rs,add(Ru,#s6))
2678 let isExtendable = 1, opExtendable = 3, isExtentSigned = 1, opExtentBits = 6,
2679 validSubTargets = HasV4SubT in
2680 def ADDr_ADDri_V4 : MInst<(outs IntRegs:$dst),
2681 (ins IntRegs:$src1, IntRegs:$src2, s6Ext:$src3),
2682 "$dst = add($src1, add($src2, #$src3))",
2683 [(set (i32 IntRegs:$dst),
2684 (add (i32 IntRegs:$src1), (add (i32 IntRegs:$src2),
2685 s6_16ExtPred:$src3)))]>,
2688 // Rd=add(Rs,sub(#s6,Ru))
2689 let isExtendable = 1, opExtendable = 2, isExtentSigned = 1, opExtentBits = 6,
2690 validSubTargets = HasV4SubT in
2691 def ADDr_SUBri_V4 : MInst<(outs IntRegs:$dst),
2692 (ins IntRegs:$src1, s6Ext:$src2, IntRegs:$src3),
2693 "$dst = add($src1, sub(#$src2, $src3))",
2694 [(set (i32 IntRegs:$dst),
2695 (add (i32 IntRegs:$src1), (sub s6_10ExtPred:$src2,
2696 (i32 IntRegs:$src3))))]>,
2699 // Generates the same instruction as ADDr_SUBri_V4 but matches different
2701 // Rd=add(Rs,sub(#s6,Ru))
2702 let isExtendable = 1, opExtendable = 2, isExtentSigned = 1, opExtentBits = 6,
2703 validSubTargets = HasV4SubT in
2704 def ADDri_SUBr_V4 : MInst<(outs IntRegs:$dst),
2705 (ins IntRegs:$src1, s6Ext:$src2, IntRegs:$src3),
2706 "$dst = add($src1, sub(#$src2, $src3))",
2707 [(set (i32 IntRegs:$dst),
2708 (sub (add (i32 IntRegs:$src1), s6_10ExtPred:$src2),
2709 (i32 IntRegs:$src3)))]>,
2713 // Add or subtract doublewords with carry.
2715 // Rdd=add(Rss,Rtt,Px):carry
2717 // Rdd=sub(Rss,Rtt,Px):carry
2720 // Logical doublewords.
2721 // Rdd=and(Rtt,~Rss)
2722 let validSubTargets = HasV4SubT in
2723 def ANDd_NOTd_V4 : MInst<(outs DoubleRegs:$dst),
2724 (ins DoubleRegs:$src1, DoubleRegs:$src2),
2725 "$dst = and($src1, ~$src2)",
2726 [(set (i64 DoubleRegs:$dst), (and (i64 DoubleRegs:$src1),
2727 (not (i64 DoubleRegs:$src2))))]>,
2731 let validSubTargets = HasV4SubT in
2732 def ORd_NOTd_V4 : MInst<(outs DoubleRegs:$dst),
2733 (ins DoubleRegs:$src1, DoubleRegs:$src2),
2734 "$dst = or($src1, ~$src2)",
2735 [(set (i64 DoubleRegs:$dst),
2736 (or (i64 DoubleRegs:$src1), (not (i64 DoubleRegs:$src2))))]>,
2740 // Logical-logical doublewords.
2741 // Rxx^=xor(Rss,Rtt)
2742 let validSubTargets = HasV4SubT in
2743 def XORd_XORdd: MInst_acc<(outs DoubleRegs:$dst),
2744 (ins DoubleRegs:$src1, DoubleRegs:$src2, DoubleRegs:$src3),
2745 "$dst ^= xor($src2, $src3)",
2746 [(set (i64 DoubleRegs:$dst),
2747 (xor (i64 DoubleRegs:$src1), (xor (i64 DoubleRegs:$src2),
2748 (i64 DoubleRegs:$src3))))],
2753 // Logical-logical words.
2754 // Rx=or(Ru,and(Rx,#s10))
2755 let isExtendable = 1, opExtendable = 3, isExtentSigned = 1, opExtentBits = 10,
2756 validSubTargets = HasV4SubT in
2757 def ORr_ANDri_V4 : MInst_acc<(outs IntRegs:$dst),
2758 (ins IntRegs:$src1, IntRegs: $src2, s10Ext:$src3),
2759 "$dst = or($src1, and($src2, #$src3))",
2760 [(set (i32 IntRegs:$dst),
2761 (or (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
2762 s10ExtPred:$src3)))],
2766 // Rx[&|^]=and(Rs,Rt)
2768 let validSubTargets = HasV4SubT in
2769 def ANDr_ANDrr_V4 : MInst_acc<(outs IntRegs:$dst),
2770 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2771 "$dst &= and($src2, $src3)",
2772 [(set (i32 IntRegs:$dst),
2773 (and (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
2774 (i32 IntRegs:$src3))))],
2779 let validSubTargets = HasV4SubT, CextOpcode = "ORr_ANDr", InputType = "reg" in
2780 def ORr_ANDrr_V4 : MInst_acc<(outs IntRegs:$dst),
2781 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2782 "$dst |= and($src2, $src3)",
2783 [(set (i32 IntRegs:$dst),
2784 (or (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
2785 (i32 IntRegs:$src3))))],
2787 Requires<[HasV4T]>, ImmRegRel;
2790 let validSubTargets = HasV4SubT in
2791 def XORr_ANDrr_V4 : MInst_acc<(outs IntRegs:$dst),
2792 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2793 "$dst ^= and($src2, $src3)",
2794 [(set (i32 IntRegs:$dst),
2795 (xor (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
2796 (i32 IntRegs:$src3))))],
2800 // Rx[&|^]=and(Rs,~Rt)
2802 let validSubTargets = HasV4SubT in
2803 def ANDr_ANDr_NOTr_V4 : MInst_acc<(outs IntRegs:$dst),
2804 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2805 "$dst &= and($src2, ~$src3)",
2806 [(set (i32 IntRegs:$dst),
2807 (and (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
2808 (not (i32 IntRegs:$src3)))))],
2813 let validSubTargets = HasV4SubT in
2814 def ORr_ANDr_NOTr_V4 : MInst_acc<(outs IntRegs:$dst),
2815 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2816 "$dst |= and($src2, ~$src3)",
2817 [(set (i32 IntRegs:$dst),
2818 (or (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
2819 (not (i32 IntRegs:$src3)))))],
2824 let validSubTargets = HasV4SubT in
2825 def XORr_ANDr_NOTr_V4 : MInst_acc<(outs IntRegs:$dst),
2826 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2827 "$dst ^= and($src2, ~$src3)",
2828 [(set (i32 IntRegs:$dst),
2829 (xor (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
2830 (not (i32 IntRegs:$src3)))))],
2834 // Rx[&|^]=or(Rs,Rt)
2836 let validSubTargets = HasV4SubT in
2837 def ANDr_ORrr_V4 : MInst_acc<(outs IntRegs:$dst),
2838 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2839 "$dst &= or($src2, $src3)",
2840 [(set (i32 IntRegs:$dst),
2841 (and (i32 IntRegs:$src1), (or (i32 IntRegs:$src2),
2842 (i32 IntRegs:$src3))))],
2847 let validSubTargets = HasV4SubT, CextOpcode = "ORr_ORr", InputType = "reg" in
2848 def ORr_ORrr_V4 : MInst_acc<(outs IntRegs:$dst),
2849 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2850 "$dst |= or($src2, $src3)",
2851 [(set (i32 IntRegs:$dst),
2852 (or (i32 IntRegs:$src1), (or (i32 IntRegs:$src2),
2853 (i32 IntRegs:$src3))))],
2855 Requires<[HasV4T]>, ImmRegRel;
2858 let validSubTargets = HasV4SubT in
2859 def XORr_ORrr_V4 : MInst_acc<(outs IntRegs:$dst),
2860 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2861 "$dst ^= or($src2, $src3)",
2862 [(set (i32 IntRegs:$dst),
2863 (xor (i32 IntRegs:$src1), (or (i32 IntRegs:$src2),
2864 (i32 IntRegs:$src3))))],
2868 // Rx[&|^]=xor(Rs,Rt)
2870 let validSubTargets = HasV4SubT in
2871 def ANDr_XORrr_V4 : MInst_acc<(outs IntRegs:$dst),
2872 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2873 "$dst &= xor($src2, $src3)",
2874 [(set (i32 IntRegs:$dst),
2875 (and (i32 IntRegs:$src1), (xor (i32 IntRegs:$src2),
2876 (i32 IntRegs:$src3))))],
2881 let validSubTargets = HasV4SubT in
2882 def ORr_XORrr_V4 : MInst_acc<(outs IntRegs:$dst),
2883 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2884 "$dst |= xor($src2, $src3)",
2885 [(set (i32 IntRegs:$dst),
2886 (and (i32 IntRegs:$src1), (xor (i32 IntRegs:$src2),
2887 (i32 IntRegs:$src3))))],
2892 let validSubTargets = HasV4SubT in
2893 def XORr_XORrr_V4 : MInst_acc<(outs IntRegs:$dst),
2894 (ins IntRegs:$src1, IntRegs: $src2, IntRegs:$src3),
2895 "$dst ^= xor($src2, $src3)",
2896 [(set (i32 IntRegs:$dst),
2897 (and (i32 IntRegs:$src1), (xor (i32 IntRegs:$src2),
2898 (i32 IntRegs:$src3))))],
2903 let isExtendable = 1, opExtendable = 3, isExtentSigned = 1, opExtentBits = 10,
2904 validSubTargets = HasV4SubT, CextOpcode = "ORr_ANDr", InputType = "imm" in
2905 def ORr_ANDri2_V4 : MInst_acc<(outs IntRegs:$dst),
2906 (ins IntRegs:$src1, IntRegs: $src2, s10Ext:$src3),
2907 "$dst |= and($src2, #$src3)",
2908 [(set (i32 IntRegs:$dst),
2909 (or (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
2910 s10ExtPred:$src3)))],
2912 Requires<[HasV4T]>, ImmRegRel;
2915 let isExtendable = 1, opExtendable = 3, isExtentSigned = 1, opExtentBits = 10,
2916 validSubTargets = HasV4SubT, CextOpcode = "ORr_ORr", InputType = "imm" in
2917 def ORr_ORri_V4 : MInst_acc<(outs IntRegs:$dst),
2918 (ins IntRegs:$src1, IntRegs: $src2, s10Ext:$src3),
2919 "$dst |= or($src2, #$src3)",
2920 [(set (i32 IntRegs:$dst),
2921 (or (i32 IntRegs:$src1), (and (i32 IntRegs:$src2),
2922 s10ExtPred:$src3)))],
2924 Requires<[HasV4T]>, ImmRegRel;
2928 // Rd=modwrap(Rs,Rt)
2930 // Rd=cround(Rs,#u5)
2932 // Rd=round(Rs,#u5)[:sat]
2933 // Rd=round(Rs,Rt)[:sat]
2934 // Vector reduce add unsigned halfwords
2935 // Rd=vraddh(Rss,Rtt)
2937 // Rdd=vaddb(Rss,Rtt)
2938 // Vector conditional negate
2939 // Rdd=vcnegh(Rss,Rt)
2940 // Rxx+=vrcnegh(Rss,Rt)
2941 // Vector maximum bytes
2942 // Rdd=vmaxb(Rtt,Rss)
2943 // Vector reduce maximum halfwords
2944 // Rxx=vrmaxh(Rss,Ru)
2945 // Rxx=vrmaxuh(Rss,Ru)
2946 // Vector reduce maximum words
2947 // Rxx=vrmaxuw(Rss,Ru)
2948 // Rxx=vrmaxw(Rss,Ru)
2949 // Vector minimum bytes
2950 // Rdd=vminb(Rtt,Rss)
2951 // Vector reduce minimum halfwords
2952 // Rxx=vrminh(Rss,Ru)
2953 // Rxx=vrminuh(Rss,Ru)
2954 // Vector reduce minimum words
2955 // Rxx=vrminuw(Rss,Ru)
2956 // Rxx=vrminw(Rss,Ru)
2957 // Vector subtract bytes
2958 // Rdd=vsubb(Rss,Rtt)
2960 //===----------------------------------------------------------------------===//
2962 //===----------------------------------------------------------------------===//
2965 //===----------------------------------------------------------------------===//
2967 //===----------------------------------------------------------------------===//
2969 // Multiply and user lower result.
2970 // Rd=add(#u6,mpyi(Rs,#U6))
2971 let isExtendable = 1, opExtendable = 1, isExtentSigned = 0, opExtentBits = 6,
2972 validSubTargets = HasV4SubT in
2973 def ADDi_MPYri_V4 : MInst<(outs IntRegs:$dst),
2974 (ins u6Ext:$src1, IntRegs:$src2, u6Imm:$src3),
2975 "$dst = add(#$src1, mpyi($src2, #$src3))",
2976 [(set (i32 IntRegs:$dst),
2977 (add (mul (i32 IntRegs:$src2), u6ImmPred:$src3),
2978 u6ExtPred:$src1))]>,
2981 // Rd=add(##,mpyi(Rs,#U6))
2982 def : Pat <(add (mul (i32 IntRegs:$src2), u6ImmPred:$src3),
2983 (HexagonCONST32 tglobaladdr:$src1)),
2984 (i32 (ADDi_MPYri_V4 tglobaladdr:$src1, IntRegs:$src2,
2987 // Rd=add(#u6,mpyi(Rs,Rt))
2988 let isExtendable = 1, opExtendable = 1, isExtentSigned = 0, opExtentBits = 6,
2989 validSubTargets = HasV4SubT, InputType = "imm", CextOpcode = "ADD_MPY" in
2990 def ADDi_MPYrr_V4 : MInst<(outs IntRegs:$dst),
2991 (ins u6Ext:$src1, IntRegs:$src2, IntRegs:$src3),
2992 "$dst = add(#$src1, mpyi($src2, $src3))",
2993 [(set (i32 IntRegs:$dst),
2994 (add (mul (i32 IntRegs:$src2), (i32 IntRegs:$src3)),
2995 u6ExtPred:$src1))]>,
2996 Requires<[HasV4T]>, ImmRegRel;
2998 // Rd=add(##,mpyi(Rs,Rt))
2999 def : Pat <(add (mul (i32 IntRegs:$src2), (i32 IntRegs:$src3)),
3000 (HexagonCONST32 tglobaladdr:$src1)),
3001 (i32 (ADDi_MPYrr_V4 tglobaladdr:$src1, IntRegs:$src2,
3004 // Rd=add(Ru,mpyi(#u6:2,Rs))
3005 let validSubTargets = HasV4SubT in
3006 def ADDr_MPYir_V4 : MInst<(outs IntRegs:$dst),
3007 (ins IntRegs:$src1, u6Imm:$src2, IntRegs:$src3),
3008 "$dst = add($src1, mpyi(#$src2, $src3))",
3009 [(set (i32 IntRegs:$dst),
3010 (add (i32 IntRegs:$src1), (mul (i32 IntRegs:$src3),
3011 u6_2ImmPred:$src2)))]>,
3014 // Rd=add(Ru,mpyi(Rs,#u6))
3015 let isExtendable = 1, opExtendable = 3, isExtentSigned = 0, opExtentBits = 6,
3016 validSubTargets = HasV4SubT, InputType = "imm", CextOpcode = "ADD_MPY" in
3017 def ADDr_MPYri_V4 : MInst<(outs IntRegs:$dst),
3018 (ins IntRegs:$src1, IntRegs:$src2, u6Ext:$src3),
3019 "$dst = add($src1, mpyi($src2, #$src3))",
3020 [(set (i32 IntRegs:$dst),
3021 (add (i32 IntRegs:$src1), (mul (i32 IntRegs:$src2),
3022 u6ExtPred:$src3)))]>,
3023 Requires<[HasV4T]>, ImmRegRel;
3025 // Rx=add(Ru,mpyi(Rx,Rs))
3026 let validSubTargets = HasV4SubT, InputType = "reg", CextOpcode = "ADD_MPY" in
3027 def ADDr_MPYrr_V4 : MInst_acc<(outs IntRegs:$dst),
3028 (ins IntRegs:$src1, IntRegs:$src2, IntRegs:$src3),
3029 "$dst = add($src1, mpyi($src2, $src3))",
3030 [(set (i32 IntRegs:$dst),
3031 (add (i32 IntRegs:$src1), (mul (i32 IntRegs:$src2),
3032 (i32 IntRegs:$src3))))],
3034 Requires<[HasV4T]>, ImmRegRel;
3037 // Polynomial multiply words
3039 // Rxx^=pmpyw(Rs,Rt)
3041 // Vector reduce multiply word by signed half (32x16)
3042 // Rdd=vrmpyweh(Rss,Rtt)[:<<1]
3043 // Rdd=vrmpywoh(Rss,Rtt)[:<<1]
3044 // Rxx+=vrmpyweh(Rss,Rtt)[:<<1]
3045 // Rxx+=vrmpywoh(Rss,Rtt)[:<<1]
3047 // Multiply and use upper result
3048 // Rd=mpy(Rs,Rt.H):<<1:sat
3049 // Rd=mpy(Rs,Rt.L):<<1:sat
3050 // Rd=mpy(Rs,Rt):<<1
3051 // Rd=mpy(Rs,Rt):<<1:sat
3053 // Rx+=mpy(Rs,Rt):<<1:sat
3054 // Rx-=mpy(Rs,Rt):<<1:sat
3056 // Vector multiply bytes
3057 // Rdd=vmpybsu(Rs,Rt)
3058 // Rdd=vmpybu(Rs,Rt)
3059 // Rxx+=vmpybsu(Rs,Rt)
3060 // Rxx+=vmpybu(Rs,Rt)
3062 // Vector polynomial multiply halfwords
3063 // Rdd=vpmpyh(Rs,Rt)
3064 // Rxx^=vpmpyh(Rs,Rt)
3066 //===----------------------------------------------------------------------===//
3068 //===----------------------------------------------------------------------===//
3071 //===----------------------------------------------------------------------===//
3073 //===----------------------------------------------------------------------===//
3075 // Shift by immediate and accumulate.
3076 // Rx=add(#u8,asl(Rx,#U5))
3077 let isExtendable = 1, opExtendable = 1, isExtentSigned = 0, opExtentBits = 8,
3078 validSubTargets = HasV4SubT in
3079 def ADDi_ASLri_V4 : MInst_acc<(outs IntRegs:$dst),
3080 (ins u8Ext:$src1, IntRegs:$src2, u5Imm:$src3),
3081 "$dst = add(#$src1, asl($src2, #$src3))",
3082 [(set (i32 IntRegs:$dst),
3083 (add (shl (i32 IntRegs:$src2), u5ImmPred:$src3),
3088 // Rx=add(#u8,lsr(Rx,#U5))
3089 let isExtendable = 1, opExtendable = 1, isExtentSigned = 0, opExtentBits = 8,
3090 validSubTargets = HasV4SubT in
3091 def ADDi_LSRri_V4 : MInst_acc<(outs IntRegs:$dst),
3092 (ins u8Ext:$src1, IntRegs:$src2, u5Imm:$src3),
3093 "$dst = add(#$src1, lsr($src2, #$src3))",
3094 [(set (i32 IntRegs:$dst),
3095 (add (srl (i32 IntRegs:$src2), u5ImmPred:$src3),
3100 // Rx=sub(#u8,asl(Rx,#U5))
3101 let isExtendable = 1, opExtendable = 1, isExtentSigned = 0, opExtentBits = 8,
3102 validSubTargets = HasV4SubT in
3103 def SUBi_ASLri_V4 : MInst_acc<(outs IntRegs:$dst),
3104 (ins u8Ext:$src1, IntRegs:$src2, u5Imm:$src3),
3105 "$dst = sub(#$src1, asl($src2, #$src3))",
3106 [(set (i32 IntRegs:$dst),
3107 (sub (shl (i32 IntRegs:$src2), u5ImmPred:$src3),
3112 // Rx=sub(#u8,lsr(Rx,#U5))
3113 let isExtendable = 1, opExtendable = 1, isExtentSigned = 0, opExtentBits = 8,
3114 validSubTargets = HasV4SubT in
3115 def SUBi_LSRri_V4 : MInst_acc<(outs IntRegs:$dst),
3116 (ins u8Ext:$src1, IntRegs:$src2, u5Imm:$src3),
3117 "$dst = sub(#$src1, lsr($src2, #$src3))",
3118 [(set (i32 IntRegs:$dst),
3119 (sub (srl (i32 IntRegs:$src2), u5ImmPred:$src3),
3125 //Shift by immediate and logical.
3126 //Rx=and(#u8,asl(Rx,#U5))
3127 let isExtendable = 1, opExtendable = 1, isExtentSigned = 0, opExtentBits = 8,
3128 validSubTargets = HasV4SubT in
3129 def ANDi_ASLri_V4 : MInst_acc<(outs IntRegs:$dst),
3130 (ins u8Ext:$src1, IntRegs:$src2, u5Imm:$src3),
3131 "$dst = and(#$src1, asl($src2, #$src3))",
3132 [(set (i32 IntRegs:$dst),
3133 (and (shl (i32 IntRegs:$src2), u5ImmPred:$src3),
3138 //Rx=and(#u8,lsr(Rx,#U5))
3139 let isExtendable = 1, opExtendable = 1, isExtentSigned = 0, opExtentBits = 8,
3140 validSubTargets = HasV4SubT in
3141 def ANDi_LSRri_V4 : MInst_acc<(outs IntRegs:$dst),
3142 (ins u8Ext:$src1, IntRegs:$src2, u5Imm:$src3),
3143 "$dst = and(#$src1, lsr($src2, #$src3))",
3144 [(set (i32 IntRegs:$dst),
3145 (and (srl (i32 IntRegs:$src2), u5ImmPred:$src3),
3150 //Rx=or(#u8,asl(Rx,#U5))
3151 let isExtendable = 1, opExtendable = 1, isExtentSigned = 0, opExtentBits = 8,
3152 AddedComplexity = 30, validSubTargets = HasV4SubT in
3153 def ORi_ASLri_V4 : MInst_acc<(outs IntRegs:$dst),
3154 (ins u8Ext:$src1, IntRegs:$src2, u5Imm:$src3),
3155 "$dst = or(#$src1, asl($src2, #$src3))",
3156 [(set (i32 IntRegs:$dst),
3157 (or (shl (i32 IntRegs:$src2), u5ImmPred:$src3),
3162 //Rx=or(#u8,lsr(Rx,#U5))
3163 let isExtendable = 1, opExtendable = 1, isExtentSigned = 0, opExtentBits = 8,
3164 AddedComplexity = 30, validSubTargets = HasV4SubT in
3165 def ORi_LSRri_V4 : MInst_acc<(outs IntRegs:$dst),
3166 (ins u8Ext:$src1, IntRegs:$src2, u5Imm:$src3),
3167 "$dst = or(#$src1, lsr($src2, #$src3))",
3168 [(set (i32 IntRegs:$dst),
3169 (or (srl (i32 IntRegs:$src2), u5ImmPred:$src3),
3175 //Shift by register.
3177 let validSubTargets = HasV4SubT in {
3178 def LSLi_V4 : MInst<(outs IntRegs:$dst), (ins s6Imm:$src1, IntRegs:$src2),
3179 "$dst = lsl(#$src1, $src2)",
3180 [(set (i32 IntRegs:$dst), (shl s6ImmPred:$src1,
3181 (i32 IntRegs:$src2)))]>,
3185 //Shift by register and logical.
3187 def ASLd_rr_xor_V4 : MInst_acc<(outs DoubleRegs:$dst),
3188 (ins DoubleRegs:$src1, DoubleRegs:$src2, IntRegs:$src3),
3189 "$dst ^= asl($src2, $src3)",
3190 [(set (i64 DoubleRegs:$dst),
3191 (xor (i64 DoubleRegs:$src1), (shl (i64 DoubleRegs:$src2),
3192 (i32 IntRegs:$src3))))],
3197 def ASRd_rr_xor_V4 : MInst_acc<(outs DoubleRegs:$dst),
3198 (ins DoubleRegs:$src1, DoubleRegs:$src2, IntRegs:$src3),
3199 "$dst ^= asr($src2, $src3)",
3200 [(set (i64 DoubleRegs:$dst),
3201 (xor (i64 DoubleRegs:$src1), (sra (i64 DoubleRegs:$src2),
3202 (i32 IntRegs:$src3))))],
3207 def LSLd_rr_xor_V4 : MInst_acc<(outs DoubleRegs:$dst),
3208 (ins DoubleRegs:$src1, DoubleRegs:$src2, IntRegs:$src3),
3209 "$dst ^= lsl($src2, $src3)",
3210 [(set (i64 DoubleRegs:$dst), (xor (i64 DoubleRegs:$src1),
3211 (shl (i64 DoubleRegs:$src2),
3212 (i32 IntRegs:$src3))))],
3217 def LSRd_rr_xor_V4 : MInst_acc<(outs DoubleRegs:$dst),
3218 (ins DoubleRegs:$src1, DoubleRegs:$src2, IntRegs:$src3),
3219 "$dst ^= lsr($src2, $src3)",
3220 [(set (i64 DoubleRegs:$dst),
3221 (xor (i64 DoubleRegs:$src1), (srl (i64 DoubleRegs:$src2),
3222 (i32 IntRegs:$src3))))],
3227 //===----------------------------------------------------------------------===//
3229 //===----------------------------------------------------------------------===//
3231 //===----------------------------------------------------------------------===//
3232 // MEMOP: Word, Half, Byte
3233 //===----------------------------------------------------------------------===//
3235 //===----------------------------------------------------------------------===//
3239 // MEMw_ADDi_indexed_V4 : memw(Rs+#u6:2)+=#U5
3240 // MEMw_SUBi_indexed_V4 : memw(Rs+#u6:2)-=#U5
3241 // MEMw_ADDr_indexed_V4 : memw(Rs+#u6:2)+=Rt
3242 // MEMw_SUBr_indexed_V4 : memw(Rs+#u6:2)-=Rt
3243 // MEMw_CLRr_indexed_V4 : memw(Rs+#u6:2)&=Rt
3244 // MEMw_SETr_indexed_V4 : memw(Rs+#u6:2)|=Rt
3245 // MEMw_ADDi_V4 : memw(Rs+#u6:2)+=#U5
3246 // MEMw_SUBi_V4 : memw(Rs+#u6:2)-=#U5
3247 // MEMw_ADDr_V4 : memw(Rs+#u6:2)+=Rt
3248 // MEMw_SUBr_V4 : memw(Rs+#u6:2)-=Rt
3249 // MEMw_CLRr_V4 : memw(Rs+#u6:2)&=Rt
3250 // MEMw_SETr_V4 : memw(Rs+#u6:2)|=Rt
3253 // MEMw_CLRi_indexed_V4 : memw(Rs+#u6:2)=clrbit(#U5)
3254 // MEMw_SETi_indexed_V4 : memw(Rs+#u6:2)=setbit(#U5)
3255 // MEMw_CLRi_V4 : memw(Rs+#u6:2)=clrbit(#U5)
3256 // MEMw_SETi_V4 : memw(Rs+#u6:2)=setbit(#U5)
3257 //===----------------------------------------------------------------------===//
3261 // memw(Rs+#u6:2) += #U5
3262 let AddedComplexity = 30 in
3263 def MEMw_ADDi_indexed_MEM_V4 : MEMInst_V4<(outs),
3264 (ins IntRegs:$base, u6_2Imm:$offset, u5Imm:$addend),
3265 "memw($base+#$offset) += #$addend",
3267 Requires<[HasV4T, UseMEMOP]>;
3269 // memw(Rs+#u6:2) -= #U5
3270 let AddedComplexity = 30 in
3271 def MEMw_SUBi_indexed_MEM_V4 : MEMInst_V4<(outs),
3272 (ins IntRegs:$base, u6_2Imm:$offset, u5Imm:$subend),
3273 "memw($base+#$offset) -= #$subend",
3275 Requires<[HasV4T, UseMEMOP]>;
3277 // memw(Rs+#u6:2) += Rt
3278 let AddedComplexity = 30 in
3279 def MEMw_ADDr_indexed_MEM_V4 : MEMInst_V4<(outs),
3280 (ins IntRegs:$base, u6_2Imm:$offset, IntRegs:$addend),
3281 "memw($base+#$offset) += $addend",
3282 [(store (add (load (add (i32 IntRegs:$base), u6_2ImmPred:$offset)),
3283 (i32 IntRegs:$addend)),
3284 (add (i32 IntRegs:$base), u6_2ImmPred:$offset))]>,
3285 Requires<[HasV4T, UseMEMOP]>;
3287 // memw(Rs+#u6:2) -= Rt
3288 let AddedComplexity = 30 in
3289 def MEMw_SUBr_indexed_MEM_V4 : MEMInst_V4<(outs),
3290 (ins IntRegs:$base, u6_2Imm:$offset, IntRegs:$subend),
3291 "memw($base+#$offset) -= $subend",
3292 [(store (sub (load (add (i32 IntRegs:$base), u6_2ImmPred:$offset)),
3293 (i32 IntRegs:$subend)),
3294 (add (i32 IntRegs:$base), u6_2ImmPred:$offset))]>,
3295 Requires<[HasV4T, UseMEMOP]>;
3297 // memw(Rs+#u6:2) &= Rt
3298 let AddedComplexity = 30 in
3299 def MEMw_ANDr_indexed_MEM_V4 : MEMInst_V4<(outs),
3300 (ins IntRegs:$base, u6_2Imm:$offset, IntRegs:$andend),
3301 "memw($base+#$offset) &= $andend",
3302 [(store (and (load (add (i32 IntRegs:$base), u6_2ImmPred:$offset)),
3303 (i32 IntRegs:$andend)),
3304 (add (i32 IntRegs:$base), u6_2ImmPred:$offset))]>,
3305 Requires<[HasV4T, UseMEMOP]>;
3307 // memw(Rs+#u6:2) |= Rt
3308 let AddedComplexity = 30 in
3309 def MEMw_ORr_indexed_MEM_V4 : MEMInst_V4<(outs),
3310 (ins IntRegs:$base, u6_2Imm:$offset, IntRegs:$orend),
3311 "memw($base+#$offset) |= $orend",
3312 [(store (or (load (add (i32 IntRegs:$base), u6_2ImmPred:$offset)),
3313 (i32 IntRegs:$orend)),
3314 (add (i32 IntRegs:$base), u6_2ImmPred:$offset))]>,
3315 Requires<[HasV4T, UseMEMOP]>;
3317 // memw(Rs+#u6:2) += #U5
3318 let AddedComplexity = 30 in
3319 def MEMw_ADDi_MEM_V4 : MEMInst_V4<(outs),
3320 (ins MEMri:$addr, u5Imm:$addend),
3321 "memw($addr) += $addend",
3323 Requires<[HasV4T, UseMEMOP]>;
3325 // memw(Rs+#u6:2) -= #U5
3326 let AddedComplexity = 30 in
3327 def MEMw_SUBi_MEM_V4 : MEMInst_V4<(outs),
3328 (ins MEMri:$addr, u5Imm:$subend),
3329 "memw($addr) -= $subend",
3331 Requires<[HasV4T, UseMEMOP]>;
3333 // memw(Rs+#u6:2) += Rt
3334 let AddedComplexity = 30 in
3335 def MEMw_ADDr_MEM_V4 : MEMInst_V4<(outs),
3336 (ins MEMri:$addr, IntRegs:$addend),
3337 "memw($addr) += $addend",
3338 [(store (add (load ADDRriU6_2:$addr), (i32 IntRegs:$addend)),
3339 ADDRriU6_2:$addr)]>,
3340 Requires<[HasV4T, UseMEMOP]>;
3342 // memw(Rs+#u6:2) -= Rt
3343 let AddedComplexity = 30 in
3344 def MEMw_SUBr_MEM_V4 : MEMInst_V4<(outs),
3345 (ins MEMri:$addr, IntRegs:$subend),
3346 "memw($addr) -= $subend",
3347 [(store (sub (load ADDRriU6_2:$addr), (i32 IntRegs:$subend)),
3348 ADDRriU6_2:$addr)]>,
3349 Requires<[HasV4T, UseMEMOP]>;
3351 // memw(Rs+#u6:2) &= Rt
3352 let AddedComplexity = 30 in
3353 def MEMw_ANDr_MEM_V4 : MEMInst_V4<(outs),
3354 (ins MEMri:$addr, IntRegs:$andend),
3355 "memw($addr) &= $andend",
3356 [(store (and (load ADDRriU6_2:$addr), (i32 IntRegs:$andend)),
3357 ADDRriU6_2:$addr)]>,
3358 Requires<[HasV4T, UseMEMOP]>;
3360 // memw(Rs+#u6:2) |= Rt
3361 let AddedComplexity = 30 in
3362 def MEMw_ORr_MEM_V4 : MEMInst_V4<(outs),
3363 (ins MEMri:$addr, IntRegs:$orend),
3364 "memw($addr) |= $orend",
3365 [(store (or (load ADDRriU6_2:$addr), (i32 IntRegs:$orend)),
3366 ADDRriU6_2:$addr)]>,
3367 Requires<[HasV4T, UseMEMOP]>;
3369 //===----------------------------------------------------------------------===//
3373 // MEMh_ADDi_indexed_V4 : memw(Rs+#u6:2)+=#U5
3374 // MEMh_SUBi_indexed_V4 : memw(Rs+#u6:2)-=#U5
3375 // MEMh_ADDr_indexed_V4 : memw(Rs+#u6:2)+=Rt
3376 // MEMh_SUBr_indexed_V4 : memw(Rs+#u6:2)-=Rt
3377 // MEMh_CLRr_indexed_V4 : memw(Rs+#u6:2)&=Rt
3378 // MEMh_SETr_indexed_V4 : memw(Rs+#u6:2)|=Rt
3379 // MEMh_ADDi_V4 : memw(Rs+#u6:2)+=#U5
3380 // MEMh_SUBi_V4 : memw(Rs+#u6:2)-=#U5
3381 // MEMh_ADDr_V4 : memw(Rs+#u6:2)+=Rt
3382 // MEMh_SUBr_V4 : memw(Rs+#u6:2)-=Rt
3383 // MEMh_CLRr_V4 : memw(Rs+#u6:2)&=Rt
3384 // MEMh_SETr_V4 : memw(Rs+#u6:2)|=Rt
3387 // MEMh_CLRi_indexed_V4 : memw(Rs+#u6:2)=clrbit(#U5)
3388 // MEMh_SETi_indexed_V4 : memw(Rs+#u6:2)=setbit(#U5)
3389 // MEMh_CLRi_V4 : memw(Rs+#u6:2)=clrbit(#U5)
3390 // MEMh_SETi_V4 : memw(Rs+#u6:2)=setbit(#U5)
3391 //===----------------------------------------------------------------------===//
3394 // memh(Rs+#u6:1) += #U5
3395 let AddedComplexity = 30 in
3396 def MEMh_ADDi_indexed_MEM_V4 : MEMInst_V4<(outs),
3397 (ins IntRegs:$base, u6_1Imm:$offset, u5Imm:$addend),
3398 "memh($base+#$offset) += $addend",
3400 Requires<[HasV4T, UseMEMOP]>;
3402 // memh(Rs+#u6:1) -= #U5
3403 let AddedComplexity = 30 in
3404 def MEMh_SUBi_indexed_MEM_V4 : MEMInst_V4<(outs),
3405 (ins IntRegs:$base, u6_1Imm:$offset, u5Imm:$subend),
3406 "memh($base+#$offset) -= $subend",
3408 Requires<[HasV4T, UseMEMOP]>;
3410 // memh(Rs+#u6:1) += Rt
3411 let AddedComplexity = 30 in
3412 def MEMh_ADDr_indexed_MEM_V4 : MEMInst_V4<(outs),
3413 (ins IntRegs:$base, u6_1Imm:$offset, IntRegs:$addend),
3414 "memh($base+#$offset) += $addend",
3415 [(truncstorei16 (add (sextloadi16 (add (i32 IntRegs:$base),
3416 u6_1ImmPred:$offset)),
3417 (i32 IntRegs:$addend)),
3418 (add (i32 IntRegs:$base), u6_1ImmPred:$offset))]>,
3419 Requires<[HasV4T, UseMEMOP]>;
3421 // memh(Rs+#u6:1) -= Rt
3422 let AddedComplexity = 30 in
3423 def MEMh_SUBr_indexed_MEM_V4 : MEMInst_V4<(outs),
3424 (ins IntRegs:$base, u6_1Imm:$offset, IntRegs:$subend),
3425 "memh($base+#$offset) -= $subend",
3426 [(truncstorei16 (sub (sextloadi16 (add (i32 IntRegs:$base),
3427 u6_1ImmPred:$offset)),
3428 (i32 IntRegs:$subend)),
3429 (add (i32 IntRegs:$base), u6_1ImmPred:$offset))]>,
3430 Requires<[HasV4T, UseMEMOP]>;
3432 // memh(Rs+#u6:1) &= Rt
3433 let AddedComplexity = 30 in
3434 def MEMh_ANDr_indexed_MEM_V4 : MEMInst_V4<(outs),
3435 (ins IntRegs:$base, u6_1Imm:$offset, IntRegs:$andend),
3436 "memh($base+#$offset) += $andend",
3437 [(truncstorei16 (and (sextloadi16 (add (i32 IntRegs:$base),
3438 u6_1ImmPred:$offset)),
3439 (i32 IntRegs:$andend)),
3440 (add (i32 IntRegs:$base), u6_1ImmPred:$offset))]>,
3441 Requires<[HasV4T, UseMEMOP]>;
3443 // memh(Rs+#u6:1) |= Rt
3444 let AddedComplexity = 30 in
3445 def MEMh_ORr_indexed_MEM_V4 : MEMInst_V4<(outs),
3446 (ins IntRegs:$base, u6_1Imm:$offset, IntRegs:$orend),
3447 "memh($base+#$offset) |= $orend",
3448 [(truncstorei16 (or (sextloadi16 (add (i32 IntRegs:$base),
3449 u6_1ImmPred:$offset)),
3450 (i32 IntRegs:$orend)),
3451 (add (i32 IntRegs:$base), u6_1ImmPred:$offset))]>,
3452 Requires<[HasV4T, UseMEMOP]>;
3454 // memh(Rs+#u6:1) += #U5
3455 let AddedComplexity = 30 in
3456 def MEMh_ADDi_MEM_V4 : MEMInst_V4<(outs),
3457 (ins MEMri:$addr, u5Imm:$addend),
3458 "memh($addr) += $addend",
3460 Requires<[HasV4T, UseMEMOP]>;
3462 // memh(Rs+#u6:1) -= #U5
3463 let AddedComplexity = 30 in
3464 def MEMh_SUBi_MEM_V4 : MEMInst_V4<(outs),
3465 (ins MEMri:$addr, u5Imm:$subend),
3466 "memh($addr) -= $subend",
3468 Requires<[HasV4T, UseMEMOP]>;
3470 // memh(Rs+#u6:1) += Rt
3471 let AddedComplexity = 30 in
3472 def MEMh_ADDr_MEM_V4 : MEMInst_V4<(outs),
3473 (ins MEMri:$addr, IntRegs:$addend),
3474 "memh($addr) += $addend",
3475 [(truncstorei16 (add (sextloadi16 ADDRriU6_1:$addr),
3476 (i32 IntRegs:$addend)), ADDRriU6_1:$addr)]>,
3477 Requires<[HasV4T, UseMEMOP]>;
3479 // memh(Rs+#u6:1) -= Rt
3480 let AddedComplexity = 30 in
3481 def MEMh_SUBr_MEM_V4 : MEMInst_V4<(outs),
3482 (ins MEMri:$addr, IntRegs:$subend),
3483 "memh($addr) -= $subend",
3484 [(truncstorei16 (sub (sextloadi16 ADDRriU6_1:$addr),
3485 (i32 IntRegs:$subend)), ADDRriU6_1:$addr)]>,
3486 Requires<[HasV4T, UseMEMOP]>;
3488 // memh(Rs+#u6:1) &= Rt
3489 let AddedComplexity = 30 in
3490 def MEMh_ANDr_MEM_V4 : MEMInst_V4<(outs),
3491 (ins MEMri:$addr, IntRegs:$andend),
3492 "memh($addr) &= $andend",
3493 [(truncstorei16 (and (sextloadi16 ADDRriU6_1:$addr),
3494 (i32 IntRegs:$andend)), ADDRriU6_1:$addr)]>,
3495 Requires<[HasV4T, UseMEMOP]>;
3497 // memh(Rs+#u6:1) |= Rt
3498 let AddedComplexity = 30 in
3499 def MEMh_ORr_MEM_V4 : MEMInst_V4<(outs),
3500 (ins MEMri:$addr, IntRegs:$orend),
3501 "memh($addr) |= $orend",
3502 [(truncstorei16 (or (sextloadi16 ADDRriU6_1:$addr),
3503 (i32 IntRegs:$orend)), ADDRriU6_1:$addr)]>,
3504 Requires<[HasV4T, UseMEMOP]>;
3507 //===----------------------------------------------------------------------===//
3511 // MEMb_ADDi_indexed_V4 : memb(Rs+#u6:0)+=#U5
3512 // MEMb_SUBi_indexed_V4 : memb(Rs+#u6:0)-=#U5
3513 // MEMb_ADDr_indexed_V4 : memb(Rs+#u6:0)+=Rt
3514 // MEMb_SUBr_indexed_V4 : memb(Rs+#u6:0)-=Rt
3515 // MEMb_CLRr_indexed_V4 : memb(Rs+#u6:0)&=Rt
3516 // MEMb_SETr_indexed_V4 : memb(Rs+#u6:0)|=Rt
3517 // MEMb_ADDi_V4 : memb(Rs+#u6:0)+=#U5
3518 // MEMb_SUBi_V4 : memb(Rs+#u6:0)-=#U5
3519 // MEMb_ADDr_V4 : memb(Rs+#u6:0)+=Rt
3520 // MEMb_SUBr_V4 : memb(Rs+#u6:0)-=Rt
3521 // MEMb_CLRr_V4 : memb(Rs+#u6:0)&=Rt
3522 // MEMb_SETr_V4 : memb(Rs+#u6:0)|=Rt
3525 // MEMb_CLRi_indexed_V4 : memb(Rs+#u6:0)=clrbit(#U5)
3526 // MEMb_SETi_indexed_V4 : memb(Rs+#u6:0)=setbit(#U5)
3527 // MEMb_CLRi_V4 : memb(Rs+#u6:0)=clrbit(#U5)
3528 // MEMb_SETi_V4 : memb(Rs+#u6:0)=setbit(#U5)
3529 //===----------------------------------------------------------------------===//
3531 // memb(Rs+#u6:0) += #U5
3532 let AddedComplexity = 30 in
3533 def MEMb_ADDi_indexed_MEM_V4 : MEMInst_V4<(outs),
3534 (ins IntRegs:$base, u6_0Imm:$offset, u5Imm:$addend),
3535 "memb($base+#$offset) += $addend",
3537 Requires<[HasV4T, UseMEMOP]>;
3539 // memb(Rs+#u6:0) -= #U5
3540 let AddedComplexity = 30 in
3541 def MEMb_SUBi_indexed_MEM_V4 : MEMInst_V4<(outs),
3542 (ins IntRegs:$base, u6_0Imm:$offset, u5Imm:$subend),
3543 "memb($base+#$offset) -= $subend",
3545 Requires<[HasV4T, UseMEMOP]>;
3547 // memb(Rs+#u6:0) += Rt
3548 let AddedComplexity = 30 in
3549 def MEMb_ADDr_indexed_MEM_V4 : MEMInst_V4<(outs),
3550 (ins IntRegs:$base, u6_0Imm:$offset, IntRegs:$addend),
3551 "memb($base+#$offset) += $addend",
3552 [(truncstorei8 (add (sextloadi8 (add (i32 IntRegs:$base),
3553 u6_0ImmPred:$offset)),
3554 (i32 IntRegs:$addend)),
3555 (add (i32 IntRegs:$base), u6_0ImmPred:$offset))]>,
3556 Requires<[HasV4T, UseMEMOP]>;
3558 // memb(Rs+#u6:0) -= Rt
3559 let AddedComplexity = 30 in
3560 def MEMb_SUBr_indexed_MEM_V4 : MEMInst_V4<(outs),
3561 (ins IntRegs:$base, u6_0Imm:$offset, IntRegs:$subend),
3562 "memb($base+#$offset) -= $subend",
3563 [(truncstorei8 (sub (sextloadi8 (add (i32 IntRegs:$base),
3564 u6_0ImmPred:$offset)),
3565 (i32 IntRegs:$subend)),
3566 (add (i32 IntRegs:$base), u6_0ImmPred:$offset))]>,
3567 Requires<[HasV4T, UseMEMOP]>;
3569 // memb(Rs+#u6:0) &= Rt
3570 let AddedComplexity = 30 in
3571 def MEMb_ANDr_indexed_MEM_V4 : MEMInst_V4<(outs),
3572 (ins IntRegs:$base, u6_0Imm:$offset, IntRegs:$andend),
3573 "memb($base+#$offset) += $andend",
3574 [(truncstorei8 (and (sextloadi8 (add (i32 IntRegs:$base),
3575 u6_0ImmPred:$offset)),
3576 (i32 IntRegs:$andend)),
3577 (add (i32 IntRegs:$base), u6_0ImmPred:$offset))]>,
3578 Requires<[HasV4T, UseMEMOP]>;
3580 // memb(Rs+#u6:0) |= Rt
3581 let AddedComplexity = 30 in
3582 def MEMb_ORr_indexed_MEM_V4 : MEMInst_V4<(outs),
3583 (ins IntRegs:$base, u6_0Imm:$offset, IntRegs:$orend),
3584 "memb($base+#$offset) |= $orend",
3585 [(truncstorei8 (or (sextloadi8 (add (i32 IntRegs:$base),
3586 u6_0ImmPred:$offset)),
3587 (i32 IntRegs:$orend)),
3588 (add (i32 IntRegs:$base), u6_0ImmPred:$offset))]>,
3589 Requires<[HasV4T, UseMEMOP]>;
3591 // memb(Rs+#u6:0) += #U5
3592 let AddedComplexity = 30 in
3593 def MEMb_ADDi_MEM_V4 : MEMInst_V4<(outs),
3594 (ins MEMri:$addr, u5Imm:$addend),
3595 "memb($addr) += $addend",
3597 Requires<[HasV4T, UseMEMOP]>;
3599 // memb(Rs+#u6:0) -= #U5
3600 let AddedComplexity = 30 in
3601 def MEMb_SUBi_MEM_V4 : MEMInst_V4<(outs),
3602 (ins MEMri:$addr, u5Imm:$subend),
3603 "memb($addr) -= $subend",
3605 Requires<[HasV4T, UseMEMOP]>;
3607 // memb(Rs+#u6:0) += Rt
3608 let AddedComplexity = 30 in
3609 def MEMb_ADDr_MEM_V4 : MEMInst_V4<(outs),
3610 (ins MEMri:$addr, IntRegs:$addend),
3611 "memb($addr) += $addend",
3612 [(truncstorei8 (add (sextloadi8 ADDRriU6_0:$addr),
3613 (i32 IntRegs:$addend)), ADDRriU6_0:$addr)]>,
3614 Requires<[HasV4T, UseMEMOP]>;
3616 // memb(Rs+#u6:0) -= Rt
3617 let AddedComplexity = 30 in
3618 def MEMb_SUBr_MEM_V4 : MEMInst_V4<(outs),
3619 (ins MEMri:$addr, IntRegs:$subend),
3620 "memb($addr) -= $subend",
3621 [(truncstorei8 (sub (sextloadi8 ADDRriU6_0:$addr),
3622 (i32 IntRegs:$subend)), ADDRriU6_0:$addr)]>,
3623 Requires<[HasV4T, UseMEMOP]>;
3625 // memb(Rs+#u6:0) &= Rt
3626 let AddedComplexity = 30 in
3627 def MEMb_ANDr_MEM_V4 : MEMInst_V4<(outs),
3628 (ins MEMri:$addr, IntRegs:$andend),
3629 "memb($addr) &= $andend",
3630 [(truncstorei8 (and (sextloadi8 ADDRriU6_0:$addr),
3631 (i32 IntRegs:$andend)), ADDRriU6_0:$addr)]>,
3632 Requires<[HasV4T, UseMEMOP]>;
3634 // memb(Rs+#u6:0) |= Rt
3635 let AddedComplexity = 30 in
3636 def MEMb_ORr_MEM_V4 : MEMInst_V4<(outs),
3637 (ins MEMri:$addr, IntRegs:$orend),
3638 "memb($addr) |= $orend",
3639 [(truncstorei8 (or (sextloadi8 ADDRriU6_0:$addr),
3640 (i32 IntRegs:$orend)), ADDRriU6_0:$addr)]>,
3641 Requires<[HasV4T, UseMEMOP]>;
3644 //===----------------------------------------------------------------------===//
3646 //===----------------------------------------------------------------------===//
3648 // Hexagon V4 only supports these flavors of byte/half compare instructions:
3649 // EQ/GT/GTU. Other flavors like GE/GEU/LT/LTU/LE/LEU are not supported by
3650 // hardware. However, compiler can still implement these patterns through
3651 // appropriate patterns combinations based on current implemented patterns.
3652 // The implemented patterns are: EQ/GT/GTU.
3653 // Missing patterns are: GE/GEU/LT/LTU/LE/LEU.
3655 // Following instruction is not being extended as it results into the
3656 // incorrect code for negative numbers.
3657 // Pd=cmpb.eq(Rs,#u8)
3659 let isCompare = 1 in
3660 def CMPbEQri_V4 : MInst<(outs PredRegs:$dst),
3661 (ins IntRegs:$src1, u8Imm:$src2),
3662 "$dst = cmpb.eq($src1, #$src2)",
3663 [(set (i1 PredRegs:$dst),
3664 (seteq (and (i32 IntRegs:$src1), 255), u8ImmPred:$src2))]>,
3667 // Pd=cmpb.eq(Rs,Rt)
3668 let isCompare = 1, validSubTargets = HasV4SubT in
3669 def CMPbEQrr_ubub_V4 : MInst<(outs PredRegs:$dst),
3670 (ins IntRegs:$src1, IntRegs:$src2),
3671 "$dst = cmpb.eq($src1, $src2)",
3672 [(set (i1 PredRegs:$dst),
3673 (seteq (and (xor (i32 IntRegs:$src1),
3674 (i32 IntRegs:$src2)), 255), 0))]>,
3677 // Pd=cmpb.eq(Rs,Rt)
3678 let isCompare = 1, validSubTargets = HasV4SubT in
3679 def CMPbEQrr_sbsb_V4 : MInst<(outs PredRegs:$dst),
3680 (ins IntRegs:$src1, IntRegs:$src2),
3681 "$dst = cmpb.eq($src1, $src2)",
3682 [(set (i1 PredRegs:$dst),
3683 (seteq (shl (i32 IntRegs:$src1), (i32 24)),
3684 (shl (i32 IntRegs:$src2), (i32 24))))]>,
3687 // Pd=cmpb.gt(Rs,Rt)
3688 let isCompare = 1, validSubTargets = HasV4SubT in
3689 def CMPbGTrr_V4 : MInst<(outs PredRegs:$dst),
3690 (ins IntRegs:$src1, IntRegs:$src2),
3691 "$dst = cmpb.gt($src1, $src2)",
3692 [(set (i1 PredRegs:$dst),
3693 (setgt (shl (i32 IntRegs:$src1), (i32 24)),
3694 (shl (i32 IntRegs:$src2), (i32 24))))]>,
3697 // Pd=cmpb.gtu(Rs,#u7)
3698 let isExtendable = 1, opExtendable = 2, isExtentSigned = 0, opExtentBits = 7,
3699 isCompare = 1, validSubTargets = HasV4SubT, CextOpcode = "CMPbGTU", InputType = "imm" in
3700 def CMPbGTUri_V4 : MInst<(outs PredRegs:$dst),
3701 (ins IntRegs:$src1, u7Ext:$src2),
3702 "$dst = cmpb.gtu($src1, #$src2)",
3703 [(set (i1 PredRegs:$dst), (setugt (and (i32 IntRegs:$src1), 255),
3704 u7ExtPred:$src2))]>,
3705 Requires<[HasV4T]>, ImmRegRel;
3707 // Pd=cmpb.gtu(Rs,Rt)
3708 let isCompare = 1 in
3709 def CMPbGTUrr_V4 : MInst<(outs PredRegs:$dst),
3710 (ins IntRegs:$src1, IntRegs:$src2),
3711 "$dst = cmpb.gtu($src1, $src2)",
3712 [(set (i1 PredRegs:$dst), (setugt (and (i32 IntRegs:$src1), 255),
3713 (and (i32 IntRegs:$src2), 255)))]>,
3716 // Following instruction is not being extended as it results into the incorrect
3717 // code for negative numbers.
3719 // Signed half compare(.eq) ri.
3720 // Pd=cmph.eq(Rs,#s8)
3721 let isCompare = 1 in
3722 def CMPhEQri_V4 : MInst<(outs PredRegs:$dst),
3723 (ins IntRegs:$src1, s8Imm:$src2),
3724 "$dst = cmph.eq($src1, #$src2)",
3725 [(set (i1 PredRegs:$dst), (seteq (and (i32 IntRegs:$src1), 65535),
3726 s8ImmPred:$src2))]>,
3729 // Signed half compare(.eq) rr.
3730 // Case 1: xor + and, then compare:
3732 // r0=and(r0,#0xffff)
3734 // Pd=cmph.eq(Rs,Rt)
3735 let isCompare = 1 in
3736 def CMPhEQrr_xor_V4 : MInst<(outs PredRegs:$dst),
3737 (ins IntRegs:$src1, IntRegs:$src2),
3738 "$dst = cmph.eq($src1, $src2)",
3739 [(set (i1 PredRegs:$dst), (seteq (and (xor (i32 IntRegs:$src1),
3740 (i32 IntRegs:$src2)),
3744 // Signed half compare(.eq) rr.
3745 // Case 2: shift left 16 bits then compare:
3749 // Pd=cmph.eq(Rs,Rt)
3750 let isCompare = 1 in
3751 def CMPhEQrr_shl_V4 : MInst<(outs PredRegs:$dst),
3752 (ins IntRegs:$src1, IntRegs:$src2),
3753 "$dst = cmph.eq($src1, $src2)",
3754 [(set (i1 PredRegs:$dst),
3755 (seteq (shl (i32 IntRegs:$src1), (i32 16)),
3756 (shl (i32 IntRegs:$src2), (i32 16))))]>,
3759 /* Incorrect Pattern -- immediate should be right shifted before being
3760 used in the cmph.gt instruction.
3761 // Signed half compare(.gt) ri.
3762 // Pd=cmph.gt(Rs,#s8)
3764 let isCompare = 1 in
3765 def CMPhGTri_V4 : MInst<(outs PredRegs:$dst),
3766 (ins IntRegs:$src1, s8Imm:$src2),
3767 "$dst = cmph.gt($src1, #$src2)",
3768 [(set (i1 PredRegs:$dst),
3769 (setgt (shl (i32 IntRegs:$src1), (i32 16)),
3770 s8ImmPred:$src2))]>,
3774 // Signed half compare(.gt) rr.
3775 // Pd=cmph.gt(Rs,Rt)
3776 let isCompare = 1 in
3777 def CMPhGTrr_shl_V4 : MInst<(outs PredRegs:$dst),
3778 (ins IntRegs:$src1, IntRegs:$src2),
3779 "$dst = cmph.gt($src1, $src2)",
3780 [(set (i1 PredRegs:$dst),
3781 (setgt (shl (i32 IntRegs:$src1), (i32 16)),
3782 (shl (i32 IntRegs:$src2), (i32 16))))]>,
3785 // Unsigned half compare rr (.gtu).
3786 // Pd=cmph.gtu(Rs,Rt)
3787 let isCompare = 1 in
3788 def CMPhGTUrr_V4 : MInst<(outs PredRegs:$dst),
3789 (ins IntRegs:$src1, IntRegs:$src2),
3790 "$dst = cmph.gtu($src1, $src2)",
3791 [(set (i1 PredRegs:$dst),
3792 (setugt (and (i32 IntRegs:$src1), 65535),
3793 (and (i32 IntRegs:$src2), 65535)))]>,
3796 // Unsigned half compare ri (.gtu).
3797 // Pd=cmph.gtu(Rs,#u7)
3798 let isCompare = 1 in
3799 def CMPhGTUri_V4 : MInst<(outs PredRegs:$dst),
3800 (ins IntRegs:$src1, u7Imm:$src2),
3801 "$dst = cmph.gtu($src1, #$src2)",
3802 [(set (i1 PredRegs:$dst), (setugt (and (i32 IntRegs:$src1), 65535),
3803 u7ImmPred:$src2))]>,
3806 //===----------------------------------------------------------------------===//
3808 //===----------------------------------------------------------------------===//
3810 //Deallocate frame and return.
3812 let isReturn = 1, isTerminator = 1, isBarrier = 1, isPredicable = 1,
3813 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1 in {
3814 def DEALLOC_RET_V4 : NVInst_V4<(outs), (ins i32imm:$amt1),
3820 // Restore registers and dealloc return function call.
3821 let isCall = 1, isBarrier = 1, isReturn = 1, isTerminator = 1,
3822 Defs = [R29, R30, R31, PC] in {
3823 def RESTORE_DEALLOC_RET_JMP_V4 : JInst<(outs),
3824 (ins calltarget:$dst),
3825 "jump $dst // Restore_and_dealloc_return",
3830 // Restore registers and dealloc frame before a tail call.
3831 let isCall = 1, isBarrier = 1,
3832 Defs = [R29, R30, R31, PC] in {
3833 def RESTORE_DEALLOC_BEFORE_TAILCALL_V4 : JInst<(outs),
3834 (ins calltarget:$dst),
3835 "call $dst // Restore_and_dealloc_before_tailcall",
3840 // Save registers function call.
3841 let isCall = 1, isBarrier = 1,
3842 Uses = [R29, R31] in {
3843 def SAVE_REGISTERS_CALL_V4 : JInst<(outs),
3844 (ins calltarget:$dst),
3845 "call $dst // Save_calle_saved_registers",
3850 // if (Ps) dealloc_return
3851 let isReturn = 1, isTerminator = 1,
3852 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
3853 isPredicated = 1 in {
3854 def DEALLOC_RET_cPt_V4 : NVInst_V4<(outs),
3855 (ins PredRegs:$src1, i32imm:$amt1),
3856 "if ($src1) dealloc_return",
3861 // if (!Ps) dealloc_return
3862 let isReturn = 1, isTerminator = 1,
3863 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
3864 isPredicated = 1 in {
3865 def DEALLOC_RET_cNotPt_V4 : NVInst_V4<(outs), (ins PredRegs:$src1,
3867 "if (!$src1) dealloc_return",
3872 // if (Ps.new) dealloc_return:nt
3873 let isReturn = 1, isTerminator = 1,
3874 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
3875 isPredicated = 1 in {
3876 def DEALLOC_RET_cdnPnt_V4 : NVInst_V4<(outs), (ins PredRegs:$src1,
3878 "if ($src1.new) dealloc_return:nt",
3883 // if (!Ps.new) dealloc_return:nt
3884 let isReturn = 1, isTerminator = 1,
3885 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
3886 isPredicated = 1 in {
3887 def DEALLOC_RET_cNotdnPnt_V4 : NVInst_V4<(outs), (ins PredRegs:$src1,
3889 "if (!$src1.new) dealloc_return:nt",
3894 // if (Ps.new) dealloc_return:t
3895 let isReturn = 1, isTerminator = 1,
3896 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
3897 isPredicated = 1 in {
3898 def DEALLOC_RET_cdnPt_V4 : NVInst_V4<(outs), (ins PredRegs:$src1,
3900 "if ($src1.new) dealloc_return:t",
3905 // if (!Ps.new) dealloc_return:nt
3906 let isReturn = 1, isTerminator = 1,
3907 Defs = [R29, R30, R31, PC], Uses = [R29, R31], neverHasSideEffects = 1,
3908 isPredicated = 1 in {
3909 def DEALLOC_RET_cNotdnPt_V4 : NVInst_V4<(outs), (ins PredRegs:$src1,
3911 "if (!$src1.new) dealloc_return:t",
3917 // Load/Store with absolute addressing mode
3920 multiclass ST_abs<string OpcStr> {
3921 let isPredicable = 1 in
3922 def _abs_V4 : STInst2<(outs),
3923 (ins globaladdress:$absaddr, IntRegs:$src),
3924 !strconcat(OpcStr, "(##$absaddr) = $src"),
3928 let isPredicated = 1 in
3929 def _abs_cPt_V4 : STInst2<(outs),
3930 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
3931 !strconcat("if ($src1)",
3932 !strconcat(OpcStr, "(##$absaddr) = $src2")),
3936 let isPredicated = 1 in
3937 def _abs_cNotPt_V4 : STInst2<(outs),
3938 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
3939 !strconcat("if (!$src1)",
3940 !strconcat(OpcStr, "(##$absaddr) = $src2")),
3944 let isPredicated = 1 in
3945 def _abs_cdnPt_V4 : STInst2<(outs),
3946 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
3947 !strconcat("if ($src1.new)",
3948 !strconcat(OpcStr, "(##$absaddr) = $src2")),
3952 let isPredicated = 1 in
3953 def _abs_cdnNotPt_V4 : STInst2<(outs),
3954 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
3955 !strconcat("if (!$src1.new)",
3956 !strconcat(OpcStr, "(##$absaddr) = $src2")),
3960 def _abs_nv_V4 : STInst2<(outs),
3961 (ins globaladdress:$absaddr, IntRegs:$src),
3962 !strconcat(OpcStr, "(##$absaddr) = $src.new"),
3966 let isPredicated = 1 in
3967 def _abs_cPt_nv_V4 : STInst2<(outs),
3968 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
3969 !strconcat("if ($src1)",
3970 !strconcat(OpcStr, "(##$absaddr) = $src2.new")),
3974 let isPredicated = 1 in
3975 def _abs_cNotPt_nv_V4 : STInst2<(outs),
3976 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
3977 !strconcat("if (!$src1)",
3978 !strconcat(OpcStr, "(##$absaddr) = $src2.new")),
3982 let isPredicated = 1 in
3983 def _abs_cdnPt_nv_V4 : STInst2<(outs),
3984 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
3985 !strconcat("if ($src1.new)",
3986 !strconcat(OpcStr, "(##$absaddr) = $src2.new")),
3990 let isPredicated = 1 in
3991 def _abs_cdnNotPt_nv_V4 : STInst2<(outs),
3992 (ins PredRegs:$src1, globaladdress:$absaddr, IntRegs:$src2),
3993 !strconcat("if (!$src1.new)",
3994 !strconcat(OpcStr, "(##$absaddr) = $src2.new")),
3999 let AddedComplexity = 30, isPredicable = 1 in
4000 def STrid_abs_V4 : STInst<(outs),
4001 (ins globaladdress:$absaddr, DoubleRegs:$src),
4002 "memd(##$absaddr) = $src",
4003 [(store (i64 DoubleRegs:$src),
4004 (HexagonCONST32 tglobaladdr:$absaddr))]>,
4007 let AddedComplexity = 30, isPredicated = 1 in
4008 def STrid_abs_cPt_V4 : STInst2<(outs),
4009 (ins PredRegs:$src1, globaladdress:$absaddr, DoubleRegs:$src2),
4010 "if ($src1) memd(##$absaddr) = $src2",
4014 let AddedComplexity = 30, isPredicated = 1 in
4015 def STrid_abs_cNotPt_V4 : STInst2<(outs),
4016 (ins PredRegs:$src1, globaladdress:$absaddr, DoubleRegs:$src2),
4017 "if (!$src1) memd(##$absaddr) = $src2",
4021 let AddedComplexity = 30, isPredicated = 1 in
4022 def STrid_abs_cdnPt_V4 : STInst2<(outs),
4023 (ins PredRegs:$src1, globaladdress:$absaddr, DoubleRegs:$src2),
4024 "if ($src1.new) memd(##$absaddr) = $src2",
4028 let AddedComplexity = 30, isPredicated = 1 in
4029 def STrid_abs_cdnNotPt_V4 : STInst2<(outs),
4030 (ins PredRegs:$src1, globaladdress:$absaddr, DoubleRegs:$src2),
4031 "if (!$src1.new) memd(##$absaddr) = $src2",
4035 defm STrib : ST_abs<"memb">;
4036 defm STrih : ST_abs<"memh">;
4037 defm STriw : ST_abs<"memw">;
4039 let Predicates = [HasV4T], AddedComplexity = 30 in
4040 def : Pat<(truncstorei8 (i32 IntRegs:$src1),
4041 (HexagonCONST32 tglobaladdr:$absaddr)),
4042 (STrib_abs_V4 tglobaladdr: $absaddr, IntRegs: $src1)>;
4044 let Predicates = [HasV4T], AddedComplexity = 30 in
4045 def : Pat<(truncstorei16 (i32 IntRegs:$src1),
4046 (HexagonCONST32 tglobaladdr:$absaddr)),
4047 (STrih_abs_V4 tglobaladdr: $absaddr, IntRegs: $src1)>;
4049 let Predicates = [HasV4T], AddedComplexity = 30 in
4050 def : Pat<(store (i32 IntRegs:$src1), (HexagonCONST32 tglobaladdr:$absaddr)),
4051 (STriw_abs_V4 tglobaladdr: $absaddr, IntRegs: $src1)>;
4054 multiclass LD_abs<string OpcStr> {
4055 let isPredicable = 1 in
4056 def _abs_V4 : LDInst2<(outs IntRegs:$dst),
4057 (ins globaladdress:$absaddr),
4058 !strconcat("$dst = ", !strconcat(OpcStr, "(##$absaddr)")),
4062 let isPredicated = 1 in
4063 def _abs_cPt_V4 : LDInst2<(outs IntRegs:$dst),
4064 (ins PredRegs:$src1, globaladdress:$absaddr),
4065 !strconcat("if ($src1) $dst = ",
4066 !strconcat(OpcStr, "(##$absaddr)")),
4070 let isPredicated = 1 in
4071 def _abs_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
4072 (ins PredRegs:$src1, globaladdress:$absaddr),
4073 !strconcat("if (!$src1) $dst = ",
4074 !strconcat(OpcStr, "(##$absaddr)")),
4078 let isPredicated = 1 in
4079 def _abs_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
4080 (ins PredRegs:$src1, globaladdress:$absaddr),
4081 !strconcat("if ($src1.new) $dst = ",
4082 !strconcat(OpcStr, "(##$absaddr)")),
4086 let isPredicated = 1 in
4087 def _abs_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
4088 (ins PredRegs:$src1, globaladdress:$absaddr),
4089 !strconcat("if (!$src1.new) $dst = ",
4090 !strconcat(OpcStr, "(##$absaddr)")),
4095 let AddedComplexity = 30 in
4096 def LDrid_abs_V4 : LDInst<(outs DoubleRegs:$dst),
4097 (ins globaladdress:$absaddr),
4098 "$dst = memd(##$absaddr)",
4099 [(set (i64 DoubleRegs:$dst),
4100 (load (HexagonCONST32 tglobaladdr:$absaddr)))]>,
4103 let AddedComplexity = 30, isPredicated = 1 in
4104 def LDrid_abs_cPt_V4 : LDInst2<(outs DoubleRegs:$dst),
4105 (ins PredRegs:$src1, globaladdress:$absaddr),
4106 "if ($src1) $dst = memd(##$absaddr)",
4110 let AddedComplexity = 30, isPredicated = 1 in
4111 def LDrid_abs_cNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
4112 (ins PredRegs:$src1, globaladdress:$absaddr),
4113 "if (!$src1) $dst = memd(##$absaddr)",
4117 let AddedComplexity = 30, isPredicated = 1 in
4118 def LDrid_abs_cdnPt_V4 : LDInst2<(outs DoubleRegs:$dst),
4119 (ins PredRegs:$src1, globaladdress:$absaddr),
4120 "if ($src1.new) $dst = memd(##$absaddr)",
4124 let AddedComplexity = 30, isPredicated = 1 in
4125 def LDrid_abs_cdnNotPt_V4 : LDInst2<(outs DoubleRegs:$dst),
4126 (ins PredRegs:$src1, globaladdress:$absaddr),
4127 "if (!$src1.new) $dst = memd(##$absaddr)",
4131 defm LDrib : LD_abs<"memb">;
4132 defm LDriub : LD_abs<"memub">;
4133 defm LDrih : LD_abs<"memh">;
4134 defm LDriuh : LD_abs<"memuh">;
4135 defm LDriw : LD_abs<"memw">;
4138 let Predicates = [HasV4T], AddedComplexity = 30 in
4139 def : Pat<(i32 (load (HexagonCONST32 tglobaladdr:$absaddr))),
4140 (LDriw_abs_V4 tglobaladdr: $absaddr)>;
4142 let Predicates = [HasV4T], AddedComplexity=30 in
4143 def : Pat<(i32 (sextloadi8 (HexagonCONST32 tglobaladdr:$absaddr))),
4144 (LDrib_abs_V4 tglobaladdr:$absaddr)>;
4146 let Predicates = [HasV4T], AddedComplexity=30 in
4147 def : Pat<(i32 (zextloadi8 (HexagonCONST32 tglobaladdr:$absaddr))),
4148 (LDriub_abs_V4 tglobaladdr:$absaddr)>;
4150 let Predicates = [HasV4T], AddedComplexity=30 in
4151 def : Pat<(i32 (sextloadi16 (HexagonCONST32 tglobaladdr:$absaddr))),
4152 (LDrih_abs_V4 tglobaladdr:$absaddr)>;
4154 let Predicates = [HasV4T], AddedComplexity=30 in
4155 def : Pat<(i32 (zextloadi16 (HexagonCONST32 tglobaladdr:$absaddr))),
4156 (LDriuh_abs_V4 tglobaladdr:$absaddr)>;
4158 // Transfer global address into a register
4159 let AddedComplexity=50, isMoveImm = 1, isReMaterializable = 1 in
4160 def TFRI_V4 : ALU32_ri<(outs IntRegs:$dst), (ins globaladdress:$src1),
4162 [(set IntRegs:$dst, (HexagonCONST32 tglobaladdr:$src1))]>,
4165 let AddedComplexity=50, neverHasSideEffects = 1, isPredicated = 1 in
4166 def TFRI_cPt_V4 : ALU32_ri<(outs IntRegs:$dst),
4167 (ins PredRegs:$src1, globaladdress:$src2),
4168 "if($src1) $dst = ##$src2",
4172 let AddedComplexity=50, neverHasSideEffects = 1, isPredicated = 1 in
4173 def TFRI_cNotPt_V4 : ALU32_ri<(outs IntRegs:$dst),
4174 (ins PredRegs:$src1, globaladdress:$src2),
4175 "if(!$src1) $dst = ##$src2",
4179 let AddedComplexity=50, neverHasSideEffects = 1, isPredicated = 1 in
4180 def TFRI_cdnPt_V4 : ALU32_ri<(outs IntRegs:$dst),
4181 (ins PredRegs:$src1, globaladdress:$src2),
4182 "if($src1.new) $dst = ##$src2",
4186 let AddedComplexity=50, neverHasSideEffects = 1, isPredicated = 1 in
4187 def TFRI_cdnNotPt_V4 : ALU32_ri<(outs IntRegs:$dst),
4188 (ins PredRegs:$src1, globaladdress:$src2),
4189 "if(!$src1.new) $dst = ##$src2",
4193 let AddedComplexity = 50, Predicates = [HasV4T] in
4194 def : Pat<(HexagonCONST32_GP tglobaladdr:$src1),
4195 (TFRI_V4 tglobaladdr:$src1)>;
4198 // Load - Indirect with long offset: These instructions take global address
4200 let AddedComplexity = 10 in
4201 def LDrid_ind_lo_V4 : LDInst<(outs DoubleRegs:$dst),
4202 (ins IntRegs:$src1, u2Imm:$src2, globaladdress:$offset),
4203 "$dst=memd($src1<<#$src2+##$offset)",
4204 [(set (i64 DoubleRegs:$dst),
4205 (load (add (shl IntRegs:$src1, u2ImmPred:$src2),
4206 (HexagonCONST32 tglobaladdr:$offset))))]>,
4209 let AddedComplexity = 10 in
4210 multiclass LD_indirect_lo<string OpcStr, PatFrag OpNode> {
4211 def _lo_V4 : LDInst<(outs IntRegs:$dst),
4212 (ins IntRegs:$src1, u2Imm:$src2, globaladdress:$offset),
4213 !strconcat("$dst = ",
4214 !strconcat(OpcStr, "($src1<<#$src2+##$offset)")),
4216 (i32 (OpNode (add (shl IntRegs:$src1, u2ImmPred:$src2),
4217 (HexagonCONST32 tglobaladdr:$offset)))))]>,
4221 defm LDrib_ind : LD_indirect_lo<"memb", sextloadi8>;
4222 defm LDriub_ind : LD_indirect_lo<"memub", zextloadi8>;
4223 defm LDrih_ind : LD_indirect_lo<"memh", sextloadi16>;
4224 defm LDriuh_ind : LD_indirect_lo<"memuh", zextloadi16>;
4225 defm LDriw_ind : LD_indirect_lo<"memw", load>;
4227 // Store - Indirect with long offset: These instructions take global address
4229 let AddedComplexity = 10 in
4230 def STrid_ind_lo_V4 : STInst<(outs),
4231 (ins IntRegs:$src1, u2Imm:$src2, globaladdress:$src3,
4233 "memd($src1<<#$src2+#$src3) = $src4",
4234 [(store (i64 DoubleRegs:$src4),
4235 (add (shl IntRegs:$src1, u2ImmPred:$src2),
4236 (HexagonCONST32 tglobaladdr:$src3)))]>,
4239 let AddedComplexity = 10 in
4240 multiclass ST_indirect_lo<string OpcStr, PatFrag OpNode> {
4241 def _lo_V4 : STInst<(outs),
4242 (ins IntRegs:$src1, u2Imm:$src2, globaladdress:$src3,
4244 !strconcat(OpcStr, "($src1<<#$src2+##$src3) = $src4"),
4245 [(OpNode (i32 IntRegs:$src4),
4246 (add (shl IntRegs:$src1, u2ImmPred:$src2),
4247 (HexagonCONST32 tglobaladdr:$src3)))]>,
4251 defm STrib_ind : ST_indirect_lo<"memb", truncstorei8>;
4252 defm STrih_ind : ST_indirect_lo<"memh", truncstorei16>;
4253 defm STriw_ind : ST_indirect_lo<"memw", store>;
4255 // Store - absolute addressing mode: These instruction take constant
4256 // value as the extended operand.
4257 multiclass ST_absimm<string OpcStr> {
4258 let isExtended = 1, opExtendable = 0, isPredicable = 1,
4259 validSubTargets = HasV4SubT in
4260 def _abs_V4 : STInst2<(outs),
4261 (ins u0AlwaysExt:$src1, IntRegs:$src2),
4262 !strconcat(OpcStr, "(##$src1) = $src2"),
4266 let isExtended = 1, opExtendable = 1, isPredicated = 1,
4267 validSubTargets = HasV4SubT in {
4268 def _abs_cPt_V4 : STInst2<(outs),
4269 (ins PredRegs:$src1, u0AlwaysExt:$src2, IntRegs:$src3),
4270 !strconcat("if ($src1)", !strconcat(OpcStr, "(##$src2) = $src3")),
4274 def _abs_cNotPt_V4 : STInst2<(outs),
4275 (ins PredRegs:$src1, u0AlwaysExt:$src2, IntRegs:$src3),
4276 !strconcat("if (!$src1)", !strconcat(OpcStr, "(##$src2) = $src3")),
4280 def _abs_cdnPt_V4 : STInst2<(outs),
4281 (ins PredRegs:$src1, u0AlwaysExt:$src2, IntRegs:$src3),
4282 !strconcat("if ($src1.new)",
4283 !strconcat(OpcStr, "(##$src2) = $src3")),
4287 def _abs_cdnNotPt_V4 : STInst2<(outs),
4288 (ins PredRegs:$src1, u0AlwaysExt:$src2, IntRegs:$src3),
4289 !strconcat("if (!$src1.new)",
4290 !strconcat(OpcStr, "(##$src2) = $src3")),
4295 let isExtended = 1, opExtendable = 0, mayStore = 1, isNVStore = 1,
4296 validSubTargets = HasV4SubT in
4297 def _abs_nv_V4 : NVInst_V4<(outs),
4298 (ins u0AlwaysExt:$src1, IntRegs:$src2),
4299 !strconcat(OpcStr, "(##$src1) = $src2.new"),
4303 let isExtended = 1, opExtendable = 1, mayStore = 1, isPredicated = 1,
4304 isNVStore = 1, validSubTargets = HasV4SubT in {
4305 def _abs_cPt_nv_V4 : NVInst_V4<(outs),
4306 (ins PredRegs:$src1, u0AlwaysExt:$src2, IntRegs:$src3),
4307 !strconcat("if ($src1)",
4308 !strconcat(OpcStr, "(##$src2) = $src3.new")),
4312 def _abs_cNotPt_nv_V4 : NVInst_V4<(outs),
4313 (ins PredRegs:$src1, u0AlwaysExt:$src2, IntRegs:$src3),
4314 !strconcat("if (!$src1)",
4315 !strconcat(OpcStr, "(##$src2) = $src3.new")),
4319 def _abs_cdnPt_nv_V4 : NVInst_V4<(outs),
4320 (ins PredRegs:$src1, u0AlwaysExt:$src2, IntRegs:$src3),
4321 !strconcat("if ($src1.new)",
4322 !strconcat(OpcStr, "(##$src2) = $src3.new")),
4326 def _abs_cdnNotPt_nv_V4 : NVInst_V4<(outs),
4327 (ins PredRegs:$src1, u0AlwaysExt:$src2, IntRegs:$src3),
4328 !strconcat("if (!$src1.new)",
4329 !strconcat(OpcStr, "(##$src2) = $src3.new")),
4335 defm STrib_imm : ST_absimm<"memb">;
4336 defm STrih_imm : ST_absimm<"memh">;
4337 defm STriw_imm : ST_absimm<"memw">;
4339 let Predicates = [HasV4T], AddedComplexity = 30 in {
4340 def : Pat<(truncstorei8 (i32 IntRegs:$src1), u0AlwaysExtPred:$src2),
4341 (STrib_imm_abs_V4 u0AlwaysExtPred:$src2, IntRegs: $src1)>;
4343 def : Pat<(truncstorei16 (i32 IntRegs:$src1), u0AlwaysExtPred:$src2),
4344 (STrih_imm_abs_V4 u0AlwaysExtPred:$src2, IntRegs: $src1)>;
4346 def : Pat<(store (i32 IntRegs:$src1), u0AlwaysExtPred:$src2),
4347 (STriw_imm_abs_V4 u0AlwaysExtPred:$src2, IntRegs: $src1)>;
4350 // Load - absolute addressing mode: These instruction take constant
4351 // value as the extended operand
4353 multiclass LD_absimm<string OpcStr> {
4354 let isExtended = 1, opExtendable = 1, isPredicable = 1,
4355 validSubTargets = HasV4SubT in
4356 def _abs_V4 : LDInst2<(outs IntRegs:$dst),
4357 (ins u0AlwaysExt:$src),
4358 !strconcat("$dst = ",
4359 !strconcat(OpcStr, "(##$src)")),
4363 let isExtended = 1, opExtendable = 2, isPredicated = 1,
4364 validSubTargets = HasV4SubT in {
4365 def _abs_cPt_V4 : LDInst2<(outs IntRegs:$dst),
4366 (ins PredRegs:$src1, u0AlwaysExt:$src2),
4367 !strconcat("if ($src1) $dst = ",
4368 !strconcat(OpcStr, "(##$src2)")),
4372 def _abs_cNotPt_V4 : LDInst2<(outs IntRegs:$dst),
4373 (ins PredRegs:$src1, u0AlwaysExt:$src2),
4374 !strconcat("if (!$src1) $dst = ",
4375 !strconcat(OpcStr, "(##$src2)")),
4379 def _abs_cdnPt_V4 : LDInst2<(outs IntRegs:$dst),
4380 (ins PredRegs:$src1, u0AlwaysExt:$src2),
4381 !strconcat("if ($src1.new) $dst = ",
4382 !strconcat(OpcStr, "(##$src2)")),
4386 def _abs_cdnNotPt_V4 : LDInst2<(outs IntRegs:$dst),
4387 (ins PredRegs:$src1, u0AlwaysExt:$src2),
4388 !strconcat("if (!$src1.new) $dst = ",
4389 !strconcat(OpcStr, "(##$src2)")),
4395 defm LDrib_imm : LD_absimm<"memb">;
4396 defm LDriub_imm : LD_absimm<"memub">;
4397 defm LDrih_imm : LD_absimm<"memh">;
4398 defm LDriuh_imm : LD_absimm<"memuh">;
4399 defm LDriw_imm : LD_absimm<"memw">;
4401 let Predicates = [HasV4T], AddedComplexity = 30 in {
4402 def : Pat<(i32 (load u0AlwaysExtPred:$src)),
4403 (LDriw_imm_abs_V4 u0AlwaysExtPred:$src)>;
4405 def : Pat<(i32 (sextloadi8 u0AlwaysExtPred:$src)),
4406 (LDrib_imm_abs_V4 u0AlwaysExtPred:$src)>;
4408 def : Pat<(i32 (zextloadi8 u0AlwaysExtPred:$src)),
4409 (LDriub_imm_abs_V4 u0AlwaysExtPred:$src)>;
4411 def : Pat<(i32 (sextloadi16 u0AlwaysExtPred:$src)),
4412 (LDrih_imm_abs_V4 u0AlwaysExtPred:$src)>;
4414 def : Pat<(i32 (zextloadi16 u0AlwaysExtPred:$src)),
4415 (LDriuh_imm_abs_V4 u0AlwaysExtPred:$src)>;
4418 // Indexed store double word - global address.
4419 // memw(Rs+#u6:2)=#S8
4420 let AddedComplexity = 10 in
4421 def STriw_offset_ext_V4 : STInst<(outs),
4422 (ins IntRegs:$src1, u6_2Imm:$src2, globaladdress:$src3),
4423 "memw($src1+#$src2) = ##$src3",
4424 [(store (HexagonCONST32 tglobaladdr:$src3),
4425 (add IntRegs:$src1, u6_2ImmPred:$src2))]>,
4429 // Indexed store double word - global address.
4430 // memw(Rs+#u6:2)=#S8
4431 let AddedComplexity = 10 in
4432 def STrih_offset_ext_V4 : STInst<(outs),
4433 (ins IntRegs:$src1, u6_1Imm:$src2, globaladdress:$src3),
4434 "memh($src1+#$src2) = ##$src3",
4435 [(truncstorei16 (HexagonCONST32 tglobaladdr:$src3),
4436 (add IntRegs:$src1, u6_1ImmPred:$src2))]>,