143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Copyright (c) 1994-2006 Sun Microsystems Inc.
243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// All Rights Reserved.
343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen//
443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Redistribution and use in source and binary forms, with or without
543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// modification, are permitted provided that the following conditions
643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// are met:
743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen//
843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// - Redistributions of source code must retain the above copyright notice,
943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// this list of conditions and the following disclaimer.
1043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen//
1143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// - Redistribution in binary form must reproduce the above copyright
1243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// notice, this list of conditions and the following disclaimer in the
1343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// documentation and/or other materials provided with the
1443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// distribution.
1543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen//
1643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// - Neither the name of Sun Microsystems or the names of contributors may
1743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// be used to endorse or promote products derived from this software without
1843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// specific prior written permission.
1943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen//
2043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
3143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// OF THE POSSIBILITY OF SUCH DAMAGE.
3243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
3343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// The original source code covered by the above license above has been modified
3443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// significantly by Google Inc.
3556454717593e7552d6846198b8e0f661fa36a3cayangguo@chromium.org// Copyright 2012 the V8 project authors. All rights reserved.
3643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
37196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org#include "src/v8.h"
3843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
3993a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org#if V8_TARGET_ARCH_IA32
409dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com
4121d700eedcdd6570eff22ece724b63a5eefe78cbmachenbach@chromium.org#include "src/base/bits.h"
425de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#include "src/base/cpu.h"
43196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org#include "src/disassembler.h"
44196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org#include "src/macro-assembler.h"
45196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org#include "src/serialize.h"
4643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
4771affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.orgnamespace v8 {
4871affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.orgnamespace internal {
4943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
5043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// -----------------------------------------------------------------------------
5143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Implementation of CpuFeatures
5243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
53874aad37f2a832804012c6f56739f4fc6c9283cdmachenbach@chromium.orgvoid CpuFeatures::ProbeImpl(bool cross_compile) {
545de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  base::CPU cpu;
553c3c8d733702cb2b41471efa5eead1faf5b5711bmachenbach@chromium.org  CHECK(cpu.has_sse2());  // SSE2 support is mandatory.
561e4822ffed805d9cbb2a47cc9453aef06f3dfacamachenbach@chromium.org  CHECK(cpu.has_cmov());  // CMOV support is mandatory.
571e8da746019f818a22dfdc6f691dbc0447048cadjkummerow@chromium.org
58874aad37f2a832804012c6f56739f4fc6c9283cdmachenbach@chromium.org  // Only use statically determined features for cross compile (snapshot).
59874aad37f2a832804012c6f56739f4fc6c9283cdmachenbach@chromium.org  if (cross_compile) return;
601e8da746019f818a22dfdc6f691dbc0447048cadjkummerow@chromium.org
61874aad37f2a832804012c6f56739f4fc6c9283cdmachenbach@chromium.org  if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1;
62874aad37f2a832804012c6f56739f4fc6c9283cdmachenbach@chromium.org  if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3;
6343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
6443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
6543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
66874aad37f2a832804012c6f56739f4fc6c9283cdmachenbach@chromium.orgvoid CpuFeatures::PrintTarget() { }
67874aad37f2a832804012c6f56739f4fc6c9283cdmachenbach@chromium.orgvoid CpuFeatures::PrintFeatures() { }
68874aad37f2a832804012c6f56739f4fc6c9283cdmachenbach@chromium.org
69874aad37f2a832804012c6f56739f4fc6c9283cdmachenbach@chromium.org
7043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// -----------------------------------------------------------------------------
717276f14ca716596e0a0d17539516370c1f453847kasper.lund// Implementation of Displacement
727276f14ca716596e0a0d17539516370c1f453847kasper.lund
737276f14ca716596e0a0d17539516370c1f453847kasper.lundvoid Displacement::init(Label* L, Type type) {
74e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(!L->is_bound());
757276f14ca716596e0a0d17539516370c1f453847kasper.lund  int next = 0;
767276f14ca716596e0a0d17539516370c1f453847kasper.lund  if (L->is_linked()) {
777276f14ca716596e0a0d17539516370c1f453847kasper.lund    next = L->pos();
78e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org    DCHECK(next > 0);  // Displacements must be at positions > 0
7943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
807276f14ca716596e0a0d17539516370c1f453847kasper.lund  // Ensure that we _never_ overflow the next field.
81e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(NextField::is_valid(Assembler::kMaximalBufferSize));
827276f14ca716596e0a0d17539516370c1f453847kasper.lund  data_ = NextField::encode(next) | TypeField::encode(type);
837276f14ca716596e0a0d17539516370c1f453847kasper.lund}
8443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
8543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
8643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// -----------------------------------------------------------------------------
8743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Implementation of RelocInfo
8843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
8943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
9043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenconst int RelocInfo::kApplyMask =
91236ad9617a7359a463144a6ebeb5431a70f769cfager@chromium.org  RelocInfo::kCodeTargetMask | 1 << RelocInfo::RUNTIME_ENTRY |
92c4e51ac6d26b42753a57a4a9e4a419243b50151clrn@chromium.org    1 << RelocInfo::JS_RETURN | 1 << RelocInfo::INTERNAL_REFERENCE |
93e4ac3ef2f6fa9300bc78c5a4cb7d4cb66ac6e83dmvstanton@chromium.org    1 << RelocInfo::DEBUG_BREAK_SLOT | 1 << RelocInfo::CODE_AGE_SEQUENCE;
9443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
9543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
969dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.combool RelocInfo::IsCodedSpecially() {
979dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com  // The deserializer needs to know whether a pointer is specially coded.  Being
989dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com  // specially coded on IA32 means that it is a relative address, as used by
999dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com  // branch instructions.  These are also the ones that need changing when a
1009dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com  // code object moves.
1019dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com  return (1 << rmode_) & kApplyMask;
1029dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com}
1039dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com
1049dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com
105bcc36723a2ace28fa3b0d7dd0d1de926d313fff9machenbach@chromium.orgbool RelocInfo::IsInConstantPool() {
106bcc36723a2ace28fa3b0d7dd0d1de926d313fff9machenbach@chromium.org  return false;
107bcc36723a2ace28fa3b0d7dd0d1de926d313fff9machenbach@chromium.org}
108bcc36723a2ace28fa3b0d7dd0d1de926d313fff9machenbach@chromium.org
109bcc36723a2ace28fa3b0d7dd0d1de926d313fff9machenbach@chromium.org
110245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.orgvoid RelocInfo::PatchCode(byte* instructions, int instruction_count) {
11143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  // Patch the code at the current address with the supplied instructions.
11243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  for (int i = 0; i < instruction_count; i++) {
11343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    *(pc_ + i) = *(instructions + i);
11443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
1154af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org
1164af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  // Indicate that code has changed.
1175de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  CpuFeatures::FlushICache(pc_, instruction_count);
11843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
11943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
12043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
12143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Patch the code at the current PC with a call to the target address.
12243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Additional guard int3 instructions can be added if required.
123245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.orgvoid RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) {
12443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  // Call instruction takes up 5 bytes and int3 takes up one byte.
1254af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  static const int kCallCodeSize = 5;
1264af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  int code_size = kCallCodeSize + guard_bytes;
12743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1284af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  // Create a code patcher.
12943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  CodePatcher patcher(pc_, code_size);
1304af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org
1314af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  // Add a label for checking the size of the code used for returning.
1324af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org#ifdef DEBUG
1334af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  Label check_codesize;
1344af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  patcher.masm()->bind(&check_codesize);
1354af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org#endif
1364af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org
1374af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  // Patch the code.
13859297c735ad2a41156ae9c723a39ff259ad061e0jkummerow@chromium.org  patcher.masm()->call(target, RelocInfo::NONE32);
13943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1404af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  // Check that the size of the code generated is as expected.
141e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK_EQ(kCallCodeSize,
1424af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org            patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize));
1434af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org
14443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  // Add the requested number of int3 instructions after the call.
145e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK_GE(guard_bytes, 0);
14643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  for (int i = 0; i < guard_bytes; i++) {
14743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    patcher.masm()->int3();
14843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
14943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
15043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
15143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
15243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// -----------------------------------------------------------------------------
15343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Implementation of Operand
15443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
155236ad9617a7359a463144a6ebeb5431a70f769cfager@chromium.orgOperand::Operand(Register base, int32_t disp, RelocInfo::Mode rmode) {
15643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  // [base + disp/r]
15759297c735ad2a41156ae9c723a39ff259ad061e0jkummerow@chromium.org  if (disp == 0 && RelocInfo::IsNone(rmode) && !base.is(ebp)) {
15843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    // [base]
15943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_modrm(0, base);
16043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    if (base.is(esp)) set_sib(times_1, esp, base);
16159297c735ad2a41156ae9c723a39ff259ad061e0jkummerow@chromium.org  } else if (is_int8(disp) && RelocInfo::IsNone(rmode)) {
16243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    // [base + disp8]
16343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_modrm(1, base);
16443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    if (base.is(esp)) set_sib(times_1, esp, base);
16543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_disp8(disp);
16643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
16743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    // [base + disp/r]
16843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_modrm(2, base);
16943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    if (base.is(esp)) set_sib(times_1, esp, base);
17043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_dispr(disp, rmode);
17143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
17243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
17343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
17443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
17543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenOperand::Operand(Register base,
17643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen                 Register index,
17743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen                 ScaleFactor scale,
17843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen                 int32_t disp,
179236ad9617a7359a463144a6ebeb5431a70f769cfager@chromium.org                 RelocInfo::Mode rmode) {
180e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(!index.is(esp));  // illegal addressing mode
18143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  // [base + index*scale + disp/r]
18259297c735ad2a41156ae9c723a39ff259ad061e0jkummerow@chromium.org  if (disp == 0 && RelocInfo::IsNone(rmode) && !base.is(ebp)) {
18343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    // [base + index*scale]
18443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_modrm(0, esp);
18543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_sib(scale, index, base);
18659297c735ad2a41156ae9c723a39ff259ad061e0jkummerow@chromium.org  } else if (is_int8(disp) && RelocInfo::IsNone(rmode)) {
18743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    // [base + index*scale + disp8]
18843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_modrm(1, esp);
18943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_sib(scale, index, base);
19043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_disp8(disp);
19143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
19243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    // [base + index*scale + disp/r]
19343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_modrm(2, esp);
19443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_sib(scale, index, base);
19543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    set_dispr(disp, rmode);
19643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
19743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
19843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
19943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
20043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenOperand::Operand(Register index,
20143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen                 ScaleFactor scale,
20243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen                 int32_t disp,
203236ad9617a7359a463144a6ebeb5431a70f769cfager@chromium.org                 RelocInfo::Mode rmode) {
204e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(!index.is(esp));  // illegal addressing mode
20543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  // [index*scale + disp/r]
20643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  set_modrm(0, esp);
20743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  set_sib(scale, index, ebp);
20843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  set_dispr(disp, rmode);
20943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
21043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
21143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
21243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenbool Operand::is_reg(Register reg) const {
21343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  return ((buf_[0] & 0xF8) == 0xC0)  // addressing mode is register only.
21443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      && ((buf_[0] & 0x07) == reg.code());  // register codes match.
21543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
21643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
217c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com
218c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.combool Operand::is_reg_only() const {
219c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  return (buf_[0] & 0xF8) == 0xC0;  // Addressing mode is register only.
220c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com}
221c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com
222c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com
223c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.comRegister Operand::reg() const {
224e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(is_reg_only());
225c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  return Register::from_code(buf_[0] & 0x07);
226c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com}
227c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com
228c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com
22943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// -----------------------------------------------------------------------------
2305c838251403b0be9a882540f1922577abba4c872ager@chromium.org// Implementation of Assembler.
23143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
23243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Emit a single byte. Must always be inlined.
23343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen#define EMIT(x)                                 \
23443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  *pc_++ = (x)
23543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
23643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
23765dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org#ifdef GENERATED_CODE_COVERAGE
23865dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.orgstatic void InitCoverageLog();
23965dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org#endif
24065dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org
2418e8d8825f97138de12985f8e0d3163074dff5258ulan@chromium.orgAssembler::Assembler(Isolate* isolate, void* buffer, int buffer_size)
2428e8d8825f97138de12985f8e0d3163074dff5258ulan@chromium.org    : AssemblerBase(isolate, buffer, buffer_size),
243e4ac3ef2f6fa9300bc78c5a4cb7d4cb66ac6e83dmvstanton@chromium.org      positions_recorder_(this) {
24443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  // Clear the buffer in debug mode unless it was provided by the
24543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  // caller in which case we can't be sure it's okay to overwrite
24643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  // existing code in it; see CodePatcher::CodePatcher(...).
24765dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org#ifdef DEBUG
24865dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org  if (own_buffer_) {
2498e8d8825f97138de12985f8e0d3163074dff5258ulan@chromium.org    memset(buffer_, 0xCC, buffer_size_);  // int3
25043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
25165dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org#endif
25243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
2538e8d8825f97138de12985f8e0d3163074dff5258ulan@chromium.org  reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_);
25443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
25565dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org#ifdef GENERATED_CODE_COVERAGE
25665dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org  InitCoverageLog();
25765dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org#endif
25843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
25943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
26043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
26143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::GetCode(CodeDesc* desc) {
2625c838251403b0be9a882540f1922577abba4c872ager@chromium.org  // Finalize code (at this point overflow() may be true, but the gap ensures
2635c838251403b0be9a882540f1922577abba4c872ager@chromium.org  // that we are still not overlapping instructions and relocation info).
264e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(pc_ <= reloc_info_writer.pos());  // No overlap.
265f2038fb01417bcf7698b87a5dfaa4a861539618aerik.corry@gmail.com  // Set up code descriptor.
26643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  desc->buffer = buffer_;
26743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  desc->buffer_size = buffer_size_;
26843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  desc->instr_size = pc_offset();
26943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos();
27037abdec9cad6edeba05b5c7a9ff73c25f5df2b70christian.plesner.hansen@gmail.com  desc->origin = this;
27143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
27243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
27343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
27443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::Align(int m) {
27521d700eedcdd6570eff22ece724b63a5eefe78cbmachenbach@chromium.org  DCHECK(base::bits::IsPowerOfTwo32(m));
27664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  int mask = m - 1;
27764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  int addr = pc_offset();
27864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  Nop((m - (addr & mask)) & mask);
27964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org}
28064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
28164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
28264e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.orgbool Assembler::IsNop(Address addr) {
28364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  Address a = addr;
28464e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  while (*a == 0x66) a++;
28564e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  if (*a == 0x90) return true;
28664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  if (a[0] == 0xf && a[1] == 0x1f) return true;
28764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  return false;
28864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org}
28964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
29064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
29164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.orgvoid Assembler::Nop(int bytes) {
29264e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EnsureSpace ensure_space(this);
29364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
29464e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  // Multi byte nops from http://support.amd.com/us/Processor_TechDocs/40546.pdf
29564e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  while (bytes > 0) {
29664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org    switch (bytes) {
29764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 2:
29864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x66);
29964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 1:
30064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x90);
30164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        return;
30264e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 3:
30364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0xf);
30464e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x1f);
30564e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
30664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        return;
30764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 4:
30864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0xf);
30964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x1f);
31064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x40);
31164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
31264e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        return;
31364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 6:
31464e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x66);
31564e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 5:
31664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0xf);
31764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x1f);
31864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x44);
31964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
32064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
32164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        return;
32264e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 7:
32364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0xf);
32464e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x1f);
32564e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x80);
32664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
32764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
32864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
32964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
33064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        return;
33164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      default:
33264e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 11:
33364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x66);
33464e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        bytes--;
33564e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 10:
33664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x66);
33764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        bytes--;
33864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 9:
33964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x66);
34064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        bytes--;
34164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org      case 8:
34264e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0xf);
34364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x1f);
34464e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0x84);
34564e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
34664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
34764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
34864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
34964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        EMIT(0);
35064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org        bytes -= 8;
35164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org    }
35243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
35343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
35443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
35543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
3565ad5acef6bd4ebc785f946d8bcc2a88b1e031827ricow@chromium.orgvoid Assembler::CodeTargetAlign() {
3575ad5acef6bd4ebc785f946d8bcc2a88b1e031827ricow@chromium.org  Align(16);  // Preferred alignment of jump targets on ia32.
3585ad5acef6bd4ebc785f946d8bcc2a88b1e031827ricow@chromium.org}
3595ad5acef6bd4ebc785f946d8bcc2a88b1e031827ricow@chromium.org
3605ad5acef6bd4ebc785f946d8bcc2a88b1e031827ricow@chromium.org
36143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::cpuid() {
36243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
36343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
36443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xA2);
36543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
36643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
36743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
36843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::pushad() {
36943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
37043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x60);
37143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
37243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
37343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
37443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::popad() {
37543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
37643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x61);
37743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
37843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
37943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
38043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::pushfd() {
38143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
38243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x9C);
38343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
38443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
38543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
38643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::popfd() {
38743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
38843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x9D);
38943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
39043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
39143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
39243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::push(const Immediate& x) {
39343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
39443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  if (x.is_int8()) {
39543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0x6a);
39643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(x.x_);
39743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
39843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0x68);
39943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    emit(x);
40043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
40143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
40243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
40343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
404a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.orgvoid Assembler::push_imm32(int32_t imm32) {
405a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  EnsureSpace ensure_space(this);
406a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  EMIT(0x68);
407a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  emit(imm32);
408a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org}
409a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org
410a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org
41143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::push(Register src) {
41243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
41343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x50 | src.code());
41443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
41543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
41643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
41743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::push(const Operand& src) {
41843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
41943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xFF);
42043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(esi, src);
42143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
42243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
42343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
42443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::pop(Register dst) {
425e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(reloc_info_writer.last_pc() != NULL);
42643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
42743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x58 | dst.code());
42843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
42943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
43043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
43143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::pop(const Operand& dst) {
43243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
43343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x8F);
43443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(eax, dst);
43543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
43643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
43743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
438a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.orgvoid Assembler::enter(const Immediate& size) {
439a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EnsureSpace ensure_space(this);
440a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EMIT(0xC8);
441a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  emit_w(size);
442a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EMIT(0);
443a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org}
444a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
445a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
446a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.orgvoid Assembler::leave() {
447a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EnsureSpace ensure_space(this);
448a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EMIT(0xC9);
449a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org}
450a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
451a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
45243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov_b(Register dst, const Operand& src) {
45356454717593e7552d6846198b8e0f661fa36a3cayangguo@chromium.org  CHECK(dst.is_byte_register());
45443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
45543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x8A);
45643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
45743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
45843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
45943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
46043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov_b(const Operand& dst, int8_t imm8) {
46143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
46243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xC6);
46343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(eax, dst);
46443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(imm8);
46543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
46643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
46743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
46843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov_b(const Operand& dst, Register src) {
46956454717593e7552d6846198b8e0f661fa36a3cayangguo@chromium.org  CHECK(src.is_byte_register());
47043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
47143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x88);
47243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(src, dst);
47343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
47443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
47543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
47643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov_w(Register dst, const Operand& src) {
47743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
47843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x66);
47943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x8B);
48043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
48143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
48243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
48343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
48443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov_w(const Operand& dst, Register src) {
48543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
48643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x66);
48743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x89);
48843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(src, dst);
48943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
49043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
49143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
492e8412be858dc48afaec4959e42c5932f71a7f29bmachenbach@chromium.orgvoid Assembler::mov_w(const Operand& dst, int16_t imm16) {
493e8412be858dc48afaec4959e42c5932f71a7f29bmachenbach@chromium.org  EnsureSpace ensure_space(this);
494e8412be858dc48afaec4959e42c5932f71a7f29bmachenbach@chromium.org  EMIT(0x66);
495e8412be858dc48afaec4959e42c5932f71a7f29bmachenbach@chromium.org  EMIT(0xC7);
496e8412be858dc48afaec4959e42c5932f71a7f29bmachenbach@chromium.org  emit_operand(eax, dst);
497e8412be858dc48afaec4959e42c5932f71a7f29bmachenbach@chromium.org  EMIT(static_cast<int8_t>(imm16 & 0xff));
498e8412be858dc48afaec4959e42c5932f71a7f29bmachenbach@chromium.org  EMIT(static_cast<int8_t>(imm16 >> 8));
499e8412be858dc48afaec4959e42c5932f71a7f29bmachenbach@chromium.org}
500e8412be858dc48afaec4959e42c5932f71a7f29bmachenbach@chromium.org
501e8412be858dc48afaec4959e42c5932f71a7f29bmachenbach@chromium.org
50243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov(Register dst, int32_t imm32) {
50343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
50443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xB8 | dst.code());
50543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit(imm32);
50643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
50743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
50843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
5093bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.orgvoid Assembler::mov(Register dst, const Immediate& x) {
5103bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org  EnsureSpace ensure_space(this);
5113bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org  EMIT(0xB8 | dst.code());
5123bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org  emit(x);
5133bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org}
5143bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org
5153bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org
51643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov(Register dst, Handle<Object> handle) {
51743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
51843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xB8 | dst.code());
51943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit(handle);
52043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
52143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
52243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
52343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov(Register dst, const Operand& src) {
52443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
52543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x8B);
52643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
52743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
52843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
52943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
5303bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.orgvoid Assembler::mov(Register dst, Register src) {
5313bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org  EnsureSpace ensure_space(this);
5323bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org  EMIT(0x89);
5333bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org  EMIT(0xC0 | src.code() << 3 | dst.code());
5343bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org}
5353bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org
5363bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org
53743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov(const Operand& dst, const Immediate& x) {
53843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
53943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xC7);
54043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(eax, dst);
54143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit(x);
54243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
54343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
54443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
54543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov(const Operand& dst, Handle<Object> handle) {
54643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
54743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xC7);
54843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(eax, dst);
54943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit(handle);
55043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
55143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
55243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
55343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mov(const Operand& dst, Register src) {
55443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
55543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x89);
55643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(src, dst);
55743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
55843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
55943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
56043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::movsx_b(Register dst, const Operand& src) {
56143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
56243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
56343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xBE);
56443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
56543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
56643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
56743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
56843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::movsx_w(Register dst, const Operand& src) {
56943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
57043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
57143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xBF);
57243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
57343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
57443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
57543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
57643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::movzx_b(Register dst, const Operand& src) {
57743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
57843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
57943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xB6);
58043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
58143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
58243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
58343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
58443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::movzx_w(Register dst, const Operand& src) {
58543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
58643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
58743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xB7);
58843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
58943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
59043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
59143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
59243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::cmov(Condition cc, Register dst, const Operand& src) {
59343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
5945c838251403b0be9a882540f1922577abba4c872ager@chromium.org  // Opcode: 0f 40 + cc /r.
5954af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  EMIT(0x0F);
5964af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  EMIT(0x40 + cc);
5974af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  emit_operand(dst, src);
59843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
59943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
60043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
601ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.orgvoid Assembler::cld() {
602ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EnsureSpace ensure_space(this);
603ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0xFC);
604ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org}
605ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
606ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
6070c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.orgvoid Assembler::rep_movs() {
6080c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EnsureSpace ensure_space(this);
6090c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0xF3);
6100c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0xA5);
6110c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org}
6120c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
6130c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
614ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.orgvoid Assembler::rep_stos() {
615ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EnsureSpace ensure_space(this);
616ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0xF3);
617ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0xAB);
618ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org}
619ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
620ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
6219dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.comvoid Assembler::stos() {
6229dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com  EnsureSpace ensure_space(this);
6239dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com  EMIT(0xAB);
6249dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com}
6259dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com
6269dfbea4c7d423c7bc1db94425cb78e7f7cf41f78erik.corry@gmail.com
6277be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.orgvoid Assembler::xchg(Register dst, Register src) {
6287be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org  EnsureSpace ensure_space(this);
6295c838251403b0be9a882540f1922577abba4c872ager@chromium.org  if (src.is(eax) || dst.is(eax)) {  // Single-byte encoding.
6307be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org    EMIT(0x90 | (src.is(eax) ? dst.code() : src.code()));
6317be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org  } else {
6327be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org    EMIT(0x87);
6337be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org    EMIT(0xC0 | src.code() << 3 | dst.code());
6347be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org  }
6357be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org}
6367be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org
6377be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org
6387d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::xchg(Register dst, const Operand& src) {
6397d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  EnsureSpace ensure_space(this);
6407d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  EMIT(0x87);
6417d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  emit_operand(dst, src);
6427d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org}
6437d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org
6447d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org
64543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::adc(Register dst, int32_t imm32) {
64643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
64743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(2, Operand(dst), Immediate(imm32));
64843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
64943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
65043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
65143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::adc(Register dst, const Operand& src) {
65243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
65343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x13);
65443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
65543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
65643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
65743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
65843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::add(Register dst, const Operand& src) {
65943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
66043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x03);
66143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
66243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
66343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
66443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
665c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.comvoid Assembler::add(const Operand& dst, Register src) {
666c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  EnsureSpace ensure_space(this);
667c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  EMIT(0x01);
668c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  emit_operand(src, dst);
669c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com}
670c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com
671c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com
67243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::add(const Operand& dst, const Immediate& x) {
673e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(reloc_info_writer.last_pc() != NULL);
67443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
67543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(0, dst, x);
67643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
67743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
67843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
67943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::and_(Register dst, int32_t imm32) {
6802ec107fe650fe56eed094ca017940f26af46644bsgjesse@chromium.org  and_(dst, Immediate(imm32));
6812ec107fe650fe56eed094ca017940f26af46644bsgjesse@chromium.org}
6822ec107fe650fe56eed094ca017940f26af46644bsgjesse@chromium.org
6832ec107fe650fe56eed094ca017940f26af46644bsgjesse@chromium.org
6842ec107fe650fe56eed094ca017940f26af46644bsgjesse@chromium.orgvoid Assembler::and_(Register dst, const Immediate& x) {
68543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
6862ec107fe650fe56eed094ca017940f26af46644bsgjesse@chromium.org  emit_arith(4, Operand(dst), x);
68743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
68843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
68943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
69043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::and_(Register dst, const Operand& src) {
69143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
69243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x23);
69343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
69443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
69543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
69643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
69743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::and_(const Operand& dst, const Immediate& x) {
69843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
69943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(4, dst, x);
70043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
70143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
70243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
70343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::and_(const Operand& dst, Register src) {
70443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
70543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x21);
7063bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org  emit_operand(src, dst);
70743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
70843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
70943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
710a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.orgvoid Assembler::cmpb(const Operand& op, int8_t imm8) {
711a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EnsureSpace ensure_space(this);
712c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  if (op.is_reg(eax)) {
713c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com    EMIT(0x3C);
714c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  } else {
715c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com    EMIT(0x80);
716c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com    emit_operand(edi, op);  // edi == 7
717c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  }
718a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EMIT(imm8);
719a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org}
720a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
721a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
722c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.comvoid Assembler::cmpb(const Operand& op, Register reg) {
72356454717593e7552d6846198b8e0f661fa36a3cayangguo@chromium.org  CHECK(reg.is_byte_register());
724b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org  EnsureSpace ensure_space(this);
725b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org  EMIT(0x38);
726c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  emit_operand(reg, op);
727b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org}
728b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org
729b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org
730c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.comvoid Assembler::cmpb(Register reg, const Operand& op) {
73156454717593e7552d6846198b8e0f661fa36a3cayangguo@chromium.org  CHECK(reg.is_byte_register());
732b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org  EnsureSpace ensure_space(this);
733b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org  EMIT(0x3A);
734c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  emit_operand(reg, op);
735b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org}
736b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org
737b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org
738a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.orgvoid Assembler::cmpw(const Operand& op, Immediate imm16) {
739e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(imm16.is_int16());
740a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EnsureSpace ensure_space(this);
741a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EMIT(0x66);
742a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EMIT(0x81);
743a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  emit_operand(edi, op);
744a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  emit_w(imm16);
745a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org}
746a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
747a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
74843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::cmp(Register reg, int32_t imm32) {
74943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
75043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(7, Operand(reg), Immediate(imm32));
75143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
75243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
75343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
75443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::cmp(Register reg, Handle<Object> handle) {
75543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
75643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(7, Operand(reg), Immediate(handle));
75743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
75843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
75943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
76043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::cmp(Register reg, const Operand& op) {
76143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
76243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x3B);
76343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(reg, op);
76443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
76543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
76643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
76743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::cmp(const Operand& op, const Immediate& imm) {
76843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
76943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(7, op, imm);
77043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
77143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
77243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
7734af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.orgvoid Assembler::cmp(const Operand& op, Handle<Object> handle) {
7744af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  EnsureSpace ensure_space(this);
7754af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org  emit_arith(7, op, Immediate(handle));
7764af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org}
7774af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org
7784af710e493dc8583f3b7b7ce65127ad4e7c3f8a1ager@chromium.org
77937abdec9cad6edeba05b5c7a9ff73c25f5df2b70christian.plesner.hansen@gmail.comvoid Assembler::cmpb_al(const Operand& op) {
780a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EnsureSpace ensure_space(this);
78137abdec9cad6edeba05b5c7a9ff73c25f5df2b70christian.plesner.hansen@gmail.com  EMIT(0x38);  // CMP r/m8, r8
78237abdec9cad6edeba05b5c7a9ff73c25f5df2b70christian.plesner.hansen@gmail.com  emit_operand(eax, op);  // eax has same code as register al.
783a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org}
784a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
78537abdec9cad6edeba05b5c7a9ff73c25f5df2b70christian.plesner.hansen@gmail.com
78637abdec9cad6edeba05b5c7a9ff73c25f5df2b70christian.plesner.hansen@gmail.comvoid Assembler::cmpw_ax(const Operand& op) {
787a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EnsureSpace ensure_space(this);
78837abdec9cad6edeba05b5c7a9ff73c25f5df2b70christian.plesner.hansen@gmail.com  EMIT(0x66);
78937abdec9cad6edeba05b5c7a9ff73c25f5df2b70christian.plesner.hansen@gmail.com  EMIT(0x39);  // CMP r/m16, r16
79037abdec9cad6edeba05b5c7a9ff73c25f5df2b70christian.plesner.hansen@gmail.com  emit_operand(eax, op);  // eax has same code as register ax.
791a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org}
792a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
793a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
79443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::dec_b(Register dst) {
79556454717593e7552d6846198b8e0f661fa36a3cayangguo@chromium.org  CHECK(dst.is_byte_register());
79643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
79743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xFE);
79843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xC8 | dst.code());
79943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
80043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
80143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
8024a1fe7d5e92fdb673d5f05d5ddf7b1ed703ba18dwhesse@chromium.orgvoid Assembler::dec_b(const Operand& dst) {
8034a1fe7d5e92fdb673d5f05d5ddf7b1ed703ba18dwhesse@chromium.org  EnsureSpace ensure_space(this);
8044a1fe7d5e92fdb673d5f05d5ddf7b1ed703ba18dwhesse@chromium.org  EMIT(0xFE);
8054a1fe7d5e92fdb673d5f05d5ddf7b1ed703ba18dwhesse@chromium.org  emit_operand(ecx, dst);
8064a1fe7d5e92fdb673d5f05d5ddf7b1ed703ba18dwhesse@chromium.org}
8074a1fe7d5e92fdb673d5f05d5ddf7b1ed703ba18dwhesse@chromium.org
8084a1fe7d5e92fdb673d5f05d5ddf7b1ed703ba18dwhesse@chromium.org
80943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::dec(Register dst) {
81043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
81143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x48 | dst.code());
81243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
81343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
81443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
81543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::dec(const Operand& dst) {
81643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
81743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xFF);
81843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(ecx, dst);
81943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
82043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
82143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
82243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::cdq() {
82343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
82443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x99);
82543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
82643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
82743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
8287d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::idiv(const Operand& src) {
8297d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  EnsureSpace ensure_space(this);
8307d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  EMIT(0xF7);
8317d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  emit_operand(edi, src);
8327d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org}
8337d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org
8347d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org
8357d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::div(const Operand& src) {
83643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
83743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF7);
8387d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  emit_operand(esi, src);
83943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
84043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
84143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
8422abc450936e88b5c98a5e9d43ee6230ccc748272kasperl@chromium.orgvoid Assembler::imul(Register reg) {
8432abc450936e88b5c98a5e9d43ee6230ccc748272kasperl@chromium.org  EnsureSpace ensure_space(this);
8442abc450936e88b5c98a5e9d43ee6230ccc748272kasperl@chromium.org  EMIT(0xF7);
8452abc450936e88b5c98a5e9d43ee6230ccc748272kasperl@chromium.org  EMIT(0xE8 | reg.code());
8462abc450936e88b5c98a5e9d43ee6230ccc748272kasperl@chromium.org}
8472abc450936e88b5c98a5e9d43ee6230ccc748272kasperl@chromium.org
8482abc450936e88b5c98a5e9d43ee6230ccc748272kasperl@chromium.org
84943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::imul(Register dst, const Operand& src) {
85043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
85143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
85243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xAF);
85343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
85443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
85543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
85643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
85743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::imul(Register dst, Register src, int32_t imm32) {
8587d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  imul(dst, Operand(src), imm32);
8597d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org}
8607d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org
8617d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org
8627d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::imul(Register dst, const Operand& src, int32_t imm32) {
86343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
86443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  if (is_int8(imm32)) {
86543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0x6B);
8667d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org    emit_operand(dst, src);
86743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(imm32);
86843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
86943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0x69);
8707d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org    emit_operand(dst, src);
87143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    emit(imm32);
87243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
87343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
87443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
87543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
87643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::inc(Register dst) {
87743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
87843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x40 | dst.code());
87943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
88043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
88143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
88243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::inc(const Operand& dst) {
88343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
88443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xFF);
88543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(eax, dst);
88643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
88743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
88843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
88943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::lea(Register dst, const Operand& src) {
89043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
89143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x8D);
89243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
89343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
89443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
89543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
89643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mul(Register src) {
89743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
89843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF7);
89943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE0 | src.code());
90043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
90143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
90243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
90343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::neg(Register dst) {
90443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
90543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF7);
90643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD8 | dst.code());
90743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
90843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
90943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
9107d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::neg(const Operand& dst) {
9117d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  EnsureSpace ensure_space(this);
9127d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  EMIT(0xF7);
9137d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  emit_operand(ebx, dst);
9147d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org}
9157d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org
9167d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org
91743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::not_(Register dst) {
91843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
91943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF7);
92043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD0 | dst.code());
92143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
92243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
92343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
9247d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::not_(const Operand& dst) {
9257d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  EnsureSpace ensure_space(this);
9267d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  EMIT(0xF7);
9277d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  emit_operand(edx, dst);
9287d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org}
9297d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org
9307d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org
93143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::or_(Register dst, int32_t imm32) {
93243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
93343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(1, Operand(dst), Immediate(imm32));
93443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
93543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
93643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
93743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::or_(Register dst, const Operand& src) {
93843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
93943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0B);
94043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
94143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
94243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
94343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
94443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::or_(const Operand& dst, const Immediate& x) {
94543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
94643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(1, dst, x);
94743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
94843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
94943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
95043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::or_(const Operand& dst, Register src) {
95143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
95243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x09);
9533bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org  emit_operand(src, dst);
95443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
95543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
95643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
95743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::rcl(Register dst, uint8_t imm8) {
95843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
959e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(is_uint5(imm8));  // illegal shift count
96043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  if (imm8 == 1) {
96143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xD1);
96243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xD0 | dst.code());
96343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
96443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xC1);
96543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xD0 | dst.code());
96643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(imm8);
96743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
96843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
96943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
97043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
97126c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.orgvoid Assembler::rcr(Register dst, uint8_t imm8) {
97226c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org  EnsureSpace ensure_space(this);
973e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(is_uint5(imm8));  // illegal shift count
97426c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org  if (imm8 == 1) {
97526c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org    EMIT(0xD1);
97626c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org    EMIT(0xD8 | dst.code());
97726c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org  } else {
97826c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org    EMIT(0xC1);
97926c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org    EMIT(0xD8 | dst.code());
98026c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org    EMIT(imm8);
98126c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org  }
98226c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org}
98326c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org
984e0e1b0d3e70c933d36ed381d511e9fda39f2a751mstarzinger@chromium.org
985e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.orgvoid Assembler::ror(Register dst, uint8_t imm8) {
986e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org  EnsureSpace ensure_space(this);
987e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(is_uint5(imm8));  // illegal shift count
988e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org  if (imm8 == 1) {
989e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org    EMIT(0xD1);
990e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org    EMIT(0xC8 | dst.code());
991e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org  } else {
992e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org    EMIT(0xC1);
993e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org    EMIT(0xC8 | dst.code());
994e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org    EMIT(imm8);
995e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org  }
996e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org}
997e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org
998e0e1b0d3e70c933d36ed381d511e9fda39f2a751mstarzinger@chromium.org
999e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.orgvoid Assembler::ror_cl(Register dst) {
1000e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org  EnsureSpace ensure_space(this);
1001e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org  EMIT(0xD3);
1002e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org  EMIT(0xC8 | dst.code());
1003e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org}
1004e4ee6de0de64744d55b63da83156827c989c7099verwaest@chromium.org
100526c16f8ef35ec25d36420512a4ceaa74ea2e2b05vegorov@chromium.org
10067d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::sar(const Operand& dst, uint8_t imm8) {
100743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1008e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(is_uint5(imm8));  // illegal shift count
100943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  if (imm8 == 1) {
101043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xD1);
10117d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org    emit_operand(edi, dst);
101243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
101343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xC1);
10147d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org    emit_operand(edi, dst);
101543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(imm8);
101643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
101743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
101843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
101943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
10207d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::sar_cl(const Operand& dst) {
102143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
102243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD3);
10237d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  emit_operand(edi, dst);
102443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
102543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
102643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
102743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::sbb(Register dst, const Operand& src) {
102843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
102943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x1B);
103043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
103143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
103243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
103343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
103443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::shld(Register dst, const Operand& src) {
103543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
103643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
103743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xA5);
103843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
103943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
104043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
104143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
10427d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::shl(const Operand& dst, uint8_t imm8) {
104343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1044e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(is_uint5(imm8));  // illegal shift count
104543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  if (imm8 == 1) {
104643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xD1);
10477d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org    emit_operand(esp, dst);
104843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
104943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xC1);
10507d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org    emit_operand(esp, dst);
105143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(imm8);
105243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
105343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
105443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
105543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
10567d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::shl_cl(const Operand& dst) {
105743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
105843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD3);
10597d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  emit_operand(esp, dst);
106043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
106143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
106243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
106343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::shrd(Register dst, const Operand& src) {
106443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
106543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
106643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xAD);
106743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
106843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
106943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
107043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
10717d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::shr(const Operand& dst, uint8_t imm8) {
107243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1073e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(is_uint5(imm8));  // illegal shift count
1074c4c927273ae2b690c4a015b4640a2a469c9a1a69ager@chromium.org  if (imm8 == 1) {
1075c4c927273ae2b690c4a015b4640a2a469c9a1a69ager@chromium.org    EMIT(0xD1);
10767d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org    emit_operand(ebp, dst);
1077c4c927273ae2b690c4a015b4640a2a469c9a1a69ager@chromium.org  } else {
1078c4c927273ae2b690c4a015b4640a2a469c9a1a69ager@chromium.org    EMIT(0xC1);
10797d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org    emit_operand(ebp, dst);
1080c4c927273ae2b690c4a015b4640a2a469c9a1a69ager@chromium.org    EMIT(imm8);
1081c4c927273ae2b690c4a015b4640a2a469c9a1a69ager@chromium.org  }
108243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
108343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
108443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
10857d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.orgvoid Assembler::shr_cl(const Operand& dst) {
1086a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EnsureSpace ensure_space(this);
1087c4c927273ae2b690c4a015b4640a2a469c9a1a69ager@chromium.org  EMIT(0xD3);
10887d299ad4dc0ca26e0017b190b48362ad71328ce4machenbach@chromium.org  emit_operand(ebp, dst);
1089a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org}
1090a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
1091a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
109243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::sub(const Operand& dst, const Immediate& x) {
109343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
109443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(5, dst, x);
109543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
109643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
109743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
109843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::sub(Register dst, const Operand& src) {
109943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
110043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x2B);
110143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
110243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
110343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
110443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
110543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::sub(const Operand& dst, Register src) {
110643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
110743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x29);
11083bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org  emit_operand(src, dst);
110943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
111043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
111143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
111243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::test(Register reg, const Immediate& imm) {
11133d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  if (RelocInfo::IsNone(imm.rmode_) && is_uint8(imm.x_)) {
11143d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    test_b(reg, imm.x_);
11153d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    return;
11163d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  }
11173d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org
111843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
11193d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  // This is not using emit_arith because test doesn't support
11203d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  // sign-extension of 8-bit operands.
11213d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  if (reg.is(eax)) {
11223d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    EMIT(0xA9);
112343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
11243d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    EMIT(0xF7);
11253d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    EMIT(0xC0 | reg.code());
112643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
11273d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  emit(imm);
112843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
112943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
113043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
113143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::test(Register reg, const Operand& op) {
113243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
113343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x85);
113443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(reg, op);
113543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
113643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
113743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1138b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.orgvoid Assembler::test_b(Register reg, const Operand& op) {
113956454717593e7552d6846198b8e0f661fa36a3cayangguo@chromium.org  CHECK(reg.is_byte_register());
1140b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org  EnsureSpace ensure_space(this);
1141b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org  EMIT(0x84);
1142b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org  emit_operand(reg, op);
1143b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org}
1144b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org
1145b302e56e5b70c4504faa2adf4ec3efb64a9d3e38sgjesse@chromium.org
114643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::test(const Operand& op, const Immediate& imm) {
1147594006017e46d82ed7146611dc12c20e3c509c7ddanno@chromium.org  if (op.is_reg_only()) {
1148594006017e46d82ed7146611dc12c20e3c509c7ddanno@chromium.org    test(op.reg(), imm);
1149594006017e46d82ed7146611dc12c20e3c509c7ddanno@chromium.org    return;
1150594006017e46d82ed7146611dc12c20e3c509c7ddanno@chromium.org  }
11513d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  if (RelocInfo::IsNone(imm.rmode_) && is_uint8(imm.x_)) {
11523d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    return test_b(op, imm.x_);
11533d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  }
115443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
115543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF7);
115643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(eax, op);
115743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit(imm);
115843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
115943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
116043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
11613d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.orgvoid Assembler::test_b(Register reg, uint8_t imm8) {
11623d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  EnsureSpace ensure_space(this);
11633d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  // Only use test against byte for registers that have a byte
11643d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  // variant: eax, ebx, ecx, and edx.
11653d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  if (reg.is(eax)) {
11663d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    EMIT(0xA8);
11673d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    EMIT(imm8);
11683d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  } else if (reg.is_byte_register()) {
11693d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    emit_arith_b(0xF6, 0xC0, reg, imm8);
11703d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  } else {
11713d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    EMIT(0xF7);
11723d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    EMIT(0xC0 | reg.code());
11733d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    emit(imm8);
11743d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  }
11753d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org}
11763d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org
11773d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org
11781af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.orgvoid Assembler::test_b(const Operand& op, uint8_t imm8) {
11793d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  if (op.is_reg_only()) {
11803d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org    test_b(op.reg(), imm8);
1181c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com    return;
1182c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  }
11831af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EnsureSpace ensure_space(this);
11841af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(0xF6);
11851af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  emit_operand(eax, op);
11861af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(imm8);
11871af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org}
11881af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org
11891af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org
119043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::xor_(Register dst, int32_t imm32) {
119143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
119243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(6, Operand(dst), Immediate(imm32));
119343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
119443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
119543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
119643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::xor_(Register dst, const Operand& src) {
119743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
119843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x33);
119943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
120043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
120143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
120243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1203c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.comvoid Assembler::xor_(const Operand& dst, Register src) {
120443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
120543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x31);
1206c3b670ff19220959730d7886892bc4beb95d2ebaerik.corry@gmail.com  emit_operand(src, dst);
120743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
120843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
120943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
121043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::xor_(const Operand& dst, const Immediate& x) {
121143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
121243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_arith(6, dst, x);
121343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
121443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
121543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1216a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.orgvoid Assembler::bt(const Operand& dst, Register src) {
1217a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EnsureSpace ensure_space(this);
1218a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EMIT(0x0F);
1219a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  EMIT(0xA3);
1220a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org  emit_operand(src, dst);
1221a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org}
1222a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
1223a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org
122443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::bts(const Operand& dst, Register src) {
122543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
122643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
122743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xAB);
122843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(src, dst);
122943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
123043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
123143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1232f5a24546072ecdbbd6372c85c42157e01e913561titzer@chromium.orgvoid Assembler::bsr(Register dst, const Operand& src) {
1233f5a24546072ecdbbd6372c85c42157e01e913561titzer@chromium.org  EnsureSpace ensure_space(this);
1234f5a24546072ecdbbd6372c85c42157e01e913561titzer@chromium.org  EMIT(0x0F);
1235f5a24546072ecdbbd6372c85c42157e01e913561titzer@chromium.org  EMIT(0xBD);
1236f5a24546072ecdbbd6372c85c42157e01e913561titzer@chromium.org  emit_operand(dst, src);
1237f5a24546072ecdbbd6372c85c42157e01e913561titzer@chromium.org}
1238f5a24546072ecdbbd6372c85c42157e01e913561titzer@chromium.org
1239f5a24546072ecdbbd6372c85c42157e01e913561titzer@chromium.org
124043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::hlt() {
124143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
124243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF4);
124343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
124443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
124543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
124643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::int3() {
124743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
124843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xCC);
124943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
125043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
125143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
125243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::nop() {
125343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
125443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x90);
125543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
125643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
125743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
125843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::ret(int imm16) {
125943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1260e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(is_uint16(imm16));
126143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  if (imm16 == 0) {
126243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xC3);
126343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
126443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xC2);
126543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(imm16 & 0xFF);
126643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT((imm16 >> 8) & 0xFF);
126743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
126843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
126943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
127043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
127143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Labels refer to positions in the (to be) generated code.
127243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// There are bound, linked, and unused labels.
127343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen//
127443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Bound labels refer to known positions in the already
127543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// generated code. pos() is the position the label refers to.
127643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen//
127743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Linked labels refer to unknown positions in the code
127843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// to be generated; pos() is the position of the 32bit
127943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen// Displacement of the last instruction using the label.
128043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
128143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
128243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::print(Label* L) {
128343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  if (L->is_unused()) {
128443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    PrintF("unused label\n");
128543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else if (L->is_bound()) {
128643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    PrintF("bound label to %d\n", L->pos());
128743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else if (L->is_linked()) {
128843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    Label l = *L;
128943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    PrintF("unbound label");
129043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    while (l.is_linked()) {
129143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      Displacement disp = disp_at(&l);
129243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      PrintF("@ %d ", l.pos());
129343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      disp.print();
129443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      PrintF("\n");
129543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      disp.next(&l);
129643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    }
129743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
129843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    PrintF("label in inconsistent state (pos = %d)\n", L->pos_);
129943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
130043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
130143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
130243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
130343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::bind_to(Label* L, int pos) {
130443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1305e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(0 <= pos && pos <= pc_offset());  // must have a valid binding position
130643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  while (L->is_linked()) {
130743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    Displacement disp = disp_at(L);
130843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    int fixup_pos = L->pos();
1309a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org    if (disp.type() == Displacement::CODE_RELATIVE) {
1310a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org      // Relative to Code* heap object pointer.
1311a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org      long_at_put(fixup_pos, pos + Code::kHeaderSize - kHeapObjectTag);
1312a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org    } else {
1313a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org      if (disp.type() == Displacement::UNCONDITIONAL_JUMP) {
1314e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org        DCHECK(byte_at(fixup_pos - 1) == 0xE9);  // jmp expected
1315a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org      }
13165c838251403b0be9a882540f1922577abba4c872ager@chromium.org      // Relative address, relative to point after address.
1317a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org      int imm32 = pos - (fixup_pos + sizeof(int32_t));
1318a74f0daeb278665869b4b6a3bc2739e88fed93b1ager@chromium.org      long_at_put(fixup_pos, imm32);
131943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    }
132043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    disp.next(L);
132143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
132283a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org  while (L->is_near_linked()) {
132383a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    int fixup_pos = L->near_link_pos();
132483a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    int offset_to_next =
132583a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org        static_cast<int>(*reinterpret_cast<int8_t*>(addr_at(fixup_pos)));
1326e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org    DCHECK(offset_to_next <= 0);
132783a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    // Relative address, relative to point after address.
132883a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    int disp = pos - fixup_pos - sizeof(int8_t);
13299c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org    CHECK(0 <= disp && disp <= 127);
133083a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    set_byte_at(fixup_pos, disp);
133183a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    if (offset_to_next < 0) {
133283a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org      L->link_to(fixup_pos + offset_to_next, Label::kNear);
133383a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    } else {
133483a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org      L->UnuseNear();
133583a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    }
133683a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org  }
133743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  L->bind_to(pos);
133843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
133943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
134043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
134143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::bind(Label* L) {
134243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1343e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(!L->is_bound());  // label can only be bound once
134443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  bind_to(L, pc_offset());
134543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
134643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
134743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
134843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::call(Label* L) {
1349a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  positions_recorder()->WriteRecordedPositions();
135043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
135143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  if (L->is_bound()) {
135243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    const int long_size = 5;
135343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    int offs = L->pos() - pc_offset();
1354e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org    DCHECK(offs <= 0);
13555c838251403b0be9a882540f1922577abba4c872ager@chromium.org    // 1110 1000 #32-bit disp.
135643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xE8);
135743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    emit(offs - long_size);
135843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
13595c838251403b0be9a882540f1922577abba4c872ager@chromium.org    // 1110 1000 #32-bit disp.
136043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xE8);
136143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    emit_disp(L, Displacement::OTHER);
136243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
136343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
136443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
136543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1366236ad9617a7359a463144a6ebeb5431a70f769cfager@chromium.orgvoid Assembler::call(byte* entry, RelocInfo::Mode rmode) {
1367a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  positions_recorder()->WriteRecordedPositions();
136843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1369e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(!RelocInfo::IsCodeTarget(rmode));
137043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE8);
13716e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org  if (RelocInfo::IsRuntimeEntry(rmode)) {
13726e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org    emit(reinterpret_cast<uint32_t>(entry), rmode);
13736e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org  } else {
13746e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org    emit(entry - (pc_ + sizeof(int32_t)), rmode);
13756e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org  }
137643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
137743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
137843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1379fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.orgint Assembler::CallSize(const Operand& adr) {
1380fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org  // Call size is 1 (opcode) + adr.len_ (operand).
1381fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org  return 1 + adr.len_;
1382fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org}
1383fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org
1384fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org
138543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::call(const Operand& adr) {
1386a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  positions_recorder()->WriteRecordedPositions();
138743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
138843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xFF);
138943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(edx, adr);
1390fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org}
1391fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org
1392fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org
1393fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.orgint Assembler::CallSize(Handle<Code> code, RelocInfo::Mode rmode) {
1394fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org  return 1 /* EMIT */ + sizeof(uint32_t) /* emit */;
139543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
139643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
139743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
13988e8294a88dc7d58f579aee0ba08c19fc8a616e2dsgjesse@chromium.orgvoid Assembler::call(Handle<Code> code,
13998e8294a88dc7d58f579aee0ba08c19fc8a616e2dsgjesse@chromium.org                     RelocInfo::Mode rmode,
1400471f2f1d24adb4bad1edc3bf0ee35092486de187mstarzinger@chromium.org                     TypeFeedbackId ast_id) {
1401f0ac72dfa39ec827de605aafc57d4834237aa7f3whesse@chromium.org  positions_recorder()->WriteRecordedPositions();
140243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1403e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(RelocInfo::IsCodeTarget(rmode)
1404c9913f099d68d3604e53b19d0fc5abe309143bdcbmeurer@chromium.org      || rmode == RelocInfo::CODE_AGE_SEQUENCE);
140543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE8);
140632d7dbafe29be06cec1edd36c31fbe2865c799f4ulan@chromium.org  emit(code, rmode, ast_id);
140743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
140843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
140943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
141083a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.orgvoid Assembler::jmp(Label* L, Label::Distance distance) {
141143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
141243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  if (L->is_bound()) {
141343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    const int short_size = 2;
141443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    const int long_size  = 5;
141543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    int offs = L->pos() - pc_offset();
1416e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org    DCHECK(offs <= 0);
141743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    if (is_int8(offs - short_size)) {
14185c838251403b0be9a882540f1922577abba4c872ager@chromium.org      // 1110 1011 #8-bit disp.
141943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      EMIT(0xEB);
142043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      EMIT((offs - short_size) & 0xFF);
142143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    } else {
14225c838251403b0be9a882540f1922577abba4c872ager@chromium.org      // 1110 1001 #32-bit disp.
142343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      EMIT(0xE9);
142443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      emit(offs - long_size);
142543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    }
142683a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org  } else if (distance == Label::kNear) {
142783a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    EMIT(0xEB);
142883a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    emit_near_disp(L);
142943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
14305c838251403b0be9a882540f1922577abba4c872ager@chromium.org    // 1110 1001 #32-bit disp.
143143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0xE9);
143243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    emit_disp(L, Displacement::UNCONDITIONAL_JUMP);
143343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
143443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
143543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
143643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1437236ad9617a7359a463144a6ebeb5431a70f769cfager@chromium.orgvoid Assembler::jmp(byte* entry, RelocInfo::Mode rmode) {
143843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1439e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(!RelocInfo::IsCodeTarget(rmode));
144043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE9);
14416e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org  if (RelocInfo::IsRuntimeEntry(rmode)) {
14426e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org    emit(reinterpret_cast<uint32_t>(entry), rmode);
14436e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org  } else {
14446e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org    emit(entry - (pc_ + sizeof(int32_t)), rmode);
14456e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org  }
144643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
144743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
144843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
144943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::jmp(const Operand& adr) {
145043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
145143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xFF);
145243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(esp, adr);
145343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
145443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
145543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1456236ad9617a7359a463144a6ebeb5431a70f769cfager@chromium.orgvoid Assembler::jmp(Handle<Code> code, RelocInfo::Mode rmode) {
145743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1458e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(RelocInfo::IsCodeTarget(rmode));
145943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE9);
146032d7dbafe29be06cec1edd36c31fbe2865c799f4ulan@chromium.org  emit(code, rmode);
146143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
146243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
146343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
14647304bcac06a6a63b9f3dcebac2eeceada87ca146vegorov@chromium.orgvoid Assembler::j(Condition cc, Label* L, Label::Distance distance) {
146543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1466e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(0 <= cc && static_cast<int>(cc) < 16);
146743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  if (L->is_bound()) {
146843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    const int short_size = 2;
146943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    const int long_size  = 6;
147043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    int offs = L->pos() - pc_offset();
1471e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org    DCHECK(offs <= 0);
147243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    if (is_int8(offs - short_size)) {
147343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      // 0111 tttn #8-bit disp
147443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      EMIT(0x70 | cc);
147543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      EMIT((offs - short_size) & 0xFF);
147643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    } else {
147743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      // 0000 1111 1000 tttn #32-bit disp
147843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      EMIT(0x0F);
147943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      EMIT(0x80 | cc);
148043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen      emit(offs - long_size);
148143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    }
148283a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org  } else if (distance == Label::kNear) {
148383a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    EMIT(0x70 | cc);
148483a4728861129dc263ded92157f3e6389f851f19karlklose@chromium.org    emit_near_disp(L);
148543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  } else {
148643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    // 0000 1111 1000 tttn #32-bit disp
148743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    // Note: could eliminate cond. jumps to this jump if condition
148843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    //       is the same however, seems to be rather unlikely case.
148943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0x0F);
149043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    EMIT(0x80 | cc);
149143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen    emit_disp(L, Displacement::OTHER);
149243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  }
149343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
149443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
149543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
14967304bcac06a6a63b9f3dcebac2eeceada87ca146vegorov@chromium.orgvoid Assembler::j(Condition cc, byte* entry, RelocInfo::Mode rmode) {
149743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
1498e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK((0 <= cc) && (static_cast<int>(cc) < 16));
14995c838251403b0be9a882540f1922577abba4c872ager@chromium.org  // 0000 1111 1000 tttn #32-bit disp.
150043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
150143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x80 | cc);
15026e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org  if (RelocInfo::IsRuntimeEntry(rmode)) {
15036e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org    emit(reinterpret_cast<uint32_t>(entry), rmode);
15046e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org  } else {
15056e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org    emit(entry - (pc_ + sizeof(int32_t)), rmode);
15066e196bfaf0e555d0c835390bb6ebc0a74484491dulan@chromium.org  }
150743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
150843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
150943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
15107304bcac06a6a63b9f3dcebac2eeceada87ca146vegorov@chromium.orgvoid Assembler::j(Condition cc, Handle<Code> code) {
151143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
151243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  // 0000 1111 1000 tttn #32-bit disp
151343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
151443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x80 | cc);
151532d7dbafe29be06cec1edd36c31fbe2865c799f4ulan@chromium.org  emit(code, RelocInfo::CODE_TARGET);
151643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
151743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
151843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
15195c838251403b0be9a882540f1922577abba4c872ager@chromium.org// FPU instructions.
152043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
152143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fld(int i) {
152243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
152343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xD9, 0xC0, i);
152443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
152543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
152643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1527ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.orgvoid Assembler::fstp(int i) {
1528ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EnsureSpace ensure_space(this);
1529ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  emit_farith(0xDD, 0xD8, i);
1530ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org}
1531ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
1532ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
153343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fld1() {
153443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
153543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
153643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE8);
153743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
153843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
153943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1540ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.orgvoid Assembler::fldpi() {
1541ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EnsureSpace ensure_space(this);
1542ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0xD9);
1543ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0xEB);
1544ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org}
1545ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
1546ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
154743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fldz() {
154843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
154943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
155043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xEE);
155143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
155243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
155343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1554a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.orgvoid Assembler::fldln2() {
1555a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  EnsureSpace ensure_space(this);
1556a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  EMIT(0xD9);
1557a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  EMIT(0xED);
1558a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org}
1559a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org
1560a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org
156143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fld_s(const Operand& adr) {
156243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
156343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
156443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(eax, adr);
156543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
156643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
156743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
156843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fld_d(const Operand& adr) {
156943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
157043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xDD);
157143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(eax, adr);
157243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
157343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
157443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
157543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fstp_s(const Operand& adr) {
157643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
157743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
157843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(ebx, adr);
157943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
158043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
158143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
158232cb9b2c195baa85d4c04f4c7b22b9aa04e97d3fverwaest@chromium.orgvoid Assembler::fst_s(const Operand& adr) {
158332cb9b2c195baa85d4c04f4c7b22b9aa04e97d3fverwaest@chromium.org  EnsureSpace ensure_space(this);
158432cb9b2c195baa85d4c04f4c7b22b9aa04e97d3fverwaest@chromium.org  EMIT(0xD9);
158532cb9b2c195baa85d4c04f4c7b22b9aa04e97d3fverwaest@chromium.org  emit_operand(edx, adr);
158632cb9b2c195baa85d4c04f4c7b22b9aa04e97d3fverwaest@chromium.org}
158732cb9b2c195baa85d4c04f4c7b22b9aa04e97d3fverwaest@chromium.org
158832cb9b2c195baa85d4c04f4c7b22b9aa04e97d3fverwaest@chromium.org
158943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fstp_d(const Operand& adr) {
159043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
159143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xDD);
159243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(ebx, adr);
159343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
159443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
159543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1596ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.orgvoid Assembler::fst_d(const Operand& adr) {
1597ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EnsureSpace ensure_space(this);
1598ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0xDD);
1599ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  emit_operand(edx, adr);
1600ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org}
1601ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
1602ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
160343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fild_s(const Operand& adr) {
160443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
160543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xDB);
160643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(eax, adr);
160743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
160843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
160943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
161043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fild_d(const Operand& adr) {
161143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
161243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xDF);
161343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(ebp, adr);
161443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
161543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
161643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
161743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fistp_s(const Operand& adr) {
161843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
161943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xDB);
162043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(ebx, adr);
162143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
162243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
162343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1624061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.orgvoid Assembler::fisttp_s(const Operand& adr) {
1625e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(IsEnabled(SSE3));
1626061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org  EnsureSpace ensure_space(this);
1627061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org  EMIT(0xDB);
1628061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org  emit_operand(ecx, adr);
1629061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org}
1630061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org
1631061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org
16320c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.orgvoid Assembler::fisttp_d(const Operand& adr) {
1633e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(IsEnabled(SSE3));
16340c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EnsureSpace ensure_space(this);
16350c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0xDD);
16360c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  emit_operand(ecx, adr);
16370c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org}
16380c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
16390c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
164043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fist_s(const Operand& adr) {
164143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
164243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xDB);
164343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(edx, adr);
164443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
164543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
164643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
164743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fistp_d(const Operand& adr) {
164843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
164943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xDF);
165043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(edi, adr);
165143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
165243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
165343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
165443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fabs() {
165543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
165643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
165743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE1);
165843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
165943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
166043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
166143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fchs() {
166243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
166343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
166443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE0);
166543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
166643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
166743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1668eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.orgvoid Assembler::fcos() {
1669eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org  EnsureSpace ensure_space(this);
1670eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org  EMIT(0xD9);
1671eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org  EMIT(0xFF);
1672eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org}
1673eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org
1674eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org
1675eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.orgvoid Assembler::fsin() {
1676eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org  EnsureSpace ensure_space(this);
1677eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org  EMIT(0xD9);
1678eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org  EMIT(0xFE);
1679eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org}
1680eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org
1681eadaf2282ee421d7a63a21d71369b029105341ccager@chromium.org
16821b3afd1cab9087ca3c4e585d3da77d374d65c082mstarzinger@chromium.orgvoid Assembler::fptan() {
16831b3afd1cab9087ca3c4e585d3da77d374d65c082mstarzinger@chromium.org  EnsureSpace ensure_space(this);
16841b3afd1cab9087ca3c4e585d3da77d374d65c082mstarzinger@chromium.org  EMIT(0xD9);
16851b3afd1cab9087ca3c4e585d3da77d374d65c082mstarzinger@chromium.org  EMIT(0xF2);
16861b3afd1cab9087ca3c4e585d3da77d374d65c082mstarzinger@chromium.org}
16871b3afd1cab9087ca3c4e585d3da77d374d65c082mstarzinger@chromium.org
16881b3afd1cab9087ca3c4e585d3da77d374d65c082mstarzinger@chromium.org
1689a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.orgvoid Assembler::fyl2x() {
1690a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  EnsureSpace ensure_space(this);
1691a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  EMIT(0xD9);
1692a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org  EMIT(0xF1);
1693a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org}
1694a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org
1695a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org
169664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.orgvoid Assembler::f2xm1() {
169764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EnsureSpace ensure_space(this);
169864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EMIT(0xD9);
169964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EMIT(0xF0);
170064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org}
170164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
170264e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
170364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.orgvoid Assembler::fscale() {
170464e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EnsureSpace ensure_space(this);
170564e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EMIT(0xD9);
170664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EMIT(0xFD);
170764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org}
170864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
170964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
171064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.orgvoid Assembler::fninit() {
171164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EnsureSpace ensure_space(this);
171264e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EMIT(0xDB);
171364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EMIT(0xE3);
171464e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org}
171564e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
171664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
171743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fadd(int i) {
171843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
171943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDC, 0xC0, i);
172043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
172143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
172243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1723c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.orgvoid Assembler::fadd_i(int i) {
1724c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org  EnsureSpace ensure_space(this);
1725c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org  emit_farith(0xD8, 0xC0, i);
1726c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org}
1727c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org
1728c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org
172943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fsub(int i) {
173043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
173143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDC, 0xE8, i);
173243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
173343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
173443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1735c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.orgvoid Assembler::fsub_i(int i) {
1736c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org  EnsureSpace ensure_space(this);
1737c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org  emit_farith(0xD8, 0xE0, i);
1738c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org}
1739c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org
1740c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org
174143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fisub_s(const Operand& adr) {
174243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
174343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xDA);
174443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(esp, adr);
174543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
174643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
174743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1748169691d93a961c8b511f8ac8fd8ee33d081ca10fdanno@chromium.orgvoid Assembler::fmul_i(int i) {
1749169691d93a961c8b511f8ac8fd8ee33d081ca10fdanno@chromium.org  EnsureSpace ensure_space(this);
1750169691d93a961c8b511f8ac8fd8ee33d081ca10fdanno@chromium.org  emit_farith(0xD8, 0xC8, i);
1751169691d93a961c8b511f8ac8fd8ee33d081ca10fdanno@chromium.org}
1752169691d93a961c8b511f8ac8fd8ee33d081ca10fdanno@chromium.org
1753169691d93a961c8b511f8ac8fd8ee33d081ca10fdanno@chromium.org
175443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fmul(int i) {
175543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
175643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDC, 0xC8, i);
175743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
175843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
175943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
176043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fdiv(int i) {
176143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
176243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDC, 0xF8, i);
176343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
176443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
176543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1766c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.orgvoid Assembler::fdiv_i(int i) {
1767c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org  EnsureSpace ensure_space(this);
1768c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org  emit_farith(0xD8, 0xF0, i);
1769c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org}
1770c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org
1771c5d4971574b7a205fa0e788d8121dc79485e5e67hpayer@chromium.org
177243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::faddp(int i) {
177343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
177443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDE, 0xC0, i);
177543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
177643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
177743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
177843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fsubp(int i) {
177943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
178043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDE, 0xE8, i);
178143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
178243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
178343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
178443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fsubrp(int i) {
178543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
178643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDE, 0xE0, i);
178743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
178843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
178943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
179043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fmulp(int i) {
179143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
179243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDE, 0xC8, i);
179343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
179443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
179543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
179643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fdivp(int i) {
179743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
179843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDE, 0xF8, i);
179943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
180043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
180143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
180243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fprem() {
180343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
180443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
180543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF8);
180643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
180743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
180843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
180943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fprem1() {
181043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
181143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
181243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF5);
181343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
181443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
181543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
181643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fxch(int i) {
181743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
181843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xD9, 0xC8, i);
181943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
182043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
182143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
182243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fincstp() {
182343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
182443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
182543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF7);
182643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
182743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
182843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
182943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::ffree(int i) {
183043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
183143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDD, 0xC0, i);
183243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
183343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
183443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
183543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::ftst() {
183643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
183743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
183843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE4);
183943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
184043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
184143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
184243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fucomp(int i) {
184343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
184443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_farith(0xDD, 0xE8, i);
184543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
184643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
184743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
184843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fucompp() {
184943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
185043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xDA);
185143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE9);
185243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
185343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
185443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
18553811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.orgvoid Assembler::fucomi(int i) {
18563811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org  EnsureSpace ensure_space(this);
18573811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org  EMIT(0xDB);
18583811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org  EMIT(0xE8 + i);
18593811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org}
18603811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org
18613811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org
18623811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.orgvoid Assembler::fucomip() {
18633811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org  EnsureSpace ensure_space(this);
18643811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org  EMIT(0xDF);
18653811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org  EMIT(0xE9);
18663811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org}
18673811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org
18683811b436bf328d2ace6fe79ce99aeda71f9f06d3ager@chromium.org
186943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fcompp() {
187043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
187143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xDE);
187243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
187343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
187443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
187543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
187643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fnstsw_ax() {
187743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
18785aa501ca9fb4dfb30f4191aac135202fe8d80e4aager@chromium.org  EMIT(0xDF);
187943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xE0);
188043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
188143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
188243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
188343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::fwait() {
188443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
188543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x9B);
188643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
188743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
188843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
188943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::frndint() {
189043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
189143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xD9);
189243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xFC);
189343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
189443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
189543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1896061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.orgvoid Assembler::fnclex() {
1897061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org  EnsureSpace ensure_space(this);
1898061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org  EMIT(0xDB);
1899061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org  EMIT(0xE2);
1900061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org}
1901061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org
1902061ef74c9b8acd038edf4b4355c50d097c8a9683kasperl@chromium.org
190343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::sahf() {
190443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
190543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x9E);
190643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
190743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
190843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
19097be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.orgvoid Assembler::setcc(Condition cc, Register reg) {
1910e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(reg.is_byte_register());
19117be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org  EnsureSpace ensure_space(this);
19127be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org  EMIT(0x0F);
19137be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org  EMIT(0x90 | cc);
19147be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org  EMIT(0xC0 | reg.code());
19157be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org}
19167be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org
19177be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org
191843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::cvttss2si(Register dst, const Operand& src) {
191943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
192043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF3);
192143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
192243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x2C);
192343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
192443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
192543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
192643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
192743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::cvttsd2si(Register dst, const Operand& src) {
192843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
192943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF2);
193043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
193143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x2C);
193243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_operand(dst, src);
193343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
193443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
193543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
193646839fbbdee40a3d2d924e8b5b13c4139b0b24f2yangguo@chromium.orgvoid Assembler::cvtsd2si(Register dst, XMMRegister src) {
193746839fbbdee40a3d2d924e8b5b13c4139b0b24f2yangguo@chromium.org  EnsureSpace ensure_space(this);
193846839fbbdee40a3d2d924e8b5b13c4139b0b24f2yangguo@chromium.org  EMIT(0xF2);
193946839fbbdee40a3d2d924e8b5b13c4139b0b24f2yangguo@chromium.org  EMIT(0x0F);
194046839fbbdee40a3d2d924e8b5b13c4139b0b24f2yangguo@chromium.org  EMIT(0x2D);
194146839fbbdee40a3d2d924e8b5b13c4139b0b24f2yangguo@chromium.org  emit_sse_operand(dst, src);
194246839fbbdee40a3d2d924e8b5b13c4139b0b24f2yangguo@chromium.org}
194346839fbbdee40a3d2d924e8b5b13c4139b0b24f2yangguo@chromium.org
194446839fbbdee40a3d2d924e8b5b13c4139b0b24f2yangguo@chromium.org
194543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::cvtsi2sd(XMMRegister dst, const Operand& src) {
194643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
194743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF2);
194843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
194943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x2A);
195043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_sse_operand(dst, src);
195143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
195243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
195343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
1954ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.orgvoid Assembler::cvtss2sd(XMMRegister dst, XMMRegister src) {
1955ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EnsureSpace ensure_space(this);
1956ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0xF3);
1957ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0x0F);
1958ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0x5A);
1959ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  emit_sse_operand(dst, src);
1960ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org}
1961ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
1962ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
19637979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.orgvoid Assembler::cvtsd2ss(XMMRegister dst, XMMRegister src) {
19647979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EnsureSpace ensure_space(this);
19657979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EMIT(0xF2);
19667979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EMIT(0x0F);
19677979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EMIT(0x5A);
19687979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  emit_sse_operand(dst, src);
19697979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org}
19707979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org
19717979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org
197243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::addsd(XMMRegister dst, XMMRegister src) {
197343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
197443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF2);
197543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
197643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x58);
197743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_sse_operand(dst, src);
197843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
197943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
198043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
19811f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.orgvoid Assembler::addsd(XMMRegister dst, const Operand& src) {
19821f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org  EnsureSpace ensure_space(this);
19831f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org  EMIT(0xF2);
19841f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org  EMIT(0x0F);
19851f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org  EMIT(0x58);
19861f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org  emit_sse_operand(dst, src);
19871f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org}
19881f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org
19891f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org
199043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::mulsd(XMMRegister dst, XMMRegister src) {
199143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
199243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF2);
199343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
199443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x59);
199543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_sse_operand(dst, src);
199643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
199743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
199843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
19991f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.orgvoid Assembler::mulsd(XMMRegister dst, const Operand& src) {
20001f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org  EnsureSpace ensure_space(this);
20011f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org  EMIT(0xF2);
20021f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org  EMIT(0x0F);
20031f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org  EMIT(0x59);
20041f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org  emit_sse_operand(dst, src);
20051f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org}
20061f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org
20071f34ad3eadf9b0e6b8ed415817d276f54dd6d06bdanno@chromium.org
200843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::subsd(XMMRegister dst, XMMRegister src) {
200943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
201043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF2);
201143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
201243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x5C);
201343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_sse_operand(dst, src);
201443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
201543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
201643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
2017a2c0c1516848536a514b3178d2c040b7df0ceb5bmachenbach@chromium.orgvoid Assembler::subsd(XMMRegister dst, const Operand& src) {
2018a2c0c1516848536a514b3178d2c040b7df0ceb5bmachenbach@chromium.org  EnsureSpace ensure_space(this);
2019a2c0c1516848536a514b3178d2c040b7df0ceb5bmachenbach@chromium.org  EMIT(0xF2);
2020a2c0c1516848536a514b3178d2c040b7df0ceb5bmachenbach@chromium.org  EMIT(0x0F);
2021a2c0c1516848536a514b3178d2c040b7df0ceb5bmachenbach@chromium.org  EMIT(0x5C);
2022a2c0c1516848536a514b3178d2c040b7df0ceb5bmachenbach@chromium.org  emit_sse_operand(dst, src);
2023a2c0c1516848536a514b3178d2c040b7df0ceb5bmachenbach@chromium.org}
2024a2c0c1516848536a514b3178d2c040b7df0ceb5bmachenbach@chromium.org
2025a2c0c1516848536a514b3178d2c040b7df0ceb5bmachenbach@chromium.org
202643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::divsd(XMMRegister dst, XMMRegister src) {
202743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
202843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF2);
202943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
203043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x5E);
203143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_sse_operand(dst, src);
203243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
203343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
203443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
2035846fb74ad58083497b91fc4668a56fddb36fbd2esgjesse@chromium.orgvoid Assembler::xorpd(XMMRegister dst, XMMRegister src) {
2036846fb74ad58083497b91fc4668a56fddb36fbd2esgjesse@chromium.org  EnsureSpace ensure_space(this);
2037846fb74ad58083497b91fc4668a56fddb36fbd2esgjesse@chromium.org  EMIT(0x66);
2038846fb74ad58083497b91fc4668a56fddb36fbd2esgjesse@chromium.org  EMIT(0x0F);
2039846fb74ad58083497b91fc4668a56fddb36fbd2esgjesse@chromium.org  EMIT(0x57);
2040846fb74ad58083497b91fc4668a56fddb36fbd2esgjesse@chromium.org  emit_sse_operand(dst, src);
2041846fb74ad58083497b91fc4668a56fddb36fbd2esgjesse@chromium.org}
2042846fb74ad58083497b91fc4668a56fddb36fbd2esgjesse@chromium.org
2043846fb74ad58083497b91fc4668a56fddb36fbd2esgjesse@chromium.org
2044af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::andps(XMMRegister dst, const Operand& src) {
2045057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org  EnsureSpace ensure_space(this);
2046057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org  EMIT(0x0F);
2047057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org  EMIT(0x54);
2048057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org  emit_sse_operand(dst, src);
2049057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org}
2050057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org
2051057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org
2052af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::orps(XMMRegister dst, const Operand& src) {
2053057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org  EnsureSpace ensure_space(this);
2054057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org  EMIT(0x0F);
2055057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org  EMIT(0x56);
2056057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org  emit_sse_operand(dst, src);
2057057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org}
2058057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org
2059057bd50c2c2d15923523777a296cddee5c8ba63bverwaest@chromium.org
2060af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::xorps(XMMRegister dst, const Operand& src) {
2061fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org  EnsureSpace ensure_space(this);
2062fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org  EMIT(0x0F);
2063fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org  EMIT(0x57);
2064fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org  emit_sse_operand(dst, src);
2065fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org}
2066fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org
2067fb144a0716afe7ab8bf245f2391a9e53b3db3c89fschneider@chromium.org
2068af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::addps(XMMRegister dst, const Operand& src) {
2069ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EnsureSpace ensure_space(this);
2070ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0x0F);
2071af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x58);
2072ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  emit_sse_operand(dst, src);
2073ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org}
2074ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
2075ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
2076af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::subps(XMMRegister dst, const Operand& src) {
2077c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  EnsureSpace ensure_space(this);
2078c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  EMIT(0x0F);
2079af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x5C);
2080c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  emit_sse_operand(dst, src);
2081c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org}
2082c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org
2083c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org
2084af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::mulps(XMMRegister dst, const Operand& src) {
2085af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EnsureSpace ensure_space(this);
2086af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x0F);
2087af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x59);
2088af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  emit_sse_operand(dst, src);
2089af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org}
2090af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org
2091af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org
2092af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::divps(XMMRegister dst, const Operand& src) {
2093af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EnsureSpace ensure_space(this);
2094af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x0F);
2095af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x5E);
2096af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  emit_sse_operand(dst, src);
2097af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org}
2098af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org
2099af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org
2100af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::sqrtsd(XMMRegister dst, XMMRegister src) {
2101af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EnsureSpace ensure_space(this);
2102af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0xF2);
2103af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x0F);
2104af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x51);
2105af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  emit_sse_operand(dst, src);
2106af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org}
2107af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org
2108af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org
21097e6132b924829c353864933f29124419916db550machenbach@chromium.orgvoid Assembler::sqrtsd(XMMRegister dst, const Operand& src) {
21107e6132b924829c353864933f29124419916db550machenbach@chromium.org  EnsureSpace ensure_space(this);
21117e6132b924829c353864933f29124419916db550machenbach@chromium.org  EMIT(0xF2);
21127e6132b924829c353864933f29124419916db550machenbach@chromium.org  EMIT(0x0F);
21137e6132b924829c353864933f29124419916db550machenbach@chromium.org  EMIT(0x51);
21147e6132b924829c353864933f29124419916db550machenbach@chromium.org  emit_sse_operand(dst, src);
21157e6132b924829c353864933f29124419916db550machenbach@chromium.org}
21167e6132b924829c353864933f29124419916db550machenbach@chromium.org
21177e6132b924829c353864933f29124419916db550machenbach@chromium.org
2118af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::andpd(XMMRegister dst, XMMRegister src) {
2119471f2f1d24adb4bad1edc3bf0ee35092486de187mstarzinger@chromium.org  EnsureSpace ensure_space(this);
2120471f2f1d24adb4bad1edc3bf0ee35092486de187mstarzinger@chromium.org  EMIT(0x66);
2121471f2f1d24adb4bad1edc3bf0ee35092486de187mstarzinger@chromium.org  EMIT(0x0F);
2122af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x54);
2123471f2f1d24adb4bad1edc3bf0ee35092486de187mstarzinger@chromium.org  emit_sse_operand(dst, src);
2124471f2f1d24adb4bad1edc3bf0ee35092486de187mstarzinger@chromium.org}
2125471f2f1d24adb4bad1edc3bf0ee35092486de187mstarzinger@chromium.org
2126471f2f1d24adb4bad1edc3bf0ee35092486de187mstarzinger@chromium.org
2127af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::orpd(XMMRegister dst, XMMRegister src) {
2128ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EnsureSpace ensure_space(this);
2129ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0x66);
2130ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0x0F);
2131af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x56);
2132ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  emit_sse_operand(dst, src);
2133ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org}
2134ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
2135ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
213664e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.orgvoid Assembler::ucomisd(XMMRegister dst, const Operand& src) {
213764e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EnsureSpace ensure_space(this);
213864e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EMIT(0x66);
213964e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EMIT(0x0F);
214064e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  EMIT(0x2E);
214164e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org  emit_sse_operand(dst, src);
214264e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org}
214364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
214464e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.org
21454acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.orgvoid Assembler::roundsd(XMMRegister dst, XMMRegister src, RoundingMode mode) {
2146e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(IsEnabled(SSE4_1));
21474acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.org  EnsureSpace ensure_space(this);
21484acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.org  EMIT(0x66);
21494acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.org  EMIT(0x0F);
21504acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.org  EMIT(0x3A);
21514acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.org  EMIT(0x0B);
21524acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.org  emit_sse_operand(dst, src);
21534acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.org  // Mask precision exeption.
21544acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.org  EMIT(static_cast<byte>(mode) | 0x8);
21554acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.org}
21564acdc2c8d4caecf7606db8af710366c1d6e28fe5whesse@chromium.org
2157e0e1b0d3e70c933d36ed381d511e9fda39f2a751mstarzinger@chromium.org
2158f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.orgvoid Assembler::movmskpd(Register dst, XMMRegister src) {
2159f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org  EnsureSpace ensure_space(this);
2160f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org  EMIT(0x66);
2161f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org  EMIT(0x0F);
2162f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org  EMIT(0x50);
2163f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org  emit_sse_operand(dst, src);
2164f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org}
2165f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org
2166f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org
21674121f23c2a08f8ef03858df1477b81a0450b94a0ulan@chromium.orgvoid Assembler::movmskps(Register dst, XMMRegister src) {
21684121f23c2a08f8ef03858df1477b81a0450b94a0ulan@chromium.org  EnsureSpace ensure_space(this);
21694121f23c2a08f8ef03858df1477b81a0450b94a0ulan@chromium.org  EMIT(0x0F);
21704121f23c2a08f8ef03858df1477b81a0450b94a0ulan@chromium.org  EMIT(0x50);
21714121f23c2a08f8ef03858df1477b81a0450b94a0ulan@chromium.org  emit_sse_operand(dst, src);
21724121f23c2a08f8ef03858df1477b81a0450b94a0ulan@chromium.org}
21734121f23c2a08f8ef03858df1477b81a0450b94a0ulan@chromium.org
21744121f23c2a08f8ef03858df1477b81a0450b94a0ulan@chromium.org
217533e09c8efd078308de3c77a88301566f65c07befverwaest@chromium.orgvoid Assembler::pcmpeqd(XMMRegister dst, XMMRegister src) {
217633e09c8efd078308de3c77a88301566f65c07befverwaest@chromium.org  EnsureSpace ensure_space(this);
217733e09c8efd078308de3c77a88301566f65c07befverwaest@chromium.org  EMIT(0x66);
217833e09c8efd078308de3c77a88301566f65c07befverwaest@chromium.org  EMIT(0x0F);
217933e09c8efd078308de3c77a88301566f65c07befverwaest@chromium.org  EMIT(0x76);
218033e09c8efd078308de3c77a88301566f65c07befverwaest@chromium.org  emit_sse_operand(dst, src);
218133e09c8efd078308de3c77a88301566f65c07befverwaest@chromium.org}
218233e09c8efd078308de3c77a88301566f65c07befverwaest@chromium.org
218333e09c8efd078308de3c77a88301566f65c07befverwaest@chromium.org
2184c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.orgvoid Assembler::cmpltsd(XMMRegister dst, XMMRegister src) {
2185c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  EnsureSpace ensure_space(this);
2186c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  EMIT(0xF2);
2187c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  EMIT(0x0F);
2188c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  EMIT(0xC2);
2189c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  emit_sse_operand(dst, src);
2190c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  EMIT(1);  // LT == 1
2191c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org}
2192c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org
2193c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org
2194c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.orgvoid Assembler::movaps(XMMRegister dst, XMMRegister src) {
2195c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  EnsureSpace ensure_space(this);
2196c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  EMIT(0x0F);
2197c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  EMIT(0x28);
2198c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org  emit_sse_operand(dst, src);
2199c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org}
2200c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org
2201c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.org
2202af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.orgvoid Assembler::shufps(XMMRegister dst, XMMRegister src, byte imm8) {
2203e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(is_uint8(imm8));
2204af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EnsureSpace ensure_space(this);
2205af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0x0F);
2206af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(0xC6);
2207af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  emit_sse_operand(dst, src);
2208af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org  EMIT(imm8);
2209af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org}
2210af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org
2211af9cfcbed5daf6e636e189bce451c6fafdbb127dmachenbach@chromium.org
2212c20610af4f0ca150977ca140a1174f98ee46f5aafschneider@chromium.orgvoid Assembler::movdqa(const Operand& dst, XMMRegister src) {
22130c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EnsureSpace ensure_space(this);
22140c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0x66);
22150c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0x0F);
22160c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0x7F);
22170c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  emit_sse_operand(src, dst);
22180c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org}
22190c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
22200c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
22210c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.orgvoid Assembler::movdqa(XMMRegister dst, const Operand& src) {
22220c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EnsureSpace ensure_space(this);
22230c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0x66);
22240c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0x0F);
22250c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0x6F);
22260c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  emit_sse_operand(dst, src);
22270c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org}
22280c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
22290c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
22300c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.orgvoid Assembler::movdqu(const Operand& dst, XMMRegister src ) {
22310c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EnsureSpace ensure_space(this);
22320c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0xF3);
22330c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0x0F);
22340c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0x7F);
22350c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  emit_sse_operand(src, dst);
22360c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org}
22370c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
22380c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
22390c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.orgvoid Assembler::movdqu(XMMRegister dst, const Operand& src) {
22400c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EnsureSpace ensure_space(this);
22410c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0xF3);
22420c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0x0F);
22430c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  EMIT(0x6F);
22440c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org  emit_sse_operand(dst, src);
22450c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org}
22460c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
22470c20e676f8a0209982ff89e5a9c707771748a585fschneider@chromium.org
22481af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.orgvoid Assembler::movntdqa(XMMRegister dst, const Operand& src) {
2249e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(IsEnabled(SSE4_1));
22501af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EnsureSpace ensure_space(this);
22511af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(0x66);
22521af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(0x0F);
22531af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(0x38);
22541af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(0x2A);
22551af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  emit_sse_operand(dst, src);
22561af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org}
22571af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org
22581af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org
22591af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.orgvoid Assembler::movntdq(const Operand& dst, XMMRegister src) {
22601af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EnsureSpace ensure_space(this);
22611af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(0x66);
22621af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(0x0F);
22631af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(0xE7);
22641af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  emit_sse_operand(src, dst);
22651af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org}
22661af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org
22671af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org
22681af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.orgvoid Assembler::prefetch(const Operand& src, int level) {
2269e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org  DCHECK(is_uint2(level));
22701af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EnsureSpace ensure_space(this);
22711af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(0x0F);
22721af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  EMIT(0x18);
2273a6bbcc801f63c451f814d6da77a1a48fba3d36c6yangguo@chromium.org  // Emit hint number in Reg position of RegR/M.
2274a6bbcc801f63c451f814d6da77a1a48fba3d36c6yangguo@chromium.org  XMMRegister code = XMMRegister::from_code(level);
22751af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org  emit_sse_operand(code, src);
22761af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org}
22771af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org
22781af7e1b5f676e5556c041fe09a5c4f5a906f27a0lrn@chromium.org
227943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::movsd(const Operand& dst, XMMRegister src ) {
228043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
228143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF2);  // double
228243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
228343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x11);  // store
228443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_sse_operand(src, dst);
228543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
228643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
228743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
228843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenvoid Assembler::movsd(XMMRegister dst, const Operand& src) {
228943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EnsureSpace ensure_space(this);
229043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0xF2);  // double
229143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x0F);
229243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  EMIT(0x10);  // load
229343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen  emit_sse_operand(dst, src);
229443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen}
229543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen
22965f0c45f2cacb31d36a8f80c31f17bda7751a3644ager@chromium.org
22977979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.orgvoid Assembler::movss(const Operand& dst, XMMRegister src ) {
22987979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EnsureSpace ensure_space(this);
22997979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EMIT(0xF3);  // float
23007979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EMIT(0x0F);
23017979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EMIT(0x11);  // store
23027979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  emit_sse_operand(src, dst);
23037979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org}
23047979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org
23057979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org
23067979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.orgvoid Assembler::movss(XMMRegister dst, const Operand& src) {
23077979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EnsureSpace ensure_space(this);
23087979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EMIT(0xF3);  // float
23097979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EMIT(0x0F);
23107979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  EMIT(0x10);  // load
23117979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org  emit_sse_operand(dst, src);
23127979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org}
23137979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org
23147979bbb1df2eaff193e85d44c8da1ffa1525b7fcfschneider@chromium.org
2315ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.orgvoid Assembler::movd(XMMRegister dst, const Operand& src) {
2316ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EnsureSpace ensure_space(this);
2317ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0x66);
2318ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0x0F);
2319ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  EMIT(0x6E);
2320ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org  emit_sse_operand(dst, src);
2321ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org}
2322ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
2323ce5e87bd905d592a8bd612b3dedf7a994177c13aager@chromium.org
23245f0c45f2cacb31d36a8f80c31f17bda7751a3644ager@chromium.orgvoid Assembler::movd(const Operand& dst, XMMRegister src) {
23255f0c45f2cacb31d36a8f80c31f17bda7751a3644ager@chromium.org  EnsureSpace ensure_space(this);
23265f0c45f2cacb31d36a8f80c31f17bda7751a3644ager@chromium.org  EMIT(0x66);
23275f0c45f2cacb31d36a8f80c31f17bda7751a3644ager@chromium.org  EMIT(0x0F);
23285f0c45f2cacb31d36a8f80c31f17bda7751a3644ager@chromium.org  EMIT(0x7E);
23295f0c45f2cacb31d36a8f80c31f17bda7751a3644ager@chromium.org  emit_sse_operand(src, dst);
23305f0c45f2cacb31d36a8f80c31f17bda7751a3644ager@chromium.org}
23315f0c45f2cacb31d36a8f80c31f17bda7751a3644ager@chromium.org
23325f0c45f2cacb31d36a8f80c31f17bda7751a3644ager@chromium.org
233364e3a4be4a99f31920128de34573c8ac9038de42ricow@chromium.orgvoid Assembler::extractps(Register dst, XMMRegister