Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: src/ia32/assembler-ia32.h

Issue 133443009: A64: Synchronize with r17441. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/i18n.js ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 // } 528 // }
529 class CpuFeatures : public AllStatic { 529 class CpuFeatures : public AllStatic {
530 public: 530 public:
531 // Detect features of the target CPU. Set safe defaults if the serializer 531 // Detect features of the target CPU. Set safe defaults if the serializer
532 // is enabled (snapshots must be portable). 532 // is enabled (snapshots must be portable).
533 static void Probe(); 533 static void Probe();
534 534
535 // Check whether a feature is supported by the target CPU. 535 // Check whether a feature is supported by the target CPU.
536 static bool IsSupported(CpuFeature f) { 536 static bool IsSupported(CpuFeature f) {
537 ASSERT(initialized_); 537 ASSERT(initialized_);
538 if (Check(f, cross_compile_)) return true;
538 if (f == SSE2 && !FLAG_enable_sse2) return false; 539 if (f == SSE2 && !FLAG_enable_sse2) return false;
539 if (f == SSE3 && !FLAG_enable_sse3) return false; 540 if (f == SSE3 && !FLAG_enable_sse3) return false;
540 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; 541 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false;
541 if (f == CMOV && !FLAG_enable_cmov) return false; 542 if (f == CMOV && !FLAG_enable_cmov) return false;
542 return (supported_ & (static_cast<uint64_t>(1) << f)) != 0; 543 return Check(f, supported_);
543 } 544 }
544 545
545 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { 546 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) {
546 ASSERT(initialized_); 547 ASSERT(initialized_);
547 return (found_by_runtime_probing_only_ & 548 return Check(f, found_by_runtime_probing_only_);
548 (static_cast<uint64_t>(1) << f)) != 0;
549 } 549 }
550 550
551 static bool IsSafeForSnapshot(CpuFeature f) { 551 static bool IsSafeForSnapshot(CpuFeature f) {
552 return (IsSupported(f) && 552 return Check(f, cross_compile_) ||
553 (IsSupported(f) &&
553 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); 554 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f)));
554 } 555 }
555 556
557 static bool VerifyCrossCompiling() {
558 return cross_compile_ == 0;
559 }
560
561 static bool VerifyCrossCompiling(CpuFeature f) {
562 uint64_t mask = flag2set(f);
563 return cross_compile_ == 0 ||
564 (cross_compile_ & mask) == mask;
565 }
566
556 private: 567 private:
568 static bool Check(CpuFeature f, uint64_t set) {
569 return (set & flag2set(f)) != 0;
570 }
571
572 static uint64_t flag2set(CpuFeature f) {
573 return static_cast<uint64_t>(1) << f;
574 }
575
557 #ifdef DEBUG 576 #ifdef DEBUG
558 static bool initialized_; 577 static bool initialized_;
559 #endif 578 #endif
560 static uint64_t supported_; 579 static uint64_t supported_;
561 static uint64_t found_by_runtime_probing_only_; 580 static uint64_t found_by_runtime_probing_only_;
562 581
582 static uint64_t cross_compile_;
583
563 friend class ExternalReference; 584 friend class ExternalReference;
564 friend class PlatformFeatureScope; 585 friend class PlatformFeatureScope;
565 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); 586 DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
566 }; 587 };
567 588
568 589
569 class Assembler : public AssemblerBase { 590 class Assembler : public AssemblerBase {
570 private: 591 private:
571 // We check before assembling an instruction that there is sufficient 592 // We check before assembling an instruction that there is sufficient
572 // space to write an instruction and its relocation information. 593 // space to write an instruction and its relocation information.
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 void fwait(); 1010 void fwait();
990 void fnclex(); 1011 void fnclex();
991 1012
992 void frndint(); 1013 void frndint();
993 1014
994 void sahf(); 1015 void sahf();
995 void setcc(Condition cc, Register reg); 1016 void setcc(Condition cc, Register reg);
996 1017
997 void cpuid(); 1018 void cpuid();
998 1019
1020 // SSE instructions
1021 void andps(XMMRegister dst, XMMRegister src);
1022 void xorps(XMMRegister dst, XMMRegister src);
1023
999 // SSE2 instructions 1024 // SSE2 instructions
1000 void cvttss2si(Register dst, const Operand& src); 1025 void cvttss2si(Register dst, const Operand& src);
1001 void cvttsd2si(Register dst, const Operand& src); 1026 void cvttsd2si(Register dst, const Operand& src);
1002 void cvtsd2si(Register dst, XMMRegister src); 1027 void cvtsd2si(Register dst, XMMRegister src);
1003 1028
1004 void cvtsi2sd(XMMRegister dst, Register src) { cvtsi2sd(dst, Operand(src)); } 1029 void cvtsi2sd(XMMRegister dst, Register src) { cvtsi2sd(dst, Operand(src)); }
1005 void cvtsi2sd(XMMRegister dst, const Operand& src); 1030 void cvtsi2sd(XMMRegister dst, const Operand& src);
1006 void cvtss2sd(XMMRegister dst, XMMRegister src); 1031 void cvtss2sd(XMMRegister dst, XMMRegister src);
1007 void cvtsd2ss(XMMRegister dst, XMMRegister src); 1032 void cvtsd2ss(XMMRegister dst, XMMRegister src);
1008 1033
1009 void addsd(XMMRegister dst, XMMRegister src); 1034 void addsd(XMMRegister dst, XMMRegister src);
1010 void addsd(XMMRegister dst, const Operand& src); 1035 void addsd(XMMRegister dst, const Operand& src);
1011 void subsd(XMMRegister dst, XMMRegister src); 1036 void subsd(XMMRegister dst, XMMRegister src);
1012 void mulsd(XMMRegister dst, XMMRegister src); 1037 void mulsd(XMMRegister dst, XMMRegister src);
1013 void mulsd(XMMRegister dst, const Operand& src); 1038 void mulsd(XMMRegister dst, const Operand& src);
1014 void divsd(XMMRegister dst, XMMRegister src); 1039 void divsd(XMMRegister dst, XMMRegister src);
1015 void xorpd(XMMRegister dst, XMMRegister src); 1040 void xorpd(XMMRegister dst, XMMRegister src);
1016 void xorps(XMMRegister dst, XMMRegister src);
1017 void sqrtsd(XMMRegister dst, XMMRegister src); 1041 void sqrtsd(XMMRegister dst, XMMRegister src);
1018 1042
1019 void andpd(XMMRegister dst, XMMRegister src); 1043 void andpd(XMMRegister dst, XMMRegister src);
1020 void orpd(XMMRegister dst, XMMRegister src); 1044 void orpd(XMMRegister dst, XMMRegister src);
1021 1045
1022 void ucomisd(XMMRegister dst, XMMRegister src); 1046 void ucomisd(XMMRegister dst, XMMRegister src);
1023 void ucomisd(XMMRegister dst, const Operand& src); 1047 void ucomisd(XMMRegister dst, const Operand& src);
1024 1048
1025 enum RoundingMode { 1049 enum RoundingMode {
1026 kRoundToNearest = 0x0, 1050 kRoundToNearest = 0x0,
(...skipping 17 matching lines...) Expand all
1044 void movdqu(XMMRegister dst, const Operand& src); 1068 void movdqu(XMMRegister dst, const Operand& src);
1045 void movdqu(const Operand& dst, XMMRegister src); 1069 void movdqu(const Operand& dst, XMMRegister src);
1046 void movdq(bool aligned, XMMRegister dst, const Operand& src) { 1070 void movdq(bool aligned, XMMRegister dst, const Operand& src) {
1047 if (aligned) { 1071 if (aligned) {
1048 movdqa(dst, src); 1072 movdqa(dst, src);
1049 } else { 1073 } else {
1050 movdqu(dst, src); 1074 movdqu(dst, src);
1051 } 1075 }
1052 } 1076 }
1053 1077
1054 // Use either movsd or movlpd.
1055 void movdbl(XMMRegister dst, const Operand& src);
1056 void movdbl(const Operand& dst, XMMRegister src);
1057
1058 void movd(XMMRegister dst, Register src) { movd(dst, Operand(src)); } 1078 void movd(XMMRegister dst, Register src) { movd(dst, Operand(src)); }
1059 void movd(XMMRegister dst, const Operand& src); 1079 void movd(XMMRegister dst, const Operand& src);
1060 void movd(Register dst, XMMRegister src) { movd(Operand(dst), src); } 1080 void movd(Register dst, XMMRegister src) { movd(Operand(dst), src); }
1061 void movd(const Operand& dst, XMMRegister src); 1081 void movd(const Operand& dst, XMMRegister src);
1062 void movsd(XMMRegister dst, XMMRegister src); 1082 void movsd(XMMRegister dst, XMMRegister src);
1083 void movsd(XMMRegister dst, const Operand& src);
1084 void movsd(const Operand& dst, XMMRegister src);
1085
1063 1086
1064 void movss(XMMRegister dst, const Operand& src); 1087 void movss(XMMRegister dst, const Operand& src);
1065 void movss(const Operand& dst, XMMRegister src); 1088 void movss(const Operand& dst, XMMRegister src);
1066 void movss(XMMRegister dst, XMMRegister src); 1089 void movss(XMMRegister dst, XMMRegister src);
1067 void extractps(Register dst, XMMRegister src, byte imm8); 1090 void extractps(Register dst, XMMRegister src, byte imm8);
1068 1091
1069 void pand(XMMRegister dst, XMMRegister src); 1092 void pand(XMMRegister dst, XMMRegister src);
1070 void pxor(XMMRegister dst, XMMRegister src); 1093 void pxor(XMMRegister dst, XMMRegister src);
1071 void por(XMMRegister dst, XMMRegister src); 1094 void por(XMMRegister dst, XMMRegister src);
1072 void ptest(XMMRegister dst, XMMRegister src); 1095 void ptest(XMMRegister dst, XMMRegister src);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 1153
1131 PositionsRecorder* positions_recorder() { return &positions_recorder_; } 1154 PositionsRecorder* positions_recorder() { return &positions_recorder_; }
1132 1155
1133 int relocation_writer_size() { 1156 int relocation_writer_size() {
1134 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); 1157 return (buffer_ + buffer_size_) - reloc_info_writer.pos();
1135 } 1158 }
1136 1159
1137 // Avoid overflows for displacements etc. 1160 // Avoid overflows for displacements etc.
1138 static const int kMaximalBufferSize = 512*MB; 1161 static const int kMaximalBufferSize = 512*MB;
1139 1162
1140 byte byte_at(int pos) { return buffer_[pos]; } 1163 byte byte_at(int pos) { return buffer_[pos]; }
1141 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } 1164 void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
1142 1165
1143 protected: 1166 protected:
1144 void movsd(XMMRegister dst, const Operand& src);
1145 void movsd(const Operand& dst, XMMRegister src);
1146
1147 void emit_sse_operand(XMMRegister reg, const Operand& adr); 1167 void emit_sse_operand(XMMRegister reg, const Operand& adr);
1148 void emit_sse_operand(XMMRegister dst, XMMRegister src); 1168 void emit_sse_operand(XMMRegister dst, XMMRegister src);
1149 void emit_sse_operand(Register dst, XMMRegister src); 1169 void emit_sse_operand(Register dst, XMMRegister src);
1170 void emit_sse_operand(XMMRegister dst, Register src);
1150 1171
1151 byte* addr_at(int pos) { return buffer_ + pos; } 1172 byte* addr_at(int pos) { return buffer_ + pos; }
1152 1173
1153 1174
1154 private: 1175 private:
1155 uint32_t long_at(int pos) { 1176 uint32_t long_at(int pos) {
1156 return *reinterpret_cast<uint32_t*>(addr_at(pos)); 1177 return *reinterpret_cast<uint32_t*>(addr_at(pos));
1157 } 1178 }
1158 void long_at_put(int pos, uint32_t x) { 1179 void long_at_put(int pos, uint32_t x) {
1159 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; 1180 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 private: 1256 private:
1236 Assembler* assembler_; 1257 Assembler* assembler_;
1237 #ifdef DEBUG 1258 #ifdef DEBUG
1238 int space_before_; 1259 int space_before_;
1239 #endif 1260 #endif
1240 }; 1261 };
1241 1262
1242 } } // namespace v8::internal 1263 } } // namespace v8::internal
1243 1264
1244 #endif // V8_IA32_ASSEMBLER_IA32_H_ 1265 #endif // V8_IA32_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « src/i18n.js ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698