OLD | NEW |
1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===// | 1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===// |
2 // | 2 // |
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
4 // for details. All rights reserved. Use of this source code is governed by a | 4 // for details. All rights reserved. Use of this source code is governed by a |
5 // BSD-style license that can be found in the LICENSE file. | 5 // BSD-style license that can be found in the LICENSE file. |
6 // | 6 // |
7 // Modified by the Subzero authors. | 7 // Modified by the Subzero authors. |
8 // | 8 // |
9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
10 // | 10 // |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // Unable to decode, value left undefined. | 166 // Unable to decode, value left undefined. |
167 CantDecode = 0, | 167 CantDecode = 0, |
168 // Value is register found. | 168 // Value is register found. |
169 DecodedAsRegister, | 169 DecodedAsRegister, |
170 // Value=rrrriiiiiiii where rrrr is the rotation, and iiiiiiii is the imm8 | 170 // Value=rrrriiiiiiii where rrrr is the rotation, and iiiiiiii is the imm8 |
171 // value. | 171 // value. |
172 DecodedAsRotatedImm8, | 172 DecodedAsRotatedImm8, |
173 // i.e. 0000000pu0w0nnnn0000iiiiiiiiiiii where nnnn is the base register Rn, | 173 // i.e. 0000000pu0w0nnnn0000iiiiiiiiiiii where nnnn is the base register Rn, |
174 // p=1 if pre-indexed addressing, u=1 if offset positive, w=1 if writeback to | 174 // p=1 if pre-indexed addressing, u=1 if offset positive, w=1 if writeback to |
175 // Rn should be used, and iiiiiiiiiiii is the offset. | 175 // Rn should be used, and iiiiiiiiiiii is the offset. |
176 DecodedAsImmRegOffset | 176 DecodedAsImmRegOffset, |
| 177 // Value is 32bit integer constant. |
| 178 DecodedAsConstI32 |
177 }; | 179 }; |
178 | 180 |
| 181 // Sets Encoding to a rotated Imm8 encoding of Value, if possible. |
| 182 inline IValueT encodeRotatedImm8(IValueT RotateAmt, IValueT Immed8) { |
| 183 assert(RotateAmt < (1 << kRotateBits)); |
| 184 assert(Immed8 < (1 << kImmed8Bits)); |
| 185 return (RotateAmt << kRotateShift) | (Immed8 << kImmed8Shift); |
| 186 } |
| 187 |
179 // Encodes iiiiitt0mmmm for data-processing (2nd) operands where iiiii=Imm5, | 188 // Encodes iiiiitt0mmmm for data-processing (2nd) operands where iiiii=Imm5, |
180 // tt=Shift, and mmmm=Rm. | 189 // tt=Shift, and mmmm=Rm. |
181 IValueT encodeShiftRotateImm5(IValueT Rm, OperandARM32::ShiftKind Shift, | 190 IValueT encodeShiftRotateImm5(IValueT Rm, OperandARM32::ShiftKind Shift, |
182 IOffsetT imm5) { | 191 IOffsetT imm5) { |
183 (void)kShiftImmBits; | 192 (void)kShiftImmBits; |
184 assert(imm5 < (1 << kShiftImmBits)); | 193 assert(imm5 < (1 << kShiftImmBits)); |
185 return (imm5 << kShiftImmShift) | (encodeShift(Shift) << kShiftShift) | Rm; | 194 return (imm5 << kShiftImmShift) | (encodeShift(Shift) << kShiftShift) | Rm; |
186 } | 195 } |
187 | 196 |
188 DecodedResult decodeOperand(const Operand *Opnd, IValueT &Value) { | 197 DecodedResult decodeOperand(const Operand *Opnd, IValueT &Value) { |
189 if (const auto *Var = llvm::dyn_cast<Variable>(Opnd)) { | 198 if (const auto *Var = llvm::dyn_cast<Variable>(Opnd)) { |
190 if (Var->hasReg()) { | 199 if (Var->hasReg()) { |
191 Value = Var->getRegNum(); | 200 Value = Var->getRegNum(); |
192 return DecodedAsRegister; | 201 return DecodedAsRegister; |
193 } | 202 } |
194 } else if (const auto *FlexImm = llvm::dyn_cast<OperandARM32FlexImm>(Opnd)) { | 203 } else if (const auto *FlexImm = llvm::dyn_cast<OperandARM32FlexImm>(Opnd)) { |
195 const IValueT Immed8 = FlexImm->getImm(); | 204 const IValueT Immed8 = FlexImm->getImm(); |
196 const IValueT Rotate = FlexImm->getRotateAmt(); | 205 const IValueT Rotate = FlexImm->getRotateAmt(); |
197 if (!((Rotate < (1 << kRotateBits)) && (Immed8 < (1 << kImmed8Bits)))) | 206 if (!((Rotate < (1 << kRotateBits)) && (Immed8 < (1 << kImmed8Bits)))) |
198 return CantDecode; | 207 return CantDecode; |
199 Value = (Rotate << kRotateShift) | (Immed8 << kImmed8Shift); | 208 Value = (Rotate << kRotateShift) | (Immed8 << kImmed8Shift); |
200 return DecodedAsRotatedImm8; | 209 return DecodedAsRotatedImm8; |
201 } | 210 } |
| 211 if (const auto *Const = llvm::dyn_cast<ConstantInteger32>(Opnd)) { |
| 212 Value = Const->getValue(); |
| 213 return DecodedAsConstI32; |
| 214 } |
202 return CantDecode; | 215 return CantDecode; |
203 } | 216 } |
204 | 217 |
205 IValueT decodeImmRegOffset(RegARM32::GPRRegister Reg, IOffsetT Offset, | 218 IValueT decodeImmRegOffset(RegARM32::GPRRegister Reg, IOffsetT Offset, |
206 OperandARM32Mem::AddrMode Mode) { | 219 OperandARM32Mem::AddrMode Mode) { |
207 IValueT Value = Mode | (encodeGPRRegister(Reg) << kRnShift); | 220 IValueT Value = Mode | (encodeGPRRegister(Reg) << kRnShift); |
208 if (Offset < 0) { | 221 if (Offset < 0) { |
209 Value = (Value ^ U) | -Offset; // Flip U to adjust sign. | 222 Value = (Value ^ U) | -Offset; // Flip U to adjust sign. |
210 } else { | 223 } else { |
211 Value |= Offset; | 224 Value |= Offset; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 return setNeedsTextFixup(); | 405 return setNeedsTextFixup(); |
393 emitType01(Cond, kInstTypeDataRegister, Opcode, SetFlags, Rn, Rd, | 406 emitType01(Cond, kInstTypeDataRegister, Opcode, SetFlags, Rn, Rd, |
394 Src1Value); | 407 Src1Value); |
395 return; | 408 return; |
396 } | 409 } |
397 case DecodedAsRotatedImm8: { | 410 case DecodedAsRotatedImm8: { |
398 // XXX (Immediate) | 411 // XXX (Immediate) |
399 // xxx{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 412 // xxx{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
400 // | 413 // |
401 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 414 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
402 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 415 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
403 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) | 416 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) |
404 // Conditions of rule violated. | 417 // Conditions of rule violated. |
405 return setNeedsTextFixup(); | 418 return setNeedsTextFixup(); |
406 emitType01(Cond, kInstTypeDataImmediate, Opcode, SetFlags, Rn, Rd, | 419 emitType01(Cond, kInstTypeDataImmediate, Opcode, SetFlags, Rn, Rd, |
407 Src1Value); | 420 Src1Value); |
408 return; | 421 return; |
409 } | 422 } |
410 } | 423 } |
411 } | 424 } |
412 | 425 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 // ADC (register) - ARM section 18.8.2, encoding A1: | 496 // ADC (register) - ARM section 18.8.2, encoding A1: |
484 // adc{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} | 497 // adc{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} |
485 // | 498 // |
486 // cccc0000101snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 499 // cccc0000101snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
487 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. | 500 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. |
488 // | 501 // |
489 // ADC (Immediate) - ARM section A8.8.1, encoding A1: | 502 // ADC (Immediate) - ARM section A8.8.1, encoding A1: |
490 // adc{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 503 // adc{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
491 // | 504 // |
492 // cccc0010101snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 505 // cccc0010101snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
493 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 506 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
494 constexpr IValueT Adc = B2 | B0; // 0101 | 507 constexpr IValueT Adc = B2 | B0; // 0101 |
495 emitType01(Adc, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 508 emitType01(Adc, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
496 } | 509 } |
497 | 510 |
498 void AssemblerARM32::add(const Operand *OpRd, const Operand *OpRn, | 511 void AssemblerARM32::add(const Operand *OpRd, const Operand *OpRn, |
499 const Operand *OpSrc1, bool SetFlags, | 512 const Operand *OpSrc1, bool SetFlags, |
500 CondARM32::Cond Cond) { | 513 CondARM32::Cond Cond) { |
501 // ADD (register) - ARM section A8.8.7, encoding A1: | 514 // ADD (register) - ARM section A8.8.7, encoding A1: |
502 // add{s}<c> <Rd>, <Rn>, <Rm>{, <shiff>} | 515 // add{s}<c> <Rd>, <Rn>, <Rm>{, <shiff>} |
503 // ADD (Sp plus register) - ARM section A8.8.11, encoding A1: | 516 // ADD (Sp plus register) - ARM section A8.8.11, encoding A1: |
504 // add{s}<c> sp, <Rn>, <Rm>{, <shiff>} | 517 // add{s}<c> sp, <Rn>, <Rm>{, <shiff>} |
505 // | 518 // |
506 // cccc0000100snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 519 // cccc0000100snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
507 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. | 520 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. |
508 // | 521 // |
509 // ADD (Immediate) - ARM section A8.8.5, encoding A1: | 522 // ADD (Immediate) - ARM section A8.8.5, encoding A1: |
510 // add{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 523 // add{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
511 // ADD (SP plus immediate) - ARM section A8.8.9, encoding A1. | 524 // ADD (SP plus immediate) - ARM section A8.8.9, encoding A1. |
512 // add{s}<c> <Rd>, sp, #<RotatedImm8> | 525 // add{s}<c> <Rd>, sp, #<RotatedImm8> |
513 // | 526 // |
514 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 527 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
515 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 528 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
516 constexpr IValueT Add = B2; // 0100 | 529 constexpr IValueT Add = B2; // 0100 |
517 emitType01(Add, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 530 emitType01(Add, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
518 } | 531 } |
519 | 532 |
520 void AssemblerARM32::and_(const Operand *OpRd, const Operand *OpRn, | 533 void AssemblerARM32::and_(const Operand *OpRd, const Operand *OpRn, |
521 const Operand *OpSrc1, bool SetFlags, | 534 const Operand *OpSrc1, bool SetFlags, |
522 CondARM32::Cond Cond) { | 535 CondARM32::Cond Cond) { |
523 // AND (register) - ARM section A8.8.14, encoding A1: | 536 // AND (register) - ARM section A8.8.14, encoding A1: |
524 // and{s}<c> <Rd>, <Rn>{, <shift>} | 537 // and{s}<c> <Rd>, <Rn>{, <shift>} |
525 // | 538 // |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 // cccc000100101111111111110001mmmm where mmmm=rm and cccc=Cond. | 570 // cccc000100101111111111110001mmmm where mmmm=rm and cccc=Cond. |
558 if (!(isGPRRegisterDefined(Rm) && isConditionDefined(Cond))) | 571 if (!(isGPRRegisterDefined(Rm) && isConditionDefined(Cond))) |
559 return setNeedsTextFixup(); | 572 return setNeedsTextFixup(); |
560 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 573 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
561 const IValueT Encoding = (encodeCondition(Cond) << kConditionShift) | B24 | | 574 const IValueT Encoding = (encodeCondition(Cond) << kConditionShift) | B24 | |
562 B21 | (0xfff << 8) | B4 | | 575 B21 | (0xfff << 8) | B4 | |
563 (encodeGPRRegister(Rm) << kRmShift); | 576 (encodeGPRRegister(Rm) << kRmShift); |
564 emitInst(Encoding); | 577 emitInst(Encoding); |
565 } | 578 } |
566 | 579 |
| 580 void AssemblerARM32::cmp(const Operand *OpRn, const Operand *OpSrc1, |
| 581 CondARM32::Cond Cond) { |
| 582 IValueT Rn; |
| 583 if (decodeOperand(OpRn, Rn) != DecodedAsRegister) |
| 584 return setNeedsTextFixup(); |
| 585 constexpr IValueT Cmp = B3 | B1; // ie. 1010 |
| 586 constexpr bool SetFlags = true; |
| 587 constexpr IValueT Rd = RegARM32::Encoded_Reg_r0; |
| 588 IValueT Src1Value; |
| 589 // TODO(kschimpf) Other possible decodings of cmp. |
| 590 switch (decodeOperand(OpSrc1, Src1Value)) { |
| 591 default: |
| 592 return setNeedsTextFixup(); |
| 593 case DecodedAsRegister: { |
| 594 // CMP (register) - ARM section A8.8.38, encoding A1: |
| 595 // cmp<c> <Rn>, <Rm>{, <shift>} |
| 596 // |
| 597 // cccc00010101nnnn0000iiiiitt0mmmm where cccc=Cond, nnnn=Rn, mmmm=Rm, |
| 598 // iiiii=Shift, and tt=ShiftKind. |
| 599 constexpr IValueT Imm5 = 0; |
| 600 Src1Value = encodeShiftRotateImm5(Src1Value, OperandARM32::kNoShift, Imm5); |
| 601 emitType01(Cond, kInstTypeDataRegister, Cmp, SetFlags, Rn, Rd, Src1Value); |
| 602 return; |
| 603 } |
| 604 case DecodedAsConstI32: { |
| 605 // See if we can convert this to an CMP (immediate). |
| 606 IValueT RotateAmt; |
| 607 IValueT Imm8; |
| 608 if (!OperandARM32FlexImm::canHoldImm(Src1Value, &RotateAmt, &Imm8)) |
| 609 return setNeedsTextFixup(); |
| 610 Src1Value = encodeRotatedImm8(RotateAmt, Imm8); |
| 611 // Intentionally fall to next case! |
| 612 } |
| 613 case DecodedAsRotatedImm8: { |
| 614 // CMP (immediate) - ARM section A8.8.37 |
| 615 // cmp<c: <Rn>, #<RotatedImm8> |
| 616 // |
| 617 // cccc00110101nnnn0000iiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 618 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
| 619 emitType01(Cond, kInstTypeDataImmediate, Cmp, SetFlags, Rn, Rd, Src1Value); |
| 620 return; |
| 621 } |
| 622 } |
| 623 setNeedsTextFixup(); |
| 624 } |
| 625 |
567 void AssemblerARM32::eor(const Operand *OpRd, const Operand *OpRn, | 626 void AssemblerARM32::eor(const Operand *OpRd, const Operand *OpRn, |
568 const Operand *OpSrc1, bool SetFlags, | 627 const Operand *OpSrc1, bool SetFlags, |
569 CondARM32::Cond Cond) { | 628 CondARM32::Cond Cond) { |
570 // EOR (register) - ARM section A*.8.47, encoding A1: | 629 // EOR (register) - ARM section A*.8.47, encoding A1: |
571 // eor{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} | 630 // eor{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} |
572 // | 631 // |
573 // cccc0000001snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 632 // cccc0000001snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
574 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. | 633 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. |
575 // | 634 // |
576 // EOR (Immediate) - ARM section A8.*.46, encoding A1: | 635 // EOR (Immediate) - ARM section A8.*.46, encoding A1: |
577 // eor{s}<c> <Rd>, <Rn>, #RotatedImm8 | 636 // eor{s}<c> <Rd>, <Rn>, #RotatedImm8 |
578 // | 637 // |
579 // cccc0010001snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 638 // cccc0010001snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
580 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 639 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
581 constexpr IValueT Eor = B0; // 0001 | 640 constexpr IValueT Eor = B0; // 0001 |
582 emitType01(Eor, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 641 emitType01(Eor, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
583 } | 642 } |
584 | 643 |
585 void AssemblerARM32::ldr(const Operand *OpRt, const Operand *OpAddress, | 644 void AssemblerARM32::ldr(const Operand *OpRt, const Operand *OpAddress, |
586 CondARM32::Cond Cond) { | 645 CondARM32::Cond Cond) { |
587 IValueT Rt; | 646 IValueT Rt; |
588 if (decodeOperand(OpRt, Rt) != DecodedAsRegister) | 647 if (decodeOperand(OpRt, Rt) != DecodedAsRegister) |
589 return setNeedsTextFixup(); | 648 return setNeedsTextFixup(); |
590 IValueT Address; | 649 IValueT Address; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) | 683 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) |
625 return setNeedsTextFixup(); | 684 return setNeedsTextFixup(); |
626 IValueT Src; | 685 IValueT Src; |
627 // TODO(kschimpf) Handle other forms of mov. | 686 // TODO(kschimpf) Handle other forms of mov. |
628 if (decodeOperand(OpSrc, Src) != DecodedAsRotatedImm8) | 687 if (decodeOperand(OpSrc, Src) != DecodedAsRotatedImm8) |
629 return setNeedsTextFixup(); | 688 return setNeedsTextFixup(); |
630 // MOV (immediate) - ARM section A8.8.102, encoding A1: | 689 // MOV (immediate) - ARM section A8.8.102, encoding A1: |
631 // mov{S}<c> <Rd>, #<RotatedImm8> | 690 // mov{S}<c> <Rd>, #<RotatedImm8> |
632 // | 691 // |
633 // cccc0011101s0000ddddiiiiiiiiiiii where cccc=Cond, s=SetFlags, dddd=Rd, and | 692 // cccc0011101s0000ddddiiiiiiiiiiii where cccc=Cond, s=SetFlags, dddd=Rd, and |
634 // iiiiiiiiiiii=RotatedImm8=Src. Note: We don't use movs in this assembler. | 693 // iiiiiiiiiiii=Src defining RotatedImm8. Note: We don't use movs in this |
| 694 // assembler. |
635 constexpr bool SetFlags = false; | 695 constexpr bool SetFlags = false; |
636 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) | 696 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) |
637 // Conditions of rule violated. | 697 // Conditions of rule violated. |
638 return setNeedsTextFixup(); | 698 return setNeedsTextFixup(); |
639 constexpr IValueT Rn = 0; | 699 constexpr IValueT Rn = 0; |
640 constexpr IValueT Mov = B3 | B2 | B0; // 1101. | 700 constexpr IValueT Mov = B3 | B2 | B0; // 1101. |
641 emitType01(Cond, kInstTypeDataImmediate, Mov, SetFlags, Rn, Rd, Src); | 701 emitType01(Cond, kInstTypeDataImmediate, Mov, SetFlags, Rn, Rd, Src); |
642 } | 702 } |
643 | 703 |
644 void AssemblerARM32::movw(const Operand *OpRd, const Operand *OpSrc, | 704 void AssemblerARM32::movw(const Operand *OpRd, const Operand *OpSrc, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 // SBC (register) - ARM section 18.8.162, encoding A1: | 763 // SBC (register) - ARM section 18.8.162, encoding A1: |
704 // sbc{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} | 764 // sbc{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} |
705 // | 765 // |
706 // cccc0000110snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 766 // cccc0000110snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
707 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. | 767 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. |
708 // | 768 // |
709 // SBC (Immediate) - ARM section A8.8.161, encoding A1: | 769 // SBC (Immediate) - ARM section A8.8.161, encoding A1: |
710 // sbc{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 770 // sbc{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
711 // | 771 // |
712 // cccc0010110snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 772 // cccc0010110snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
713 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 773 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
714 constexpr IValueT Sbc = B2 | B1; // 0110 | 774 constexpr IValueT Sbc = B2 | B1; // 0110 |
715 emitType01(Sbc, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 775 emitType01(Sbc, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
716 } | 776 } |
717 | 777 |
718 void AssemblerARM32::sdiv(const Operand *OpRd, const Operand *OpRn, | 778 void AssemblerARM32::sdiv(const Operand *OpRd, const Operand *OpRn, |
719 const Operand *OpSrc1, CondARM32::Cond Cond) { | 779 const Operand *OpSrc1, CondARM32::Cond Cond) { |
720 // SDIV - ARM section A8.8.165, encoding A1. | 780 // SDIV - ARM section A8.8.165, encoding A1. |
721 // sdiv<c> <Rd>, <Rn>, <Rm> | 781 // sdiv<c> <Rd>, <Rn>, <Rm> |
722 // | 782 // |
723 // cccc01110001dddd1111mmmm0001nnnn where cccc=Cond, dddd=Rd, nnnn=Rn, and | 783 // cccc01110001dddd1111mmmm0001nnnn where cccc=Cond, dddd=Rd, nnnn=Rn, and |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 // | 938 // |
879 // cccc0000010snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 939 // cccc0000010snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
880 // mmmm=Rm, iiiiii=shift, tt=ShiftKind, and s=SetFlags. | 940 // mmmm=Rm, iiiiii=shift, tt=ShiftKind, and s=SetFlags. |
881 // | 941 // |
882 // Sub (Immediate) - ARM section A8.8.222, encoding A1: | 942 // Sub (Immediate) - ARM section A8.8.222, encoding A1: |
883 // sub{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 943 // sub{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
884 // Sub (Sp minus immediate) - ARM section A8.*.225, encoding A1: | 944 // Sub (Sp minus immediate) - ARM section A8.*.225, encoding A1: |
885 // sub{s}<c> sp, <Rn>, #<RotatedImm8> | 945 // sub{s}<c> sp, <Rn>, #<RotatedImm8> |
886 // | 946 // |
887 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 947 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
888 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8 | 948 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8 |
889 constexpr IValueT Sub = B1; // 0010 | 949 constexpr IValueT Sub = B1; // 0010 |
890 emitType01(Sub, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 950 emitType01(Sub, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
891 } | 951 } |
892 | 952 |
893 } // end of namespace ARM32 | 953 } // end of namespace ARM32 |
894 } // end of namespace Ice | 954 } // end of namespace Ice |
OLD | NEW |