OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ | 5 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ |
6 #define V8_X64_ASSEMBLER_X64_INL_H_ | 6 #define V8_X64_ASSEMBLER_X64_INL_H_ |
7 | 7 |
8 #include "src/x64/assembler-x64.h" | 8 #include "src/x64/assembler-x64.h" |
9 | 9 |
10 #include "src/base/cpu.h" | 10 #include "src/base/cpu.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 void Assembler::emit_optional_rex_32(XMMRegister rm_reg) { | 182 void Assembler::emit_optional_rex_32(XMMRegister rm_reg) { |
183 if (rm_reg.high_bit()) emit(0x41); | 183 if (rm_reg.high_bit()) emit(0x41); |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 void Assembler::emit_optional_rex_32(const Operand& op) { | 187 void Assembler::emit_optional_rex_32(const Operand& op) { |
188 if (op.rex_ != 0) emit(0x40 | op.rex_); | 188 if (op.rex_ != 0) emit(0x40 | op.rex_); |
189 } | 189 } |
190 | 190 |
191 | 191 |
| 192 // byte 1 of 3-byte VEX |
| 193 void Assembler::emit_vex3_byte1(XMMRegister reg, XMMRegister rm, |
| 194 LeadingOpcode m) { |
| 195 byte rxb = ~((reg.high_bit() << 2) | rm.high_bit()) << 5; |
| 196 emit(rxb | m); |
| 197 } |
| 198 |
| 199 |
| 200 // byte 1 of 3-byte VEX |
| 201 void Assembler::emit_vex3_byte1(XMMRegister reg, const Operand& rm, |
| 202 LeadingOpcode m) { |
| 203 byte rxb = ~((reg.high_bit() << 2) | rm.rex_) << 5; |
| 204 emit(rxb | m); |
| 205 } |
| 206 |
| 207 |
| 208 // byte 1 of 2-byte VEX |
| 209 void Assembler::emit_vex2_byte1(XMMRegister reg, XMMRegister v, VectorLength l, |
| 210 SIMDPrefix pp) { |
| 211 byte rv = ~((reg.high_bit() << 4) | v.code()) << 3; |
| 212 emit(rv | l | pp); |
| 213 } |
| 214 |
| 215 |
| 216 // byte 2 of 3-byte VEX |
| 217 void Assembler::emit_vex3_byte2(VexW w, XMMRegister v, VectorLength l, |
| 218 SIMDPrefix pp) { |
| 219 emit(w | ((~v.code() & 0xf) << 3) | l | pp); |
| 220 } |
| 221 |
| 222 |
| 223 void Assembler::emit_vex_prefix(XMMRegister reg, XMMRegister vreg, |
| 224 XMMRegister rm, VectorLength l, SIMDPrefix pp, |
| 225 LeadingOpcode mm, VexW w) { |
| 226 if (rm.high_bit() || mm != k0F || w != kW0) { |
| 227 emit_vex3_byte0(); |
| 228 emit_vex3_byte1(reg, rm, mm); |
| 229 emit_vex3_byte2(w, vreg, l, pp); |
| 230 } else { |
| 231 emit_vex2_byte0(); |
| 232 emit_vex2_byte1(reg, vreg, l, pp); |
| 233 } |
| 234 } |
| 235 |
| 236 |
| 237 void Assembler::emit_vex_prefix(XMMRegister reg, XMMRegister vreg, |
| 238 const Operand& rm, VectorLength l, |
| 239 SIMDPrefix pp, LeadingOpcode mm, VexW w) { |
| 240 if (rm.rex_ || mm != k0F || w != kW0) { |
| 241 emit_vex3_byte0(); |
| 242 emit_vex3_byte1(reg, rm, mm); |
| 243 emit_vex3_byte2(w, vreg, l, pp); |
| 244 } else { |
| 245 emit_vex2_byte0(); |
| 246 emit_vex2_byte1(reg, vreg, l, pp); |
| 247 } |
| 248 } |
| 249 |
| 250 |
192 Address Assembler::target_address_at(Address pc, | 251 Address Assembler::target_address_at(Address pc, |
193 ConstantPoolArray* constant_pool) { | 252 ConstantPoolArray* constant_pool) { |
194 return Memory::int32_at(pc) + pc + 4; | 253 return Memory::int32_at(pc) + pc + 4; |
195 } | 254 } |
196 | 255 |
197 | 256 |
198 void Assembler::set_target_address_at(Address pc, | 257 void Assembler::set_target_address_at(Address pc, |
199 ConstantPoolArray* constant_pool, | 258 ConstantPoolArray* constant_pool, |
200 Address target, | 259 Address target, |
201 ICacheFlushMode icache_flush_mode) { | 260 ICacheFlushMode icache_flush_mode) { |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 DCHECK(len_ == 1 || len_ == 2); | 618 DCHECK(len_ == 1 || len_ == 2); |
560 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 619 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
561 *p = disp; | 620 *p = disp; |
562 len_ += sizeof(int32_t); | 621 len_ += sizeof(int32_t); |
563 } | 622 } |
564 | 623 |
565 | 624 |
566 } } // namespace v8::internal | 625 } } // namespace v8::internal |
567 | 626 |
568 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 627 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |