Chromium Code Reviews| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 // Unable to decode, value left undefined. | 155 // Unable to decode, value left undefined. |
| 156 CantDecode = 0, | 156 CantDecode = 0, |
| 157 // Value is register found. | 157 // Value is register found. |
| 158 DecodedAsRegister, | 158 DecodedAsRegister, |
| 159 // Value=rrrriiiiiiii where rrrr is the rotation, and iiiiiiii is the imm8 | 159 // Value=rrrriiiiiiii where rrrr is the rotation, and iiiiiiii is the imm8 |
| 160 // value. | 160 // value. |
| 161 DecodedAsRotatedImm8, | 161 DecodedAsRotatedImm8, |
| 162 // i.e. 0000000pu0w0nnnn0000iiiiiiiiiiii where nnnn is the base register Rn, | 162 // i.e. 0000000pu0w0nnnn0000iiiiiiiiiiii where nnnn is the base register Rn, |
| 163 // p=1 if pre-indexed addressing, u=1 if offset positive, w=1 if writeback to | 163 // p=1 if pre-indexed addressing, u=1 if offset positive, w=1 if writeback to |
| 164 // Rn should be used, and iiiiiiiiiiii is the offset. | 164 // Rn should be used, and iiiiiiiiiiii is the offset. |
| 165 DecodedAsImmRegOffset | 165 DecodedAsImmRegOffset, |
| 166 // Value is 32bit integer constant. | |
| 167 DecodedAsConstI32 | |
| 166 }; | 168 }; |
| 167 | 169 |
| 170 // Sets Encoding to a rotated Imm8 encoding of Value, if possible. | |
| 171 inline IValueT encodeRotatedImm8(IValueT RotateAmt, IValueT Immed8) { | |
| 172 assert((RotateAmt < (1 << kRotateBits)) && (Immed8 < (1 << kImmed8Bits))); | |
|
Jim Stichnoth
2015/10/30 21:41:11
Something like:
assert(a && b);
is better done a
Karl
2015/10/30 22:06:56
Done.
| |
| 173 return (RotateAmt << kRotateShift) | (Immed8 << kImmed8Shift); | |
| 174 } | |
| 175 | |
| 168 // Encodes iiiiitt0mmmm for data-processing (2nd) operands where iiiii=Imm5, | 176 // Encodes iiiiitt0mmmm for data-processing (2nd) operands where iiiii=Imm5, |
| 169 // tt=Shift, and mmmm=Rm. | 177 // tt=Shift, and mmmm=Rm. |
| 170 IValueT encodeShiftRotateImm5(IValueT Rm, OperandARM32::ShiftKind Shift, | 178 IValueT encodeShiftRotateImm5(IValueT Rm, OperandARM32::ShiftKind Shift, |
| 171 IOffsetT imm5) { | 179 IOffsetT imm5) { |
| 172 (void)kShiftImmBits; | 180 (void)kShiftImmBits; |
| 173 assert(imm5 < (1 << kShiftImmBits)); | 181 assert(imm5 < (1 << kShiftImmBits)); |
| 174 return (imm5 << kShiftImmShift) | (encodeShift(Shift) << kShiftShift) | Rm; | 182 return (imm5 << kShiftImmShift) | (encodeShift(Shift) << kShiftShift) | Rm; |
| 175 } | 183 } |
| 176 | 184 |
| 177 DecodedResult decodeOperand(const Operand *Opnd, IValueT &Value) { | 185 DecodedResult decodeOperand(const Operand *Opnd, IValueT &Value) { |
| 178 if (const auto *Var = llvm::dyn_cast<Variable>(Opnd)) { | 186 if (const auto *Var = llvm::dyn_cast<Variable>(Opnd)) { |
| 179 if (Var->hasReg()) { | 187 if (Var->hasReg()) { |
| 180 Value = Var->getRegNum(); | 188 Value = Var->getRegNum(); |
| 181 return DecodedAsRegister; | 189 return DecodedAsRegister; |
| 182 } | 190 } |
| 183 } else if (const auto *FlexImm = llvm::dyn_cast<OperandARM32FlexImm>(Opnd)) { | 191 } else if (const auto *FlexImm = llvm::dyn_cast<OperandARM32FlexImm>(Opnd)) { |
| 184 const IValueT Immed8 = FlexImm->getImm(); | 192 const IValueT Immed8 = FlexImm->getImm(); |
| 185 const IValueT Rotate = FlexImm->getRotateAmt(); | 193 const IValueT Rotate = FlexImm->getRotateAmt(); |
| 186 if (!((Rotate < (1 << kRotateBits)) && (Immed8 < (1 << kImmed8Bits)))) | 194 if (!((Rotate < (1 << kRotateBits)) && (Immed8 < (1 << kImmed8Bits)))) |
| 187 return CantDecode; | 195 return CantDecode; |
| 188 Value = (Rotate << kRotateShift) | (Immed8 << kImmed8Shift); | 196 Value = (Rotate << kRotateShift) | (Immed8 << kImmed8Shift); |
| 189 return DecodedAsRotatedImm8; | 197 return DecodedAsRotatedImm8; |
| 190 } | 198 } |
| 199 if (const auto *Const = llvm::dyn_cast<ConstantInteger32>(Opnd)) { | |
| 200 Value = Const->getValue(); | |
| 201 return DecodedAsConstI32; | |
| 202 } | |
| 191 return CantDecode; | 203 return CantDecode; |
| 192 } | 204 } |
| 193 | 205 |
| 194 IValueT decodeImmRegOffset(RegARM32::GPRRegister Reg, IOffsetT Offset, | 206 IValueT decodeImmRegOffset(RegARM32::GPRRegister Reg, IOffsetT Offset, |
| 195 OperandARM32Mem::AddrMode Mode) { | 207 OperandARM32Mem::AddrMode Mode) { |
| 196 IValueT Value = Mode | (encodeGPRRegister(Reg) << kRnShift); | 208 IValueT Value = Mode | (encodeGPRRegister(Reg) << kRnShift); |
| 197 if (Offset < 0) { | 209 if (Offset < 0) { |
| 198 Value = (Value ^ U) | -Offset; // Flip U to adjust sign. | 210 Value = (Value ^ U) | -Offset; // Flip U to adjust sign. |
| 199 } else { | 211 } else { |
| 200 Value |= Offset; | 212 Value |= Offset; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 return setNeedsTextFixup(); | 393 return setNeedsTextFixup(); |
| 382 emitType01(Cond, kInstTypeDataRegister, Opcode, SetFlags, Rn, Rd, | 394 emitType01(Cond, kInstTypeDataRegister, Opcode, SetFlags, Rn, Rd, |
| 383 Src1Value); | 395 Src1Value); |
| 384 return; | 396 return; |
| 385 } | 397 } |
| 386 case DecodedAsRotatedImm8: { | 398 case DecodedAsRotatedImm8: { |
| 387 // XXX (Immediate) | 399 // XXX (Immediate) |
| 388 // xxx{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 400 // xxx{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
| 389 // | 401 // |
| 390 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 402 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 391 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 403 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
| 392 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) | 404 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) |
| 393 // Conditions of rule violated. | 405 // Conditions of rule violated. |
| 394 return setNeedsTextFixup(); | 406 return setNeedsTextFixup(); |
| 395 emitType01(Cond, kInstTypeDataImmediate, Opcode, SetFlags, Rn, Rd, | 407 emitType01(Cond, kInstTypeDataImmediate, Opcode, SetFlags, Rn, Rd, |
| 396 Src1Value); | 408 Src1Value); |
| 397 return; | 409 return; |
| 398 } | 410 } |
| 399 } | 411 } |
| 400 } | 412 } |
| 401 | 413 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 // ADC (register) - ARM section 18.8.2, encoding A1: | 471 // ADC (register) - ARM section 18.8.2, encoding A1: |
| 460 // adc{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} | 472 // adc{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} |
| 461 // | 473 // |
| 462 // cccc0000101snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 474 // cccc0000101snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 463 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. | 475 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. |
| 464 // | 476 // |
| 465 // ADC (Immediate) - ARM section A8.8.1, encoding A1: | 477 // ADC (Immediate) - ARM section A8.8.1, encoding A1: |
| 466 // adc{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 478 // adc{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
| 467 // | 479 // |
| 468 // cccc0010101snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 480 // cccc0010101snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 469 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 481 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
| 470 constexpr IValueT Adc = B2 | B0; // 0101 | 482 constexpr IValueT Adc = B2 | B0; // 0101 |
| 471 emitType01(Adc, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 483 emitType01(Adc, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
| 472 } | 484 } |
| 473 | 485 |
| 474 void AssemblerARM32::add(const Operand *OpRd, const Operand *OpRn, | 486 void AssemblerARM32::add(const Operand *OpRd, const Operand *OpRn, |
| 475 const Operand *OpSrc1, bool SetFlags, | 487 const Operand *OpSrc1, bool SetFlags, |
| 476 CondARM32::Cond Cond) { | 488 CondARM32::Cond Cond) { |
| 477 // ADD (register) - ARM section A8.8.7, encoding A1: | 489 // ADD (register) - ARM section A8.8.7, encoding A1: |
| 478 // add{s}<c> <Rd>, <Rn>, <Rm>{, <shiff>} | 490 // add{s}<c> <Rd>, <Rn>, <Rm>{, <shiff>} |
| 479 // ADD (Sp plus register) - ARM section A8.8.11, encoding A1: | 491 // ADD (Sp plus register) - ARM section A8.8.11, encoding A1: |
| 480 // add{s}<c> sp, <Rn>, <Rm>{, <shiff>} | 492 // add{s}<c> sp, <Rn>, <Rm>{, <shiff>} |
| 481 // | 493 // |
| 482 // cccc0000100snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 494 // cccc0000100snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 483 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. | 495 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. |
| 484 // | 496 // |
| 485 // ADD (Immediate) - ARM section A8.8.5, encoding A1: | 497 // ADD (Immediate) - ARM section A8.8.5, encoding A1: |
| 486 // add{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 498 // add{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
| 487 // ADD (SP plus immediate) - ARM section A8.8.9, encoding A1. | 499 // ADD (SP plus immediate) - ARM section A8.8.9, encoding A1. |
| 488 // add{s}<c> <Rd>, sp, #<RotatedImm8> | 500 // add{s}<c> <Rd>, sp, #<RotatedImm8> |
| 489 // | 501 // |
| 490 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 502 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 491 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 503 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
| 492 constexpr IValueT Add = B2; // 0100 | 504 constexpr IValueT Add = B2; // 0100 |
| 493 emitType01(Add, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 505 emitType01(Add, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
| 494 } | 506 } |
| 495 | 507 |
| 496 void AssemblerARM32::and_(const Operand *OpRd, const Operand *OpRn, | 508 void AssemblerARM32::and_(const Operand *OpRd, const Operand *OpRn, |
| 497 const Operand *OpSrc1, bool SetFlags, | 509 const Operand *OpSrc1, bool SetFlags, |
| 498 CondARM32::Cond Cond) { | 510 CondARM32::Cond Cond) { |
| 499 // AND (register) - ARM section A8.8.14, encoding A1: | 511 // AND (register) - ARM section A8.8.14, encoding A1: |
| 500 // and{s}<c> <Rd>, <Rn>{, <shift>} | 512 // and{s}<c> <Rd>, <Rn>{, <shift>} |
| 501 // | 513 // |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 // cccc000100101111111111110001mmmm where mmmm=rm and cccc=Cond. | 545 // cccc000100101111111111110001mmmm where mmmm=rm and cccc=Cond. |
| 534 if (!(isGPRRegisterDefined(Rm) && isConditionDefined(Cond))) | 546 if (!(isGPRRegisterDefined(Rm) && isConditionDefined(Cond))) |
| 535 return setNeedsTextFixup(); | 547 return setNeedsTextFixup(); |
| 536 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 548 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 537 const IValueT Encoding = (encodeCondition(Cond) << kConditionShift) | B24 | | 549 const IValueT Encoding = (encodeCondition(Cond) << kConditionShift) | B24 | |
| 538 B21 | (0xfff << 8) | B4 | | 550 B21 | (0xfff << 8) | B4 | |
| 539 (encodeGPRRegister(Rm) << kRmShift); | 551 (encodeGPRRegister(Rm) << kRmShift); |
| 540 emitInst(Encoding); | 552 emitInst(Encoding); |
| 541 } | 553 } |
| 542 | 554 |
| 555 void AssemblerARM32::cmp(const Operand *OpRn, const Operand *OpSrc1, | |
| 556 CondARM32::Cond Cond) { | |
| 557 IValueT Rn; | |
| 558 if (decodeOperand(OpRn, Rn) != DecodedAsRegister) | |
| 559 return setNeedsTextFixup(); | |
| 560 constexpr IValueT Cmp = B3 | B1; // ie. 1010 | |
| 561 constexpr bool SetFlags = true; | |
| 562 constexpr IValueT Rd = RegARM32::Encoded_Reg_r0; | |
| 563 IValueT Src1Value; | |
| 564 // TODO(kschimpf) Other possible decodings of cmp. | |
| 565 switch (decodeOperand(OpSrc1, Src1Value)) { | |
| 566 default: | |
| 567 return setNeedsTextFixup(); | |
| 568 case DecodedAsRegister: { | |
| 569 // CMP (register) - ARM section A8.8.38, encoding A1: | |
| 570 // cmp<c> <Rn>, <Rm>{, <shift>} | |
| 571 // | |
| 572 // cccc00010101nnnn0000iiiiitt0mmmm where cccc=Cond, nnnn=Rn, mmmm=Rm, | |
| 573 // iiiii=Shift, and tt=ShiftKind. | |
| 574 constexpr IValueT Imm5 = 0; | |
| 575 Src1Value = encodeShiftRotateImm5(Src1Value, OperandARM32::kNoShift, Imm5); | |
| 576 emitType01(Cond, kInstTypeDataRegister, Cmp, SetFlags, Rn, Rd, Src1Value); | |
| 577 return; | |
| 578 } | |
| 579 case DecodedAsConstI32: { | |
| 580 // See if we can convert this to an CMP (immediate). | |
| 581 IValueT RotateAmt; | |
| 582 IValueT Imm8; | |
| 583 if (!OperandARM32FlexImm::canHoldImm(Src1Value, &RotateAmt, &Imm8)) | |
| 584 return setNeedsTextFixup(); | |
| 585 Src1Value = encodeRotatedImm8(RotateAmt, Imm8); | |
| 586 // Intenionally fall to next case! | |
|
Jim Stichnoth
2015/10/30 21:41:11
Intentionally
Karl
2015/10/30 22:06:56
Done.
| |
| 587 } | |
| 588 case DecodedAsRotatedImm8: { | |
| 589 // CMP (immediate) - ARM section A8.8.37 | |
| 590 // cmp<c: <Rn>, #<RotatedImm8> | |
| 591 // | |
| 592 // cccc00110101nnnn0000iiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | |
| 593 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. | |
| 594 emitType01(Cond, kInstTypeDataImmediate, Cmp, SetFlags, Rn, Rd, Src1Value); | |
| 595 return; | |
| 596 } | |
| 597 } | |
| 598 setNeedsTextFixup(); | |
| 599 } | |
| 600 | |
| 543 void AssemblerARM32::eor(const Operand *OpRd, const Operand *OpRn, | 601 void AssemblerARM32::eor(const Operand *OpRd, const Operand *OpRn, |
| 544 const Operand *OpSrc1, bool SetFlags, | 602 const Operand *OpSrc1, bool SetFlags, |
| 545 CondARM32::Cond Cond) { | 603 CondARM32::Cond Cond) { |
| 546 // EOR (register) - ARM section A*.8.47, encoding A1: | 604 // EOR (register) - ARM section A*.8.47, encoding A1: |
| 547 // eor{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} | 605 // eor{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} |
| 548 // | 606 // |
| 549 // cccc0000001snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 607 // cccc0000001snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 550 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. | 608 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. |
| 551 // | 609 // |
| 552 // EOR (Immediate) - ARM section A8.*.46, encoding A1: | 610 // EOR (Immediate) - ARM section A8.*.46, encoding A1: |
| 553 // eor{s}<c> <Rd>, <Rn>, #RotatedImm8 | 611 // eor{s}<c> <Rd>, <Rn>, #RotatedImm8 |
| 554 // | 612 // |
| 555 // cccc0010001snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 613 // cccc0010001snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 556 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 614 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
| 557 constexpr IValueT Eor = B0; // 0001 | 615 constexpr IValueT Eor = B0; // 0001 |
| 558 emitType01(Eor, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 616 emitType01(Eor, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
| 559 } | 617 } |
| 560 | 618 |
| 561 void AssemblerARM32::ldr(const Operand *OpRt, const Operand *OpAddress, | 619 void AssemblerARM32::ldr(const Operand *OpRt, const Operand *OpAddress, |
| 562 CondARM32::Cond Cond) { | 620 CondARM32::Cond Cond) { |
| 563 IValueT Rt; | 621 IValueT Rt; |
| 564 if (decodeOperand(OpRt, Rt) != DecodedAsRegister) | 622 if (decodeOperand(OpRt, Rt) != DecodedAsRegister) |
| 565 return setNeedsTextFixup(); | 623 return setNeedsTextFixup(); |
| 566 IValueT Address; | 624 IValueT Address; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 600 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) | 658 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) |
| 601 return setNeedsTextFixup(); | 659 return setNeedsTextFixup(); |
| 602 IValueT Src; | 660 IValueT Src; |
| 603 // TODO(kschimpf) Handle other forms of mov. | 661 // TODO(kschimpf) Handle other forms of mov. |
| 604 if (decodeOperand(OpSrc, Src) != DecodedAsRotatedImm8) | 662 if (decodeOperand(OpSrc, Src) != DecodedAsRotatedImm8) |
| 605 return setNeedsTextFixup(); | 663 return setNeedsTextFixup(); |
| 606 // MOV (immediate) - ARM section A8.8.102, encoding A1: | 664 // MOV (immediate) - ARM section A8.8.102, encoding A1: |
| 607 // mov{S}<c> <Rd>, #<RotatedImm8> | 665 // mov{S}<c> <Rd>, #<RotatedImm8> |
| 608 // | 666 // |
| 609 // cccc0011101s0000ddddiiiiiiiiiiii where cccc=Cond, s=SetFlags, dddd=Rd, and | 667 // cccc0011101s0000ddddiiiiiiiiiiii where cccc=Cond, s=SetFlags, dddd=Rd, and |
| 610 // iiiiiiiiiiii=RotatedImm8=Src. Note: We don't use movs in this assembler. | 668 // iiiiiiiiiiii=Src defining RotatedImm8. Note: We don't use movs in this |
| 669 // assembler. | |
| 611 constexpr bool SetFlags = false; | 670 constexpr bool SetFlags = false; |
| 612 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) | 671 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) |
| 613 // Conditions of rule violated. | 672 // Conditions of rule violated. |
| 614 return setNeedsTextFixup(); | 673 return setNeedsTextFixup(); |
| 615 constexpr IValueT Rn = 0; | 674 constexpr IValueT Rn = 0; |
| 616 constexpr IValueT Mov = B3 | B2 | B0; // 1101. | 675 constexpr IValueT Mov = B3 | B2 | B0; // 1101. |
| 617 emitType01(Cond, kInstTypeDataImmediate, Mov, SetFlags, Rn, Rd, Src); | 676 emitType01(Cond, kInstTypeDataImmediate, Mov, SetFlags, Rn, Rd, Src); |
| 618 } | 677 } |
| 619 | 678 |
| 620 void AssemblerARM32::movw(const Operand *OpRd, const Operand *OpSrc, | 679 void AssemblerARM32::movw(const Operand *OpRd, const Operand *OpSrc, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 // SBC (register) - ARM section 18.8.162, encoding A1: | 738 // SBC (register) - ARM section 18.8.162, encoding A1: |
| 680 // sbc{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} | 739 // sbc{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} |
| 681 // | 740 // |
| 682 // cccc0000110snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 741 // cccc0000110snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 683 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. | 742 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. |
| 684 // | 743 // |
| 685 // SBC (Immediate) - ARM section A8.8.161, encoding A1: | 744 // SBC (Immediate) - ARM section A8.8.161, encoding A1: |
| 686 // sbc{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 745 // sbc{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
| 687 // | 746 // |
| 688 // cccc0010110snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 747 // cccc0010110snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 689 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 748 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
| 690 constexpr IValueT Sbc = B2 | B1; // 0110 | 749 constexpr IValueT Sbc = B2 | B1; // 0110 |
| 691 emitType01(Sbc, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 750 emitType01(Sbc, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
| 692 } | 751 } |
| 693 | 752 |
| 694 void AssemblerARM32::str(const Operand *OpRt, const Operand *OpAddress, | 753 void AssemblerARM32::str(const Operand *OpRt, const Operand *OpAddress, |
| 695 CondARM32::Cond Cond) { | 754 CondARM32::Cond Cond) { |
| 696 IValueT Rt; | 755 IValueT Rt; |
| 697 if (decodeOperand(OpRt, Rt) != DecodedAsRegister) | 756 if (decodeOperand(OpRt, Rt) != DecodedAsRegister) |
| 698 return setNeedsTextFixup(); | 757 return setNeedsTextFixup(); |
| 699 IValueT Address; | 758 IValueT Address; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 806 // | 865 // |
| 807 // cccc0000010snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 866 // cccc0000010snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 808 // mmmm=Rm, iiiiii=shift, tt=ShiftKind, and s=SetFlags. | 867 // mmmm=Rm, iiiiii=shift, tt=ShiftKind, and s=SetFlags. |
| 809 // | 868 // |
| 810 // Sub (Immediate) - ARM section A8.8.222, encoding A1: | 869 // Sub (Immediate) - ARM section A8.8.222, encoding A1: |
| 811 // sub{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 870 // sub{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
| 812 // Sub (Sp minus immediate) - ARM section A8.*.225, encoding A1: | 871 // Sub (Sp minus immediate) - ARM section A8.*.225, encoding A1: |
| 813 // sub{s}<c> sp, <Rn>, #<RotatedImm8> | 872 // sub{s}<c> sp, <Rn>, #<RotatedImm8> |
| 814 // | 873 // |
| 815 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 874 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 816 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8 | 875 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8 |
| 817 constexpr IValueT Sub = B1; // 0010 | 876 constexpr IValueT Sub = B1; // 0010 |
| 818 emitType01(Sub, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 877 emitType01(Sub, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
| 819 } | 878 } |
| 820 | 879 |
| 821 } // end of namespace ARM32 | 880 } // end of namespace ARM32 |
| 822 } // end of namespace Ice | 881 } // end of namespace Ice |
| OLD | NEW |