OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_ASSEMBLER_ARM64_H_ | 5 #ifndef VM_ASSEMBLER_ARM64_H_ |
6 #define VM_ASSEMBLER_ARM64_H_ | 6 #define VM_ASSEMBLER_ARM64_H_ |
7 | 7 |
8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
9 #error Do not include assembler_arm64.h directly; use assembler.h instead. | 9 #error Do not include assembler_arm64.h directly; use assembler.h instead. |
10 #endif | 10 #endif |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 } | 594 } |
595 void ret(Register rn = R30) { | 595 void ret(Register rn = R30) { |
596 EmitUnconditionalBranchRegOp(RET, rn); | 596 EmitUnconditionalBranchRegOp(RET, rn); |
597 } | 597 } |
598 | 598 |
599 // Exceptions. | 599 // Exceptions. |
600 void hlt(uint16_t imm) { | 600 void hlt(uint16_t imm) { |
601 EmitExceptionGenOp(HLT, imm); | 601 EmitExceptionGenOp(HLT, imm); |
602 } | 602 } |
603 | 603 |
| 604 // Double floating point. |
| 605 bool fmovdi(VRegister vd, double immd) { |
| 606 int64_t imm64 = bit_cast<int64_t, double>(immd); |
| 607 const uint8_t bit7 = imm64 >> 63; |
| 608 const uint8_t bit6 = (~(imm64 >> 62)) & 0x1; |
| 609 const uint8_t bit54 = (imm64 >> 52) & 0x3; |
| 610 const uint8_t bit30 = (imm64 >> 48) & 0xf; |
| 611 const uint8_t imm8 = (bit7 << 7) | (bit6 << 6) | (bit54 << 4) | bit30; |
| 612 const int64_t expimm8 = Instr::VFPExpandImm(imm8); |
| 613 if (imm64 != expimm8) { |
| 614 return false; |
| 615 } |
| 616 EmitFPImm(FMOVDI, vd, imm8); |
| 617 return true; |
| 618 } |
| 619 void fmovdr(VRegister vd, Register rn) { |
| 620 EmitFPIntCvtOp(FMOVDR, static_cast<Register>(vd), rn); |
| 621 } |
| 622 void fmovrd(Register rd, VRegister vn) { |
| 623 EmitFPIntCvtOp(FMOVRD, rd, static_cast<Register>(vn)); |
| 624 } |
| 625 |
604 // Aliases. | 626 // Aliases. |
605 void mov(Register rd, Register rn) { | 627 void mov(Register rd, Register rn) { |
606 if ((rd == SP) || (rn == SP)) { | 628 if ((rd == SP) || (rn == SP)) { |
607 add(rd, rn, Operand(0)); | 629 add(rd, rn, Operand(0)); |
608 } else { | 630 } else { |
609 orr(rd, ZR, Operand(rn)); | 631 orr(rd, ZR, Operand(rn)); |
610 } | 632 } |
611 } | 633 } |
612 void mvn(Register rd, Register rm) { | 634 void mvn(Register rd, Register rm) { |
613 orr(rd, ZR, Operand(rm)); | 635 orr(rd, ZR, Operand(rm)); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 intptr_t FindObject(const Object& obj, Patchability patchable); | 765 intptr_t FindObject(const Object& obj, Patchability patchable); |
744 intptr_t FindImmediate(int64_t imm); | 766 intptr_t FindImmediate(int64_t imm); |
745 bool CanLoadObjectFromPool(const Object& object); | 767 bool CanLoadObjectFromPool(const Object& object); |
746 bool CanLoadImmediateFromPool(int64_t imm, Register pp); | 768 bool CanLoadImmediateFromPool(int64_t imm, Register pp); |
747 void LoadExternalLabel(Register dst, const ExternalLabel* label, | 769 void LoadExternalLabel(Register dst, const ExternalLabel* label, |
748 Patchability patchable, Register pp); | 770 Patchability patchable, Register pp); |
749 void LoadObject(Register dst, const Object& obj, Register pp); | 771 void LoadObject(Register dst, const Object& obj, Register pp); |
750 void LoadDecodableImmediate(Register reg, int64_t imm, Register pp); | 772 void LoadDecodableImmediate(Register reg, int64_t imm, Register pp); |
751 void LoadImmediateFixed(Register reg, int64_t imm); | 773 void LoadImmediateFixed(Register reg, int64_t imm); |
752 void LoadImmediate(Register reg, int64_t imm, Register pp); | 774 void LoadImmediate(Register reg, int64_t imm, Register pp); |
| 775 void LoadDImmediate(VRegister reg, double immd, Register pp); |
753 | 776 |
754 void PushObject(const Object& object, Register pp) { | 777 void PushObject(const Object& object, Register pp) { |
755 LoadObject(TMP, object, pp); | 778 LoadObject(TMP, object, pp); |
756 Push(TMP); | 779 Push(TMP); |
757 } | 780 } |
758 void CompareObject(Register reg, const Object& object, Register pp); | 781 void CompareObject(Register reg, const Object& object, Register pp); |
759 | 782 |
760 void LoadClassId(Register result, Register object); | 783 void LoadClassId(Register result, Register object); |
761 void LoadClassById(Register result, Register class_id); | 784 void LoadClassById(Register result, Register class_id); |
762 void LoadClass(Register result, Register object); | 785 void LoadClass(Register result, Register object); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 const int32_t size = (sz == kDoubleWord) ? B31 : 0; | 1130 const int32_t size = (sz == kDoubleWord) ? B31 : 0; |
1108 const int32_t encoding = | 1131 const int32_t encoding = |
1109 op | size | | 1132 op | size | |
1110 (static_cast<int32_t>(crd) << kRdShift) | | 1133 (static_cast<int32_t>(crd) << kRdShift) | |
1111 (static_cast<int32_t>(crn) << kRnShift) | | 1134 (static_cast<int32_t>(crn) << kRnShift) | |
1112 (static_cast<int32_t>(crm) << kRmShift) | | 1135 (static_cast<int32_t>(crm) << kRmShift) | |
1113 (static_cast<int32_t>(cond) << kSelCondShift); | 1136 (static_cast<int32_t>(cond) << kSelCondShift); |
1114 Emit(encoding); | 1137 Emit(encoding); |
1115 } | 1138 } |
1116 | 1139 |
| 1140 void EmitFPImm(FPImmOp op, VRegister vd, uint8_t imm8) { |
| 1141 const int32_t encoding = |
| 1142 op | |
| 1143 (static_cast<int32_t>(vd) << kVdShift) | |
| 1144 (imm8 << kImm8Shift); |
| 1145 Emit(encoding); |
| 1146 } |
| 1147 |
| 1148 void EmitFPIntCvtOp(FPIntCvtOp op, Register rd, Register rn) { |
| 1149 const int32_t encoding = |
| 1150 op | |
| 1151 (static_cast<int32_t>(rd) << kRdShift) | |
| 1152 (static_cast<int32_t>(rn) << kRnShift); |
| 1153 Emit(encoding); |
| 1154 } |
| 1155 |
1117 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); | 1156 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); |
1118 | 1157 |
1119 // Shorter filtering sequence that assumes that value is not a smi. | 1158 // Shorter filtering sequence that assumes that value is not a smi. |
1120 void StoreIntoObjectFilterNoSmi(Register object, | 1159 void StoreIntoObjectFilterNoSmi(Register object, |
1121 Register value, | 1160 Register value, |
1122 Label* no_update); | 1161 Label* no_update); |
1123 | 1162 |
1124 DISALLOW_ALLOCATION(); | 1163 DISALLOW_ALLOCATION(); |
1125 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1164 DISALLOW_COPY_AND_ASSIGN(Assembler); |
1126 }; | 1165 }; |
1127 | 1166 |
1128 } // namespace dart | 1167 } // namespace dart |
1129 | 1168 |
1130 #endif // VM_ASSEMBLER_ARM64_H_ | 1169 #endif // VM_ASSEMBLER_ARM64_H_ |
OLD | NEW |