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

Side by Side Diff: src/IceAssemblerX86BaseImpl.h

Issue 2063053002: Subzero: x86-64: Allow immediates in 64-bit instructions. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix assert. Created 4 years, 6 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
« no previous file with comments | « no previous file | src/IceInstX86BaseImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceAssemblerX86BaseImpl.h - base x86 assembler -*- C++ -*-=// 1 //===- subzero/src/IceAssemblerX86BaseImpl.h - base x86 assembler -*- C++ -*-=//
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 // 5 //
6 // Modified by the Subzero authors. 6 // Modified by the Subzero authors.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // The Subzero Code Generator 10 // The Subzero Code Generator
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 emitUint8(0x88); 288 emitUint8(0x88);
289 } else { 289 } else {
290 emitUint8(0x89); 290 emitUint8(0x89);
291 } 291 }
292 emitOperand(gprEncoding(src), dst); 292 emitOperand(gprEncoding(src), dst);
293 } 293 }
294 294
295 template <typename TraitsType> 295 template <typename TraitsType>
296 void AssemblerX86Base<TraitsType>::mov(Type Ty, const Address &dst, 296 void AssemblerX86Base<TraitsType>::mov(Type Ty, const Address &dst,
297 const Immediate &imm) { 297 const Immediate &imm) {
298 assert(Ty != IceType_i64 && "i64 not supported yet.");
299 AssemblerBuffer::EnsureCapacity ensured(&Buffer); 298 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
300 if (Ty == IceType_i16) 299 if (Ty == IceType_i16)
301 emitOperandSizeOverride(); 300 emitOperandSizeOverride();
302 emitAddrSizeOverridePrefix(); 301 emitAddrSizeOverridePrefix();
303 emitRex(Ty, dst, RexRegIrrelevant); 302 emitRex(Ty, dst, RexRegIrrelevant);
304 if (isByteSizedType(Ty)) { 303 if (isByteSizedType(Ty)) {
305 emitUint8(0xC6); 304 emitUint8(0xC6);
306 static constexpr RelocOffsetT OffsetFromNextInstruction = 1; 305 static constexpr RelocOffsetT OffsetFromNextInstruction = 1;
307 emitOperand(0, dst, OffsetFromNextInstruction); 306 emitOperand(0, dst, OffsetFromNextInstruction);
308 emitUint8(imm.value() & 0xFF); 307 emitUint8(imm.value() & 0xFF);
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2634 emitRex(Ty, address, reg); 2633 emitRex(Ty, address, reg);
2635 emitUint8(0x0F); 2634 emitUint8(0x0F);
2636 emitUint8(0xAF); 2635 emitUint8(0xAF);
2637 emitOperand(gprEncoding(reg), address); 2636 emitOperand(gprEncoding(reg), address);
2638 } 2637 }
2639 2638
2640 template <typename TraitsType> 2639 template <typename TraitsType>
2641 void AssemblerX86Base<TraitsType>::imul(Type Ty, GPRRegister reg, 2640 void AssemblerX86Base<TraitsType>::imul(Type Ty, GPRRegister reg,
2642 const Immediate &imm) { 2641 const Immediate &imm) {
2643 AssemblerBuffer::EnsureCapacity ensured(&Buffer); 2642 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
2644 assert(Ty == IceType_i16 || Ty == IceType_i32); 2643 assert(Ty == IceType_i16 || Ty == IceType_i32 || Ty == IceType_i64);
2645 if (Ty == IceType_i16) 2644 if (Ty == IceType_i16)
2646 emitOperandSizeOverride(); 2645 emitOperandSizeOverride();
2647 emitRexRB(Ty, reg, reg); 2646 emitRexRB(Ty, reg, reg);
2648 if (imm.is_int8()) { 2647 if (imm.is_int8()) {
2649 emitUint8(0x6B); 2648 emitUint8(0x6B);
2650 emitRegisterOperand(gprEncoding(reg), gprEncoding(reg)); 2649 emitRegisterOperand(gprEncoding(reg), gprEncoding(reg));
2651 emitUint8(imm.value() & 0xFF); 2650 emitUint8(imm.value() & 0xFF);
2652 } else { 2651 } else {
2653 emitUint8(0x69); 2652 emitUint8(0x69);
2654 emitRegisterOperand(gprEncoding(reg), gprEncoding(reg)); 2653 emitRegisterOperand(gprEncoding(reg), gprEncoding(reg));
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
3583 (void)shifter; 3582 (void)shifter;
3584 if (Ty == IceType_i16) 3583 if (Ty == IceType_i16)
3585 emitOperandSizeOverride(); 3584 emitOperandSizeOverride();
3586 emitRexB(Ty, operand.rm()); 3585 emitRexB(Ty, operand.rm());
3587 emitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); 3586 emitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3);
3588 emitOperand(rm, operand); 3587 emitOperand(rm, operand);
3589 } 3588 }
3590 3589
3591 } // end of namespace X86NAMESPACE 3590 } // end of namespace X86NAMESPACE
3592 } // end of namespace Ice 3591 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceInstX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698