hotspot/src/cpu/x86/vm/assembler_x86.cpp
author duke
Wed, 05 Jul 2017 20:10:48 +0200
changeset 27963 88d7c7c376e9
parent 27691 733f189ad1f7
child 30211 442fbbb31f75
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 24325
diff changeset
     2
 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5426
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5426
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5426
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    25
#include "precompiled.hpp"
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
    26
#include "asm/assembler.hpp"
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
    27
#include "asm/assembler.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    28
#include "gc_interface/collectedHeap.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    29
#include "interpreter/interpreter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    30
#include "memory/cardTableModRefBS.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    31
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    32
#include "prims/methodHandles.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    33
#include "runtime/biasedLocking.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    34
#include "runtime/interfaceSupport.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    35
#include "runtime/objectMonitor.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    36
#include "runtime/os.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    37
#include "runtime/sharedRuntime.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    38
#include "runtime/stubRoutines.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 15117
diff changeset
    39
#include "utilities/macros.hpp"
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 15117
diff changeset
    40
#if INCLUDE_ALL_GCS
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    41
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    42
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    43
#include "gc_implementation/g1/heapRegion.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 15117
diff changeset
    44
#endif // INCLUDE_ALL_GCS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 13294
diff changeset
    46
#ifdef PRODUCT
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 13294
diff changeset
    47
#define BLOCK_COMMENT(str) /* nothing */
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 13294
diff changeset
    48
#define STOP(error) stop(error)
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 13294
diff changeset
    49
#else
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 13294
diff changeset
    50
#define BLOCK_COMMENT(str) block_comment(str)
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 13294
diff changeset
    51
#define STOP(error) block_comment(error); stop(error)
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 13294
diff changeset
    52
#endif
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 13294
diff changeset
    53
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 13294
diff changeset
    54
#define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
// Implementation of AddressLiteral
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
AddressLiteral::AddressLiteral(address target, relocInfo::relocType rtype) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  _is_lval = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  _target = target;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  switch (rtype) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  case relocInfo::oop_type:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13485
diff changeset
    62
  case relocInfo::metadata_type:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    // Oops are a special case. Normally they would be their own section
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    // but in cases like icBuffer they are literals in the code stream that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    // we don't have a section for. We use none so that we get a literal address
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    // which is always patchable.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  case relocInfo::external_word_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    _rspec = external_word_Relocation::spec(target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  case relocInfo::internal_word_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    _rspec = internal_word_Relocation::spec(target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  case relocInfo::opt_virtual_call_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    _rspec = opt_virtual_call_Relocation::spec();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  case relocInfo::static_call_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    _rspec = static_call_Relocation::spec();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  case relocInfo::runtime_call_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    _rspec = runtime_call_Relocation::spec();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  case relocInfo::poll_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  case relocInfo::poll_return_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    _rspec = Relocation::spec_simple(rtype);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  case relocInfo::none:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
// Implementation of Address
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    97
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    98
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
Address Address::make_array(ArrayAddress adr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  // Not implementable on 64bit machines
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  // Should have been handled higher up the call chain.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  ShouldNotReachHere();
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   103
  return Address();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   104
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   105
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   106
// exceedingly dangerous constructor
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   107
Address::Address(int disp, address loc, relocInfo::relocType rtype) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   108
  _base  = noreg;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   109
  _index = noreg;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   110
  _scale = no_scale;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   111
  _disp  = disp;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   112
  switch (rtype) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   113
    case relocInfo::external_word_type:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   114
      _rspec = external_word_Relocation::spec(loc);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   115
      break;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   116
    case relocInfo::internal_word_type:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   117
      _rspec = internal_word_Relocation::spec(loc);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   118
      break;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   119
    case relocInfo::runtime_call_type:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   120
      // HMM
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   121
      _rspec = runtime_call_Relocation::spec();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   122
      break;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   123
    case relocInfo::poll_type:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   124
    case relocInfo::poll_return_type:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   125
      _rspec = Relocation::spec_simple(rtype);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   126
      break;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   127
    case relocInfo::none:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   128
      break;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   129
    default:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   130
      ShouldNotReachHere();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   131
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   132
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   133
#else // LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   134
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   135
Address Address::make_array(ArrayAddress adr) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  AddressLiteral base = adr.base();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  Address index = adr.index();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  assert(index._disp == 0, "must not have disp"); // maybe it can?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  Address array(index._base, index._index, index._scale, (intptr_t) base.target());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  array._rspec = base._rspec;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  return array;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   142
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
// exceedingly dangerous constructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
Address::Address(address loc, RelocationHolder spec) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  _base  = noreg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  _index = noreg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  _scale = no_scale;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  _disp  = (intptr_t) loc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  _rspec = spec;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   152
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
#endif // _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   155
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   156
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
// Convert the raw encoding form into the form expected by the constructor for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
// Address.  An index of 4 (rsp) corresponds to having no index, so convert
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
// that to noreg for the Address constructor.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13485
diff changeset
   160
Address Address::make_raw(int base, int index, int scale, int disp, relocInfo::relocType disp_reloc) {
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
   161
  RelocationHolder rspec;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13485
diff changeset
   162
  if (disp_reloc != relocInfo::none) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13485
diff changeset
   163
    rspec = Relocation::spec_simple(disp_reloc);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
   164
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  bool valid_index = index != rsp->encoding();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  if (valid_index) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    Address madr(as_Register(base), as_Register(index), (Address::ScaleFactor)scale, in_ByteSize(disp));
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
   168
    madr._rspec = rspec;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
    return madr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    Address madr(as_Register(base), noreg, Address::no_scale, in_ByteSize(disp));
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
   172
    madr._rspec = rspec;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    return madr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
// Implementation of Assembler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
int AbstractAssembler::code_fill_byte() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  return (u_char)'\xF4'; // hlt
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
// make this go away someday
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
void Assembler::emit_data(jint data, relocInfo::relocType rtype, int format) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  if (rtype == relocInfo::none)
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   186
        emit_int32(data);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  else  emit_data(data, Relocation::spec_simple(rtype), format);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
void Assembler::emit_data(jint data, RelocationHolder const& rspec, int format) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   191
  assert(imm_operand == 0, "default format must be immediate in this file");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  assert(inst_mark() != NULL, "must be inside InstructionMark");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  if (rspec.type() !=  relocInfo::none) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    #ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
      check_relocation(rspec, format);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    #endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    // Do not use AbstractAssembler::relocate, which is not intended for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    // embedded words.  Instead, relocate to the enclosing instruction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
    // hack. call32 is too wide for mask so use disp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    if (format == call32_operand)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
      code_section()->relocate(inst_mark(), rspec, disp32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
    else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
      code_section()->relocate(inst_mark(), rspec, format);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  }
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   206
  emit_int32(data);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   209
static int encode(Register r) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   210
  int enc = r->encoding();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   211
  if (enc >= 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   212
    enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   213
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   214
  return enc;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   215
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   216
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
void Assembler::emit_arith_b(int op1, int op2, Register dst, int imm8) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  assert(dst->has_byte_register(), "must have byte register");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  assert(isByte(op1) && isByte(op2), "wrong opcode");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  assert(isByte(imm8), "not a byte");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  assert((op1 & 0x01) == 0, "should be 8bit operation");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   222
  emit_int8(op1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   223
  emit_int8(op2 | encode(dst));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   224
  emit_int8(imm8);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   228
void Assembler::emit_arith(int op1, int op2, Register dst, int32_t imm32) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  assert(isByte(op1) && isByte(op2), "wrong opcode");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  assert((op1 & 0x01) == 1, "should be 32bit operation");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  assert((op1 & 0x02) == 0, "sign-extension bit should not be set");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  if (is8bit(imm32)) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   233
    emit_int8(op1 | 0x02); // set sign bit
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   234
    emit_int8(op2 | encode(dst));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   235
    emit_int8(imm32 & 0xFF);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   237
    emit_int8(op1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   238
    emit_int8(op2 | encode(dst));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   239
    emit_int32(imm32);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   243
// Force generation of a 4 byte immediate value even if it fits into 8bit
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   244
void Assembler::emit_arith_imm32(int op1, int op2, Register dst, int32_t imm32) {
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   245
  assert(isByte(op1) && isByte(op2), "wrong opcode");
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   246
  assert((op1 & 0x01) == 1, "should be 32bit operation");
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   247
  assert((op1 & 0x02) == 0, "sign-extension bit should not be set");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   248
  emit_int8(op1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   249
  emit_int8(op2 | encode(dst));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   250
  emit_int32(imm32);
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   251
}
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   252
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
// immediate-to-memory forms
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   254
void Assembler::emit_arith_operand(int op1, Register rm, Address adr, int32_t imm32) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  assert((op1 & 0x01) == 1, "should be 32bit operation");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  assert((op1 & 0x02) == 0, "sign-extension bit should not be set");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  if (is8bit(imm32)) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   258
    emit_int8(op1 | 0x02); // set sign bit
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   259
    emit_operand(rm, adr, 1);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   260
    emit_int8(imm32 & 0xFF);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   262
    emit_int8(op1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   263
    emit_operand(rm, adr, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   264
    emit_int32(imm32);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
void Assembler::emit_arith(int op1, int op2, Register dst, Register src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  assert(isByte(op1) && isByte(op2), "wrong opcode");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   271
  emit_int8(op1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   272
  emit_int8(op2 | encode(dst) << 3 | encode(src));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   273
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   274
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   275
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   276
void Assembler::emit_operand(Register reg, Register base, Register index,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   277
                             Address::ScaleFactor scale, int disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   278
                             RelocationHolder const& rspec,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   279
                             int rip_relative_correction) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  relocInfo::relocType rtype = (relocInfo::relocType) rspec.type();
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   281
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   282
  // Encode the registers as needed in the fields they are used in
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   283
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   284
  int regenc = encode(reg) << 3;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   285
  int indexenc = index->is_valid() ? encode(index) << 3 : 0;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   286
  int baseenc = base->is_valid() ? encode(base) : 0;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   287
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  if (base->is_valid()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
    if (index->is_valid()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
      assert(scale != Address::no_scale, "inconsistent address");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
      // [base + index*scale + disp]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   292
      if (disp == 0 && rtype == relocInfo::none  &&
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   293
          base != rbp LP64_ONLY(&& base != r13)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
        // [base + index*scale]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
        // [00 reg 100][ss index base]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
        assert(index != rsp, "illegal addressing mode");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   297
        emit_int8(0x04 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   298
        emit_int8(scale << 6 | indexenc | baseenc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
      } else if (is8bit(disp) && rtype == relocInfo::none) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
        // [base + index*scale + imm8]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
        // [01 reg 100][ss index base] imm8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
        assert(index != rsp, "illegal addressing mode");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   303
        emit_int8(0x44 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   304
        emit_int8(scale << 6 | indexenc | baseenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   305
        emit_int8(disp & 0xFF);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
      } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   307
        // [base + index*scale + disp32]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   308
        // [10 reg 100][ss index base] disp32
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
        assert(index != rsp, "illegal addressing mode");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   310
        emit_int8(0x84 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   311
        emit_int8(scale << 6 | indexenc | baseenc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
        emit_data(disp, rspec, disp32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
      }
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   314
    } else if (base == rsp LP64_ONLY(|| base == r12)) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   315
      // [rsp + disp]
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
      if (disp == 0 && rtype == relocInfo::none) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   317
        // [rsp]
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
        // [00 reg 100][00 100 100]
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   319
        emit_int8(0x04 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   320
        emit_int8(0x24);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
      } else if (is8bit(disp) && rtype == relocInfo::none) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   322
        // [rsp + imm8]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   323
        // [01 reg 100][00 100 100] disp8
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   324
        emit_int8(0x44 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   325
        emit_int8(0x24);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   326
        emit_int8(disp & 0xFF);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
      } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   328
        // [rsp + imm32]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   329
        // [10 reg 100][00 100 100] disp32
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   330
        emit_int8(0x84 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   331
        emit_int8(0x24);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
        emit_data(disp, rspec, disp32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
      // [base + disp]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   336
      assert(base != rsp LP64_ONLY(&& base != r12), "illegal addressing mode");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   337
      if (disp == 0 && rtype == relocInfo::none &&
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   338
          base != rbp LP64_ONLY(&& base != r13)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
        // [base]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
        // [00 reg base]
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   341
        emit_int8(0x00 | regenc | baseenc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
      } else if (is8bit(disp) && rtype == relocInfo::none) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   343
        // [base + disp8]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   344
        // [01 reg base] disp8
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   345
        emit_int8(0x40 | regenc | baseenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   346
        emit_int8(disp & 0xFF);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
      } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   348
        // [base + disp32]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   349
        // [10 reg base] disp32
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   350
        emit_int8(0x80 | regenc | baseenc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
        emit_data(disp, rspec, disp32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
    if (index->is_valid()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
      assert(scale != Address::no_scale, "inconsistent address");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
      // [index*scale + disp]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   358
      // [00 reg 100][ss index 101] disp32
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
      assert(index != rsp, "illegal addressing mode");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   360
      emit_int8(0x04 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   361
      emit_int8(scale << 6 | indexenc | 0x05);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
      emit_data(disp, rspec, disp32_operand);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   363
    } else if (rtype != relocInfo::none ) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   364
      // [disp] (64bit) RIP-RELATIVE (32bit) abs
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   365
      // [00 000 101] disp32
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   366
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   367
      emit_int8(0x05 | regenc);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   368
      // Note that the RIP-rel. correction applies to the generated
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   369
      // disp field, but _not_ to the target address in the rspec.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   370
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   371
      // disp was created by converting the target address minus the pc
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   372
      // at the start of the instruction. That needs more correction here.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   373
      // intptr_t disp = target - next_ip;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   374
      assert(inst_mark() != NULL, "must be inside InstructionMark");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   375
      address next_ip = pc() + sizeof(int32_t) + rip_relative_correction;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   376
      int64_t adjusted = disp;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   377
      // Do rip-rel adjustment for 64bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   378
      LP64_ONLY(adjusted -=  (next_ip - inst_mark()));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   379
      assert(is_simm32(adjusted),
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   380
             "must be 32bit offset (RIP relative address)");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   381
      emit_data((int32_t) adjusted, rspec, disp32_operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   382
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
    } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   384
      // 32bit never did this, did everything as the rip-rel/disp code above
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   385
      // [disp] ABSOLUTE
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   386
      // [00 reg 100][00 100 101] disp32
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   387
      emit_int8(0x04 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   388
      emit_int8(0x25);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
      emit_data(disp, rspec, disp32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   394
void Assembler::emit_operand(XMMRegister reg, Register base, Register index,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   395
                             Address::ScaleFactor scale, int disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   396
                             RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   397
  emit_operand((Register)reg, base, index, scale, disp, rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   398
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   399
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
// Secret local extension to Assembler::WhichOperand:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
#define end_pc_operand (_WhichOperand_limit)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
address Assembler::locate_operand(address inst, WhichOperand which) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
  // Decode the given instruction, and return the address of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
  // an embedded 32-bit operand word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
  // If "which" is disp32_operand, selects the displacement portion
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
  // of an effective address specifier.
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   409
  // If "which" is imm64_operand, selects the trailing immediate constant.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
  // If "which" is call32_operand, selects the displacement of a call or jump.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
  // Caller is responsible for ensuring that there is such an operand,
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   412
  // and that it is 32/64 bits wide.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
  // If "which" is end_pc_operand, find the end of the instruction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
  address ip = inst;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   417
  bool is_64bit = false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   418
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   419
  debug_only(bool has_disp32 = false);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   420
  int tail_size = 0; // other random bytes (#32, #16, etc.) at end of insn
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   421
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   422
  again_after_prefix:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
  switch (0xFF & *ip++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
  // These convenience macros generate groups of "case" labels for the switch.
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   426
#define REP4(x) (x)+0: case (x)+1: case (x)+2: case (x)+3
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   427
#define REP8(x) (x)+0: case (x)+1: case (x)+2: case (x)+3: \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
             case (x)+4: case (x)+5: case (x)+6: case (x)+7
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   429
#define REP16(x) REP8((x)+0): \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
              case REP8((x)+8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
  case CS_segment:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
  case SS_segment:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
  case DS_segment:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
  case ES_segment:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
  case FS_segment:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
  case GS_segment:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   438
    // Seems dubious
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   439
    LP64_ONLY(assert(false, "shouldn't have that prefix"));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
    assert(ip == inst+1, "only one prefix allowed");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
    goto again_after_prefix;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   443
  case 0x67:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   444
  case REX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   445
  case REX_B:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   446
  case REX_X:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   447
  case REX_XB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   448
  case REX_R:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   449
  case REX_RB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   450
  case REX_RX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   451
  case REX_RXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   452
    NOT_LP64(assert(false, "64bit prefixes"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   453
    goto again_after_prefix;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   454
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   455
  case REX_W:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   456
  case REX_WB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   457
  case REX_WX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   458
  case REX_WXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   459
  case REX_WR:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   460
  case REX_WRB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   461
  case REX_WRX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   462
  case REX_WRXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   463
    NOT_LP64(assert(false, "64bit prefixes"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   464
    is_64bit = true;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   465
    goto again_after_prefix;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   466
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   467
  case 0xFF: // pushq a; decl a; incl a; call a; jmp a
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
  case 0x88: // movb a, r
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
  case 0x89: // movl a, r
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
  case 0x8A: // movb r, a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
  case 0x8B: // movl r, a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
  case 0x8F: // popl a
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   473
    debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   476
  case 0x68: // pushq #32
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   477
    if (which == end_pc_operand) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   478
      return ip + 4;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   479
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   480
    assert(which == imm_operand && !is_64bit, "pushl has no disp32 or 64bit immediate");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
    return ip;                  // not produced by emit_operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
  case 0x66: // movw ... (size prefix)
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   484
    again_after_size_prefix2:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
    switch (0xFF & *ip++) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   486
    case REX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   487
    case REX_B:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   488
    case REX_X:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   489
    case REX_XB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   490
    case REX_R:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   491
    case REX_RB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   492
    case REX_RX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   493
    case REX_RXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   494
    case REX_W:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   495
    case REX_WB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   496
    case REX_WX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   497
    case REX_WXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   498
    case REX_WR:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   499
    case REX_WRB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   500
    case REX_WRX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   501
    case REX_WRXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   502
      NOT_LP64(assert(false, "64bit prefix found"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   503
      goto again_after_size_prefix2;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
    case 0x8B: // movw r, a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
    case 0x89: // movw a, r
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   506
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
    case 0xC7: // movw a, #16
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   509
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
      tail_size = 2;  // the imm16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
    case 0x0F: // several SSE/SSE2 variants
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
      ip--;    // reparse the 0x0F
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
      goto again_after_prefix;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
      ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   520
  case REP8(0xB8): // movl/q r, #32/#64(oop?)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   521
    if (which == end_pc_operand)  return ip + (is_64bit ? 8 : 4);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   522
    // these asserts are somewhat nonsensical
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   523
#ifndef _LP64
12268
f7897aacb9ce 7157141: crash in 64 bit with corrupted oops
never
parents: 11791
diff changeset
   524
    assert(which == imm_operand || which == disp32_operand,
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 24325
diff changeset
   525
           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip)));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   526
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   527
    assert((which == call32_operand || which == imm_operand) && is_64bit ||
12268
f7897aacb9ce 7157141: crash in 64 bit with corrupted oops
never
parents: 11791
diff changeset
   528
           which == narrow_oop_operand && !is_64bit,
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 24325
diff changeset
   529
           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip)));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   530
#endif // _LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
    return ip;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
  case 0x69: // imul r, a, #32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
  case 0xC7: // movl a, #32(oop?)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
    tail_size = 4;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   536
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  case 0x0F: // movx..., etc.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
    switch (0xFF & *ip++) {
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   541
    case 0x3A: // pcmpestri
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   542
      tail_size = 1;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   543
    case 0x38: // ptest, pmovzxbw
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   544
      ip++; // skip opcode
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   545
      debug_only(has_disp32 = true); // has both kinds of operands!
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   546
      break;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   547
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   548
    case 0x70: // pshufd r, r/a, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   549
      debug_only(has_disp32 = true); // has both kinds of operands!
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   550
    case 0x73: // psrldq r, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   551
      tail_size = 1;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   552
      break;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   553
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
    case 0x12: // movlps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
    case 0x28: // movaps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
    case 0x2E: // ucomiss
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
    case 0x2F: // comiss
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
    case 0x54: // andps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
    case 0x55: // andnps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
    case 0x56: // orps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
    case 0x57: // xorps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
    case 0x6E: // movd
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
    case 0x7E: // movd
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   564
    case 0xAE: // ldmxcsr, stmxcsr, fxrstor, fxsave, clflush
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   565
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
    case 0xAD: // shrd r, a, %cl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
    case 0xAF: // imul r, a
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   570
    case 0xBE: // movsbl r, a (movsxb)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   571
    case 0xBF: // movswl r, a (movsxw)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   572
    case 0xB6: // movzbl r, a (movzxb)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   573
    case 0xB7: // movzwl r, a (movzxw)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
    case REP16(0x40): // cmovl cc, r, a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
    case 0xB0: // cmpxchgb
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
    case 0xB1: // cmpxchg
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
    case 0xC1: // xaddl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
    case 0xC7: // cmpxchg8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
    case REP16(0x90): // setcc a
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   580
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
      // fall out of the switch to decode the address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
      break;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   583
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   584
    case 0xC4: // pinsrw r, a, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   585
      debug_only(has_disp32 = true);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   586
    case 0xC5: // pextrw r, r, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   587
      tail_size = 1;  // the imm8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   588
      break;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   589
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
    case 0xAC: // shrd r, a, #8
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   591
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
      tail_size = 1;  // the imm8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
      break;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   594
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
    case REP16(0x80): // jcc rdisp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
      if (which == end_pc_operand)  return ip + 4;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   597
      assert(which == call32_operand, "jcc has no disp32 or imm");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
      return ip;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
      ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
  case 0x81: // addl a, #32; addl r, #32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
    // also: orl, adcl, sbbl, andl, subl, xorl, cmpl
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   606
    // on 32bit in the case of cmpl, the imm might be an oop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
    tail_size = 4;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   608
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
  case 0x83: // addl a, #8; addl r, #8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
    // also: orl, adcl, sbbl, andl, subl, xorl, cmpl
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   613
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
    tail_size = 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
  case 0x9B:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
    switch (0xFF & *ip++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
    case 0xD9: // fnstcw a
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   620
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
      ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
  case REP4(0x00): // addb a, r; addl a, r; addb r, a; addl r, a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
  case REP4(0x10): // adc...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
  case REP4(0x20): // and...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
  case REP4(0x30): // xor...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
  case REP4(0x08): // or...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
  case REP4(0x18): // sbb...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
  case REP4(0x28): // sub...
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   634
  case 0xF7: // mull a
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   635
  case 0x8D: // lea r, a
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   636
  case 0x87: // xchg r, a
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
  case REP4(0x38): // cmp...
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   638
  case 0x85: // test r, a
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   639
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
  case 0xC1: // sal a, #8; sar a, #8; shl a, #8; shr a, #8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
  case 0xC6: // movb a, #8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
  case 0x80: // cmpb a, #8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
  case 0x6B: // imul r, a, #8
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   646
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
    tail_size = 1; // the imm8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   650
  case 0xC4: // VEX_3bytes
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   651
  case 0xC5: // VEX_2bytes
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   652
    assert((UseAVX > 0), "shouldn't have VEX prefix");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   653
    assert(ip == inst+1, "no prefixes allowed");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   654
    // C4 and C5 are also used as opcodes for PINSRW and PEXTRW instructions
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   655
    // but they have prefix 0x0F and processed when 0x0F processed above.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   656
    //
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   657
    // In 32-bit mode the VEX first byte C4 and C5 alias onto LDS and LES
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   658
    // instructions (these instructions are not supported in 64-bit mode).
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   659
    // To distinguish them bits [7:6] are set in the VEX second byte since
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   660
    // ModRM byte can not be of the form 11xxxxxx in 32-bit mode. To set
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   661
    // those VEX bits REX and vvvv bits are inverted.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   662
    //
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   663
    // Fortunately C2 doesn't generate these instructions so we don't need
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   664
    // to check for them in product version.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   665
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   666
    // Check second byte
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   667
    NOT_LP64(assert((0xC0 & *ip) == 0xC0, "shouldn't have LDS and LES instructions"));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   668
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   669
    // First byte
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   670
    if ((0xFF & *inst) == VEX_3bytes) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   671
      ip++; // third byte
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   672
      is_64bit = ((VEX_W & *ip) == VEX_W);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   673
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   674
    ip++; // opcode
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   675
    // To find the end of instruction (which == end_pc_operand).
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   676
    switch (0xFF & *ip) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   677
    case 0x61: // pcmpestri r, r/a, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   678
    case 0x70: // pshufd r, r/a, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   679
    case 0x73: // psrldq r, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   680
      tail_size = 1;  // the imm8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   681
      break;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   682
    default:
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   683
      break;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   684
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   685
    ip++; // skip opcode
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   686
    debug_only(has_disp32 = true); // has both kinds of operands!
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   687
    break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
  case 0xD1: // sal a, 1; sar a, 1; shl a, 1; shr a, 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   690
  case 0xD3: // sal a, %cl; sar a, %cl; shl a, %cl; shr a, %cl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   691
  case 0xD9: // fld_s a; fst_s a; fstp_s a; fldcw a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   692
  case 0xDD: // fld_d a; fst_d a; fstp_d a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   693
  case 0xDB: // fild_s a; fistp_s a; fld_x a; fstp_x a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   694
  case 0xDF: // fild_d a; fistp_d a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
  case 0xD8: // fadd_s a; fsubr_s a; fmul_s a; fdivr_s a; fcomp_s a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
  case 0xDC: // fadd_d a; fsubr_d a; fmul_d a; fdivr_d a; fcomp_d a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
  case 0xDE: // faddp_d a; fsubrp_d a; fmulp_d a; fdivrp_d a; fcompp_d a
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   698
    debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   701
  case 0xE8: // call rdisp32
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   702
  case 0xE9: // jmp  rdisp32
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   703
    if (which == end_pc_operand)  return ip + 4;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   704
    assert(which == call32_operand, "call has no disp32 or imm");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   705
    return ip;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   706
1500
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 1437
diff changeset
   707
  case 0xF0:                    // Lock
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 1437
diff changeset
   708
    assert(os::is_MP(), "only on MP");
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 1437
diff changeset
   709
    goto again_after_prefix;
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 1437
diff changeset
   710
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
  case 0xF3:                    // For SSE
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
  case 0xF2:                    // For SSE2
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   713
    switch (0xFF & *ip++) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   714
    case REX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   715
    case REX_B:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   716
    case REX_X:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   717
    case REX_XB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   718
    case REX_R:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   719
    case REX_RB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   720
    case REX_RX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   721
    case REX_RXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   722
    case REX_W:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   723
    case REX_WB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   724
    case REX_WX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   725
    case REX_WXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   726
    case REX_WR:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   727
    case REX_WRB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   728
    case REX_WRX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   729
    case REX_WRXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   730
      NOT_LP64(assert(false, "found 64bit prefix"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   731
      ip++;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   732
    default:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   733
      ip++;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   734
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   735
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   741
#undef REP8
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   742
#undef REP16
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
  assert(which != call32_operand, "instruction is not a call, jmp, or jcc");
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   746
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   747
  assert(which != imm_operand, "instruction is not a movq reg, imm64");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   748
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   749
  // assert(which != imm_operand || has_imm32, "instruction has no imm32 field");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   750
  assert(which != imm_operand || has_disp32, "instruction has no imm32 field");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   751
#endif // LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   752
  assert(which != disp32_operand || has_disp32, "instruction has no disp32 field");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
489c9b5090e2 Initial load
duke
parents:
diff changeset
   754
  // parse the output of emit_operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   755
  int op2 = 0xFF & *ip++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   756
  int base = op2 & 0x07;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   757
  int op3 = -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
  const int b100 = 4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
  const int b101 = 5;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
  if (base == b100 && (op2 >> 6) != 3) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
    op3 = 0xFF & *ip++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
    base = op3 & 0x07;   // refetch the base
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
  // now ip points at the disp (if any)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
  switch (op2 >> 6) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
  case 0:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   768
    // [00 reg  100][ss index base]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   769
    // [00 reg  100][00   100  esp]
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
    // [00 reg base]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
    // [00 reg  100][ss index  101][disp32]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
    // [00 reg  101]               [disp32]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
    if (base == b101) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   775
      if (which == disp32_operand)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   776
        return ip;              // caller wants the disp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   777
      ip += 4;                  // skip the disp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   778
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   779
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   780
489c9b5090e2 Initial load
duke
parents:
diff changeset
   781
  case 1:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   782
    // [01 reg  100][ss index base][disp8]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   783
    // [01 reg  100][00   100  esp][disp8]
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   784
    // [01 reg base]               [disp8]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   785
    ip += 1;                    // skip the disp8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   786
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   787
489c9b5090e2 Initial load
duke
parents:
diff changeset
   788
  case 2:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
    // [10 reg  100][ss index base][disp32]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   790
    // [10 reg  100][00   100  esp][disp32]
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
    // [10 reg base]               [disp32]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   792
    if (which == disp32_operand)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
      return ip;                // caller wants the disp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
    ip += 4;                    // skip the disp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
  case 3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   798
    // [11 reg base]  (not a memory addressing mode)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   801
489c9b5090e2 Initial load
duke
parents:
diff changeset
   802
  if (which == end_pc_operand) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   803
    return ip + tail_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   804
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   805
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   806
#ifdef _LP64
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
   807
  assert(which == narrow_oop_operand && !is_64bit, "instruction is not a movl adr, imm32");
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   808
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   809
  assert(which == imm_operand, "instruction has only an imm field");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   810
#endif // LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
  return ip;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   812
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   813
489c9b5090e2 Initial load
duke
parents:
diff changeset
   814
address Assembler::locate_next_instruction(address inst) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   815
  // Secretly share code with locate_operand:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   816
  return locate_operand(inst, end_pc_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   817
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   818
489c9b5090e2 Initial load
duke
parents:
diff changeset
   819
489c9b5090e2 Initial load
duke
parents:
diff changeset
   820
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   821
void Assembler::check_relocation(RelocationHolder const& rspec, int format) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   822
  address inst = inst_mark();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   823
  assert(inst != NULL && inst < pc(), "must point to beginning of instruction");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
  address opnd;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
489c9b5090e2 Initial load
duke
parents:
diff changeset
   826
  Relocation* r = rspec.reloc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   827
  if (r->type() == relocInfo::none) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   828
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   829
  } else if (r->is_call() || format == call32_operand) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
    // assert(format == imm32_operand, "cannot specify a nonzero format");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
    opnd = locate_operand(inst, call32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
  } else if (r->is_data()) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   833
    assert(format == imm_operand || format == disp32_operand
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   834
           LP64_ONLY(|| format == narrow_oop_operand), "format ok");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   835
    opnd = locate_operand(inst, (WhichOperand)format);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   836
  } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   837
    assert(format == imm_operand, "cannot specify a format");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   838
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   839
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   840
  assert(opnd == pc(), "must put operand where relocs can find it");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   841
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   842
#endif // ASSERT
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   843
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   844
void Assembler::emit_operand32(Register reg, Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   845
  assert(reg->encoding() < 8, "no extended registers");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   846
  assert(!adr.base_needs_rex() && !adr.index_needs_rex(), "no extended registers");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   847
  emit_operand(reg, adr._base, adr._index, adr._scale, adr._disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   848
               adr._rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   849
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   850
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   851
void Assembler::emit_operand(Register reg, Address adr,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   852
                             int rip_relative_correction) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   853
  emit_operand(reg, adr._base, adr._index, adr._scale, adr._disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   854
               adr._rspec,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   855
               rip_relative_correction);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   856
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   857
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   858
void Assembler::emit_operand(XMMRegister reg, Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   859
  emit_operand(reg, adr._base, adr._index, adr._scale, adr._disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   860
               adr._rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   861
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   862
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   863
// MMX operations
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   864
void Assembler::emit_operand(MMXRegister reg, Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   865
  assert(!adr.base_needs_rex() && !adr.index_needs_rex(), "no extended registers");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   866
  emit_operand((Register)reg, adr._base, adr._index, adr._scale, adr._disp, adr._rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   867
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   868
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   869
// work around gcc (3.2.1-7a) bug
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   870
void Assembler::emit_operand(Address adr, MMXRegister reg) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   871
  assert(!adr.base_needs_rex() && !adr.index_needs_rex(), "no extended registers");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   872
  emit_operand((Register)reg, adr._base, adr._index, adr._scale, adr._disp, adr._rspec);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   873
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   874
489c9b5090e2 Initial load
duke
parents:
diff changeset
   875
489c9b5090e2 Initial load
duke
parents:
diff changeset
   876
void Assembler::emit_farith(int b1, int b2, int i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   877
  assert(isByte(b1) && isByte(b2), "wrong opcode");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   878
  assert(0 <= i &&  i < 8, "illegal stack offset");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   879
  emit_int8(b1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   880
  emit_int8(b2 + i);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   881
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   882
489c9b5090e2 Initial load
duke
parents:
diff changeset
   883
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   884
// Now the Assembler instructions (identical for 32/64 bits)
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   885
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   886
void Assembler::adcl(Address dst, int32_t imm32) {
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   887
  InstructionMark im(this);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   888
  prefix(dst);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   889
  emit_arith_operand(0x81, rdx, dst, imm32);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   890
}
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   891
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   892
void Assembler::adcl(Address dst, Register src) {
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   893
  InstructionMark im(this);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   894
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   895
  emit_int8(0x11);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   896
  emit_operand(src, dst);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
   897
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   898
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   899
void Assembler::adcl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   900
  prefix(dst);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   901
  emit_arith(0x81, 0xD0, dst, imm32);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   902
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   903
489c9b5090e2 Initial load
duke
parents:
diff changeset
   904
void Assembler::adcl(Register dst, Address src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   905
  InstructionMark im(this);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   906
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   907
  emit_int8(0x13);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   908
  emit_operand(dst, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   909
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   910
489c9b5090e2 Initial load
duke
parents:
diff changeset
   911
void Assembler::adcl(Register dst, Register src) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   912
  (void) prefix_and_encode(dst->encoding(), src->encoding());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   913
  emit_arith(0x13, 0xC0, dst, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   914
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   915
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   916
void Assembler::addl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   917
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   918
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   919
  emit_arith_operand(0x81, rax, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   920
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   921
489c9b5090e2 Initial load
duke
parents:
diff changeset
   922
void Assembler::addl(Address dst, Register src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   923
  InstructionMark im(this);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   924
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   925
  emit_int8(0x01);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   926
  emit_operand(src, dst);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   927
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   928
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   929
void Assembler::addl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   930
  prefix(dst);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   931
  emit_arith(0x81, 0xC0, dst, imm32);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   932
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   933
489c9b5090e2 Initial load
duke
parents:
diff changeset
   934
void Assembler::addl(Register dst, Address src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   935
  InstructionMark im(this);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   936
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   937
  emit_int8(0x03);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   938
  emit_operand(dst, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   939
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   940
489c9b5090e2 Initial load
duke
parents:
diff changeset
   941
void Assembler::addl(Register dst, Register src) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   942
  (void) prefix_and_encode(dst->encoding(), src->encoding());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   943
  emit_arith(0x03, 0xC0, dst, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   944
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   945
489c9b5090e2 Initial load
duke
parents:
diff changeset
   946
void Assembler::addr_nop_4() {
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   947
  assert(UseAddressNop, "no CPU support");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   948
  // 4 bytes: NOP DWORD PTR [EAX+0]
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   949
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   950
  emit_int8(0x1F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   951
  emit_int8(0x40); // emit_rm(cbuf, 0x1, EAX_enc, EAX_enc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   952
  emit_int8(0);    // 8-bits offset (1 byte)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   953
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   954
489c9b5090e2 Initial load
duke
parents:
diff changeset
   955
void Assembler::addr_nop_5() {
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   956
  assert(UseAddressNop, "no CPU support");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   957
  // 5 bytes: NOP DWORD PTR [EAX+EAX*0+0] 8-bits offset
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   958
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   959
  emit_int8(0x1F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   960
  emit_int8(0x44); // emit_rm(cbuf, 0x1, EAX_enc, 0x4);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   961
  emit_int8(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   962
  emit_int8(0);    // 8-bits offset (1 byte)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   963
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   964
489c9b5090e2 Initial load
duke
parents:
diff changeset
   965
void Assembler::addr_nop_7() {
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   966
  assert(UseAddressNop, "no CPU support");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   967
  // 7 bytes: NOP DWORD PTR [EAX+0] 32-bits offset
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   968
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   969
  emit_int8(0x1F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   970
  emit_int8((unsigned char)0x80);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   971
                   // emit_rm(cbuf, 0x2, EAX_enc, EAX_enc);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   972
  emit_int32(0);   // 32-bits offset (4 bytes)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   973
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   974
489c9b5090e2 Initial load
duke
parents:
diff changeset
   975
void Assembler::addr_nop_8() {
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   976
  assert(UseAddressNop, "no CPU support");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   977
  // 8 bytes: NOP DWORD PTR [EAX+EAX*0+0] 32-bits offset
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   978
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   979
  emit_int8(0x1F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   980
  emit_int8((unsigned char)0x84);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   981
                   // emit_rm(cbuf, 0x2, EAX_enc, 0x4);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   982
  emit_int8(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   983
  emit_int32(0);   // 32-bits offset (4 bytes)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   984
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   985
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   986
void Assembler::addsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   987
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
   988
  emit_simd_arith(0x58, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   989
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   990
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   991
void Assembler::addsd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   992
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
   993
  emit_simd_arith(0x58, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   994
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   995
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   996
void Assembler::addss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   997
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
   998
  emit_simd_arith(0x58, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   999
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1000
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1001
void Assembler::addss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1002
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1003
  emit_simd_arith(0x58, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1004
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1005
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1006
void Assembler::aesdec(XMMRegister dst, Address src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1007
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1008
  InstructionMark im(this);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1009
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1010
  emit_int8((unsigned char)0xDE);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1011
  emit_operand(dst, src);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1012
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1013
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1014
void Assembler::aesdec(XMMRegister dst, XMMRegister src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1015
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1016
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1017
  emit_int8((unsigned char)0xDE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1018
  emit_int8(0xC0 | encode);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1019
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1020
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1021
void Assembler::aesdeclast(XMMRegister dst, Address src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1022
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1023
  InstructionMark im(this);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1024
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1025
  emit_int8((unsigned char)0xDF);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1026
  emit_operand(dst, src);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1027
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1028
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1029
void Assembler::aesdeclast(XMMRegister dst, XMMRegister src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1030
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1031
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1032
  emit_int8((unsigned char)0xDF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1033
  emit_int8((unsigned char)(0xC0 | encode));
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1034
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1035
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1036
void Assembler::aesenc(XMMRegister dst, Address src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1037
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1038
  InstructionMark im(this);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1039
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1040
  emit_int8((unsigned char)0xDC);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1041
  emit_operand(dst, src);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1042
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1043
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1044
void Assembler::aesenc(XMMRegister dst, XMMRegister src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1045
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1046
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1047
  emit_int8((unsigned char)0xDC);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1048
  emit_int8(0xC0 | encode);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1049
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1050
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1051
void Assembler::aesenclast(XMMRegister dst, Address src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1052
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1053
  InstructionMark im(this);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1054
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1055
  emit_int8((unsigned char)0xDD);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1056
  emit_operand(dst, src);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1057
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1058
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1059
void Assembler::aesenclast(XMMRegister dst, XMMRegister src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1060
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1061
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1062
  emit_int8((unsigned char)0xDD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1063
  emit_int8((unsigned char)(0xC0 | encode));
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1064
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1065
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1066
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1067
void Assembler::andl(Address dst, int32_t imm32) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1068
  InstructionMark im(this);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1069
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1070
  emit_int8((unsigned char)0x81);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1071
  emit_operand(rsp, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1072
  emit_int32(imm32);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1073
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1074
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1075
void Assembler::andl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1076
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1077
  emit_arith(0x81, 0xE0, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1078
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1079
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1080
void Assembler::andl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1081
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1082
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1083
  emit_int8(0x23);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1084
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1085
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1086
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1087
void Assembler::andl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1088
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1089
  emit_arith(0x23, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1090
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1091
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1092
void Assembler::andnl(Register dst, Register src1, Register src2) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1093
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1094
  int encode = vex_prefix_0F38_and_encode(dst, src1, src2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1095
  emit_int8((unsigned char)0xF2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1096
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1097
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1098
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1099
void Assembler::andnl(Register dst, Register src1, Address src2) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1100
  InstructionMark im(this);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1101
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1102
  vex_prefix_0F38(dst, src1, src2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1103
  emit_int8((unsigned char)0xF2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1104
  emit_operand(dst, src2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1105
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1106
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1107
void Assembler::bsfl(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1108
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1109
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1110
  emit_int8((unsigned char)0xBC);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1111
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1112
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1113
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1114
void Assembler::bsrl(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1115
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1116
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1117
  emit_int8((unsigned char)0xBD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1118
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1119
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1120
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1121
void Assembler::bswapl(Register reg) { // bswap
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1122
  int encode = prefix_and_encode(reg->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1123
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1124
  emit_int8((unsigned char)(0xC8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1125
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1126
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1127
void Assembler::blsil(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1128
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1129
  int encode = vex_prefix_0F38_and_encode(rbx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1130
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1131
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1132
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1133
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1134
void Assembler::blsil(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1135
  InstructionMark im(this);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1136
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1137
  vex_prefix_0F38(rbx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1138
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1139
  emit_operand(rbx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1140
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1141
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1142
void Assembler::blsmskl(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1143
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1144
  int encode = vex_prefix_0F38_and_encode(rdx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1145
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1146
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1147
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1148
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1149
void Assembler::blsmskl(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1150
  InstructionMark im(this);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1151
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1152
  vex_prefix_0F38(rdx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1153
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1154
  emit_operand(rdx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1155
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1156
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1157
void Assembler::blsrl(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1158
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1159
  int encode = vex_prefix_0F38_and_encode(rcx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1160
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1161
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1162
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1163
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1164
void Assembler::blsrl(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1165
  InstructionMark im(this);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1166
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1167
  vex_prefix_0F38(rcx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1168
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1169
  emit_operand(rcx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1170
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1171
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1172
void Assembler::call(Label& L, relocInfo::relocType rtype) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1173
  // suspect disp32 is always good
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1174
  int operand = LP64_ONLY(disp32_operand) NOT_LP64(imm_operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1175
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1176
  if (L.is_bound()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1177
    const int long_size = 5;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1178
    int offs = (int)( target(L) - pc() );
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1179
    assert(offs <= 0, "assembler error");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1180
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1181
    // 1110 1000 #32-bit disp
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1182
    emit_int8((unsigned char)0xE8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1183
    emit_data(offs - long_size, rtype, operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1184
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1185
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1186
    // 1110 1000 #32-bit disp
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1187
    L.add_patch_at(code(), locator());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1188
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1189
    emit_int8((unsigned char)0xE8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1190
    emit_data(int(0), rtype, operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1191
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1192
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1193
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1194
void Assembler::call(Register dst) {
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1195
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1196
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1197
  emit_int8((unsigned char)(0xD0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1198
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1199
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1200
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1201
void Assembler::call(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1202
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1203
  prefix(adr);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1204
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1205
  emit_operand(rdx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1206
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1207
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1208
void Assembler::call_literal(address entry, RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1209
  assert(entry != NULL, "call most probably wrong");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1210
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1211
  emit_int8((unsigned char)0xE8);
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1212
  intptr_t disp = entry - (pc() + sizeof(int32_t));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1213
  assert(is_simm32(disp), "must be 32bit offset (call2)");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1214
  // Technically, should use call32_operand, but this format is
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1215
  // implied by the fact that we're emitting a call instruction.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1216
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1217
  int operand = LP64_ONLY(disp32_operand) NOT_LP64(call32_operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1218
  emit_data((int) disp, rspec, operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1219
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1220
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1221
void Assembler::cdql() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1222
  emit_int8((unsigned char)0x99);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1223
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1224
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1225
void Assembler::cld() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1226
  emit_int8((unsigned char)0xFC);
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1227
}
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1228
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1229
void Assembler::cmovl(Condition cc, Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1230
  NOT_LP64(guarantee(VM_Version::supports_cmov(), "illegal instruction"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1231
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1232
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1233
  emit_int8(0x40 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1234
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1235
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1236
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1237
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1238
void Assembler::cmovl(Condition cc, Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1239
  NOT_LP64(guarantee(VM_Version::supports_cmov(), "illegal instruction"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1240
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1241
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1242
  emit_int8(0x40 | cc);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1243
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1244
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1245
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1246
void Assembler::cmpb(Address dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1247
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1248
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1249
  emit_int8((unsigned char)0x80);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1250
  emit_operand(rdi, dst, 1);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1251
  emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1252
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1253
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1254
void Assembler::cmpl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1255
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1256
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1257
  emit_int8((unsigned char)0x81);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1258
  emit_operand(rdi, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1259
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1260
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1261
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1262
void Assembler::cmpl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1263
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1264
  emit_arith(0x81, 0xF8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1265
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1266
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1267
void Assembler::cmpl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1268
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1269
  emit_arith(0x3B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1270
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1271
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1272
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1273
void Assembler::cmpl(Register dst, Address  src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1274
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1275
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1276
  emit_int8((unsigned char)0x3B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1277
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1278
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1279
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1280
void Assembler::cmpw(Address dst, int imm16) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1281
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1282
  assert(!dst.base_needs_rex() && !dst.index_needs_rex(), "no extended registers");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1283
  emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1284
  emit_int8((unsigned char)0x81);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1285
  emit_operand(rdi, dst, 2);
14831
84828ee2a91c 8004536: replace AbstractAssembler emit_word with emit_int16
twisti
parents: 14626
diff changeset
  1286
  emit_int16(imm16);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1287
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1288
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1289
// The 32-bit cmpxchg compares the value at adr with the contents of rax,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1290
// and stores reg into adr if so; otherwise, the value at adr is loaded into rax,.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1291
// The ZF is set if the compared values were equal, and cleared otherwise.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1292
void Assembler::cmpxchgl(Register reg, Address adr) { // cmpxchg
13955
f386817ce2d2 6884973: java -XX:Atomics=2 crashes
coleenp
parents: 13952
diff changeset
  1293
  InstructionMark im(this);
f386817ce2d2 6884973: java -XX:Atomics=2 crashes
coleenp
parents: 13952
diff changeset
  1294
  prefix(adr, reg);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1295
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1296
  emit_int8((unsigned char)0xB1);
13955
f386817ce2d2 6884973: java -XX:Atomics=2 crashes
coleenp
parents: 13952
diff changeset
  1297
  emit_operand(reg, adr);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1298
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1299
27691
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1300
// The 8-bit cmpxchg compares the value at adr with the contents of rax,
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1301
// and stores reg into adr if so; otherwise, the value at adr is loaded into rax,.
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1302
// The ZF is set if the compared values were equal, and cleared otherwise.
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1303
void Assembler::cmpxchgb(Register reg, Address adr) { // cmpxchg
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1304
  InstructionMark im(this);
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1305
  prefix(adr, reg, true);
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1306
  emit_int8(0x0F);
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1307
  emit_int8((unsigned char)0xB0);
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1308
  emit_operand(reg, adr);
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1309
}
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1310
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1311
void Assembler::comisd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1312
  // NOTE: dbx seems to decode this as comiss even though the
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1313
  // 0x66 is there. Strangly ucomisd comes out correct
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1314
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1315
  emit_simd_arith_nonds(0x2F, dst, src, VEX_SIMD_66);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1316
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1317
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1318
void Assembler::comisd(XMMRegister dst, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1319
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1320
  emit_simd_arith_nonds(0x2F, dst, src, VEX_SIMD_66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1321
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1322
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1323
void Assembler::comiss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1324
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1325
  emit_simd_arith_nonds(0x2F, dst, src, VEX_SIMD_NONE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1326
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1327
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1328
void Assembler::comiss(XMMRegister dst, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1329
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1330
  emit_simd_arith_nonds(0x2F, dst, src, VEX_SIMD_NONE);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1331
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1332
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1333
void Assembler::cpuid() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1334
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1335
  emit_int8((unsigned char)0xA2);
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1336
}
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1337
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1338
void Assembler::cvtdq2pd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1339
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1340
  emit_simd_arith_nonds(0xE6, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1341
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1342
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1343
void Assembler::cvtdq2ps(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1344
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1345
  emit_simd_arith_nonds(0x5B, dst, src, VEX_SIMD_NONE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1346
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1347
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1348
void Assembler::cvtsd2ss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1349
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1350
  emit_simd_arith(0x5A, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1351
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1352
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1353
void Assembler::cvtsd2ss(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1354
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1355
  emit_simd_arith(0x5A, dst, src, VEX_SIMD_F2);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1356
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1357
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1358
void Assembler::cvtsi2sdl(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1359
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1360
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1361
  emit_int8(0x2A);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1362
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1363
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1364
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1365
void Assembler::cvtsi2sdl(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1366
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1367
  emit_simd_arith(0x2A, dst, src, VEX_SIMD_F2);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1368
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1369
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1370
void Assembler::cvtsi2ssl(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1371
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1372
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1373
  emit_int8(0x2A);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1374
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1375
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1376
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1377
void Assembler::cvtsi2ssl(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1378
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1379
  emit_simd_arith(0x2A, dst, src, VEX_SIMD_F3);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1380
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1381
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1382
void Assembler::cvtss2sd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1383
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1384
  emit_simd_arith(0x5A, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1385
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1386
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1387
void Assembler::cvtss2sd(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1388
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1389
  emit_simd_arith(0x5A, dst, src, VEX_SIMD_F3);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1390
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1391
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1392
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1393
void Assembler::cvttsd2sil(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1394
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1395
  int encode = simd_prefix_and_encode(dst, src, VEX_SIMD_F2);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1396
  emit_int8(0x2C);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1397
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1398
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1399
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1400
void Assembler::cvttss2sil(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1401
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1402
  int encode = simd_prefix_and_encode(dst, src, VEX_SIMD_F3);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1403
  emit_int8(0x2C);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1404
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1405
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1406
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1407
void Assembler::decl(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1408
  // Don't use it directly. Use MacroAssembler::decrement() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1409
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1410
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1411
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1412
  emit_operand(rcx, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1413
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1414
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1415
void Assembler::divsd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1416
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1417
  emit_simd_arith(0x5E, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1418
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1419
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1420
void Assembler::divsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1421
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1422
  emit_simd_arith(0x5E, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1423
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1424
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1425
void Assembler::divss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1426
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1427
  emit_simd_arith(0x5E, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1428
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1429
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1430
void Assembler::divss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1431
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1432
  emit_simd_arith(0x5E, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1433
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1434
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1435
void Assembler::emms() {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1436
  NOT_LP64(assert(VM_Version::supports_mmx(), ""));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1437
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1438
  emit_int8(0x77);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1439
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1440
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1441
void Assembler::hlt() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1442
  emit_int8((unsigned char)0xF4);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1443
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1444
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1445
void Assembler::idivl(Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1446
  int encode = prefix_and_encode(src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1447
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1448
  emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1449
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1450
7121
69928525c55c 6997311: SIGFPE in new long division asm code
kvn
parents: 7115
diff changeset
  1451
void Assembler::divl(Register src) { // Unsigned
69928525c55c 6997311: SIGFPE in new long division asm code
kvn
parents: 7115
diff changeset
  1452
  int encode = prefix_and_encode(src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1453
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1454
  emit_int8((unsigned char)(0xF0 | encode));
7121
69928525c55c 6997311: SIGFPE in new long division asm code
kvn
parents: 7115
diff changeset
  1455
}
69928525c55c 6997311: SIGFPE in new long division asm code
kvn
parents: 7115
diff changeset
  1456
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1457
void Assembler::imull(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1458
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1459
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1460
  emit_int8((unsigned char)0xAF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1461
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1462
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1463
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1464
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1465
void Assembler::imull(Register dst, Register src, int value) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1466
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1467
  if (is8bit(value)) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1468
    emit_int8(0x6B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1469
    emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1470
    emit_int8(value & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1471
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1472
    emit_int8(0x69);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1473
    emit_int8((unsigned char)(0xC0 | encode));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1474
    emit_int32(value);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1475
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1476
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1477
21105
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1478
void Assembler::imull(Register dst, Address src) {
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1479
  InstructionMark im(this);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1480
  prefix(src, dst);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1481
  emit_int8(0x0F);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1482
  emit_int8((unsigned char) 0xAF);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1483
  emit_operand(dst, src);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1484
}
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1485
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1486
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1487
void Assembler::incl(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1488
  // Don't use it directly. Use MacroAssembler::increment() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1489
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1490
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1491
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1492
  emit_operand(rax, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1493
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1494
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10006
diff changeset
  1495
void Assembler::jcc(Condition cc, Label& L, bool maybe_short) {
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10006
diff changeset
  1496
  InstructionMark im(this);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1497
  assert((0 <= cc) && (cc < 16), "illegal cc");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1498
  if (L.is_bound()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1499
    address dst = target(L);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1500
    assert(dst != NULL, "jcc most probably wrong");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1501
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1502
    const int short_size = 2;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1503
    const int long_size = 6;
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1504
    intptr_t offs = (intptr_t)dst - (intptr_t)pc();
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10006
diff changeset
  1505
    if (maybe_short && is8bit(offs - short_size)) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1506
      // 0111 tttn #8-bit disp
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1507
      emit_int8(0x70 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1508
      emit_int8((offs - short_size) & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1509
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1510
      // 0000 1111 1000 tttn #32-bit disp
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1511
      assert(is_simm32(offs - long_size),
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1512
             "must be 32bit offset (call4)");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1513
      emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1514
      emit_int8((unsigned char)(0x80 | cc));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1515
      emit_int32(offs - long_size);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1516
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1517
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1518
    // Note: could eliminate cond. jumps to this jump if condition
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1519
    //       is the same however, seems to be rather unlikely case.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1520
    // Note: use jccb() if label to be bound is very close to get
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1521
    //       an 8-bit displacement
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1522
    L.add_patch_at(code(), locator());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1523
    emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1524
    emit_int8((unsigned char)(0x80 | cc));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1525
    emit_int32(0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1526
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1527
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1528
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1529
void Assembler::jccb(Condition cc, Label& L) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1530
  if (L.is_bound()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1531
    const int short_size = 2;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1532
    address entry = target(L);
11434
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1533
#ifdef ASSERT
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1534
    intptr_t dist = (intptr_t)entry - ((intptr_t)pc() + short_size);
11434
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1535
    intptr_t delta = short_branch_delta();
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1536
    if (delta != 0) {
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1537
      dist += (dist < 0 ? (-delta) :delta);
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1538
    }
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1539
    assert(is8bit(dist), "Dispacement too large for a short jmp");
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1540
#endif
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1541
    intptr_t offs = (intptr_t)entry - (intptr_t)pc();
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1542
    // 0111 tttn #8-bit disp
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1543
    emit_int8(0x70 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1544
    emit_int8((offs - short_size) & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1545
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1546
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1547
    L.add_patch_at(code(), locator());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1548
    emit_int8(0x70 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1549
    emit_int8(0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1550
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1551
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1552
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1553
void Assembler::jmp(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1554
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1555
  prefix(adr);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1556
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1557
  emit_operand(rsp, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1558
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1559
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10006
diff changeset
  1560
void Assembler::jmp(Label& L, bool maybe_short) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1561
  if (L.is_bound()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1562
    address entry = target(L);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1563
    assert(entry != NULL, "jmp most probably wrong");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1564
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1565
    const int short_size = 2;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1566
    const int long_size = 5;
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1567
    intptr_t offs = entry - pc();
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10006
diff changeset
  1568
    if (maybe_short && is8bit(offs - short_size)) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1569
      emit_int8((unsigned char)0xEB);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1570
      emit_int8((offs - short_size) & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1571
    } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1572
      emit_int8((unsigned char)0xE9);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1573
      emit_int32(offs - long_size);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1574
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1575
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1576
    // By default, forward jumps are always 32-bit displacements, since
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1577
    // we can't yet know where the label will be bound.  If you're sure that
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1578
    // the forward jump will not run beyond 256 bytes, use jmpb to
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1579
    // force an 8-bit displacement.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1580
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1581
    L.add_patch_at(code(), locator());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1582
    emit_int8((unsigned char)0xE9);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1583
    emit_int32(0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1584
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1585
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1586
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1587
void Assembler::jmp(Register entry) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1588
  int encode = prefix_and_encode(entry->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1589
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1590
  emit_int8((unsigned char)(0xE0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1591
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1592
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1593
void Assembler::jmp_literal(address dest, RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1594
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1595
  emit_int8((unsigned char)0xE9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1596
  assert(dest != NULL, "must have a target");
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1597
  intptr_t disp = dest - (pc() + sizeof(int32_t));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1598
  assert(is_simm32(disp), "must be 32bit offset (jmp)");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1599
  emit_data(disp, rspec.reloc(), call32_operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1600
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1601
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1602
void Assembler::jmpb(Label& L) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1603
  if (L.is_bound()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1604
    const int short_size = 2;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1605
    address entry = target(L);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1606
    assert(entry != NULL, "jmp most probably wrong");
11434
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1607
#ifdef ASSERT
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1608
    intptr_t dist = (intptr_t)entry - ((intptr_t)pc() + short_size);
11434
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1609
    intptr_t delta = short_branch_delta();
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1610
    if (delta != 0) {
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1611
      dist += (dist < 0 ? (-delta) :delta);
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1612
    }
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1613
    assert(is8bit(dist), "Dispacement too large for a short jmp");
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1614
#endif
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1615
    intptr_t offs = entry - pc();
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1616
    emit_int8((unsigned char)0xEB);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1617
    emit_int8((offs - short_size) & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1618
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1619
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1620
    L.add_patch_at(code(), locator());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1621
    emit_int8((unsigned char)0xEB);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1622
    emit_int8(0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1623
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1624
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1625
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1626
void Assembler::ldmxcsr( Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1627
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1628
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1629
  prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1630
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1631
  emit_int8((unsigned char)0xAE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1632
  emit_operand(as_Register(2), src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1633
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1634
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1635
void Assembler::leal(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1636
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1637
#ifdef _LP64
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1638
  emit_int8(0x67); // addr32
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1639
  prefix(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1640
#endif // LP64
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1641
  emit_int8((unsigned char)0x8D);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1642
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1643
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1644
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1645
void Assembler::lfence() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1646
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1647
  emit_int8((unsigned char)0xAE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1648
  emit_int8((unsigned char)0xE8);
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1649
}
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1650
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1651
void Assembler::lock() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1652
  emit_int8((unsigned char)0xF0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1653
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1654
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1655
void Assembler::lzcntl(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1656
  assert(VM_Version::supports_lzcnt(), "encoding is treated as BSR");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1657
  emit_int8((unsigned char)0xF3);
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1658
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1659
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1660
  emit_int8((unsigned char)0xBD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1661
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1662
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1663
2338
a8660a1b709b 6822204: volatile fences should prefer lock:addl to actual mfence instructions
never
parents: 2332
diff changeset
  1664
// Emit mfence instruction
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1665
void Assembler::mfence() {
2338
a8660a1b709b 6822204: volatile fences should prefer lock:addl to actual mfence instructions
never
parents: 2332
diff changeset
  1666
  NOT_LP64(assert(VM_Version::supports_sse2(), "unsupported");)
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1667
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1668
  emit_int8((unsigned char)0xAE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1669
  emit_int8((unsigned char)0xF0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1670
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1671
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1672
void Assembler::mov(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1673
  LP64_ONLY(movq(dst, src)) NOT_LP64(movl(dst, src));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1674
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1675
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1676
void Assembler::movapd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1677
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1678
  emit_simd_arith_nonds(0x28, dst, src, VEX_SIMD_66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1679
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1680
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1681
void Assembler::movaps(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1682
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1683
  emit_simd_arith_nonds(0x28, dst, src, VEX_SIMD_NONE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1684
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1685
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1686
void Assembler::movlhps(XMMRegister dst, XMMRegister src) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1687
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1688
  int encode = simd_prefix_and_encode(dst, src, src, VEX_SIMD_NONE);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1689
  emit_int8(0x16);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1690
  emit_int8((unsigned char)(0xC0 | encode));
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1691
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1692
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1693
void Assembler::movb(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1694
  NOT_LP64(assert(dst->has_byte_register(), "must have byte register"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1695
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1696
  prefix(src, dst, true);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1697
  emit_int8((unsigned char)0x8A);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1698
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1699
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1700
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1701
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1702
void Assembler::movb(Address dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1703
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1704
   prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1705
  emit_int8((unsigned char)0xC6);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1706
  emit_operand(rax, dst, 1);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1707
  emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1708
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1709
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1710
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1711
void Assembler::movb(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1712
  assert(src->has_byte_register(), "must have byte register");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1713
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1714
  prefix(dst, src, true);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1715
  emit_int8((unsigned char)0x88);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1716
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1717
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1718
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1719
void Assembler::movdl(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1720
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1721
  int encode = simd_prefix_and_encode(dst, src, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1722
  emit_int8(0x6E);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1723
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1724
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1725
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1726
void Assembler::movdl(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1727
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1728
  // swap src/dst to get correct prefix
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1729
  int encode = simd_prefix_and_encode(src, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1730
  emit_int8(0x7E);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1731
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1732
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1733
8494
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  1734
void Assembler::movdl(XMMRegister dst, Address src) {
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  1735
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  1736
  InstructionMark im(this);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1737
  simd_prefix(dst, src, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1738
  emit_int8(0x6E);
8494
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  1739
  emit_operand(dst, src);
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  1740
}
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  1741
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1742
void Assembler::movdl(Address dst, XMMRegister src) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1743
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1744
  InstructionMark im(this);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1745
  simd_prefix(dst, src, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1746
  emit_int8(0x7E);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1747
  emit_operand(src, dst);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1748
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1749
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1750
void Assembler::movdqa(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1751
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1752
  emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1753
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1754
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  1755
void Assembler::movdqa(XMMRegister dst, Address src) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  1756
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  1757
  emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_66);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  1758
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  1759
1437
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1760
void Assembler::movdqu(XMMRegister dst, Address src) {
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1761
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1762
  emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_F3);
1437
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1763
}
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1764
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1765
void Assembler::movdqu(XMMRegister dst, XMMRegister src) {
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1766
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1767
  emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_F3);
1437
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1768
}
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1769
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1770
void Assembler::movdqu(Address dst, XMMRegister src) {
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1771
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1772
  InstructionMark im(this);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1773
  simd_prefix(dst, src, VEX_SIMD_F3);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1774
  emit_int8(0x7F);
1437
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1775
  emit_operand(src, dst);
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1776
}
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1777
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1778
// Move Unaligned 256bit Vector
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1779
void Assembler::vmovdqu(XMMRegister dst, XMMRegister src) {
24325
7a1b3799b906 8041957: -XX:UseAVX=0 cause assert(UseAVX) failed
kvn
parents: 23497
diff changeset
  1780
  assert(UseAVX > 0, "");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1781
  bool vector256 = true;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1782
  int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1783
  emit_int8(0x6F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1784
  emit_int8((unsigned char)(0xC0 | encode));
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1785
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1786
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1787
void Assembler::vmovdqu(XMMRegister dst, Address src) {
24325
7a1b3799b906 8041957: -XX:UseAVX=0 cause assert(UseAVX) failed
kvn
parents: 23497
diff changeset
  1788
  assert(UseAVX > 0, "");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1789
  InstructionMark im(this);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1790
  bool vector256 = true;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1791
  vex_prefix(dst, xnoreg, src, VEX_SIMD_F3, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1792
  emit_int8(0x6F);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1793
  emit_operand(dst, src);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1794
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1795
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1796
void Assembler::vmovdqu(Address dst, XMMRegister src) {
24325
7a1b3799b906 8041957: -XX:UseAVX=0 cause assert(UseAVX) failed
kvn
parents: 23497
diff changeset
  1797
  assert(UseAVX > 0, "");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1798
  InstructionMark im(this);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1799
  bool vector256 = true;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1800
  // swap src<->dst for encoding
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1801
  assert(src != xnoreg, "sanity");
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1802
  vex_prefix(src, xnoreg, dst, VEX_SIMD_F3, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1803
  emit_int8(0x7F);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1804
  emit_operand(src, dst);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1805
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  1806
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1807
// Uses zero extension on 64bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1808
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1809
void Assembler::movl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1810
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1811
  emit_int8((unsigned char)(0xB8 | encode));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1812
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1813
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1814
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1815
void Assembler::movl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1816
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1817
  emit_int8((unsigned char)0x8B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1818
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1819
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1820
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1821
void Assembler::movl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1822
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1823
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1824
  emit_int8((unsigned char)0x8B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1825
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1826
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1827
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1828
void Assembler::movl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1829
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1830
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1831
  emit_int8((unsigned char)0xC7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1832
  emit_operand(rax, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1833
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1834
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1835
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1836
void Assembler::movl(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1837
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1838
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1839
  emit_int8((unsigned char)0x89);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1840
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1841
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1842
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1843
// New cpus require to use movsd and movss to avoid partial register stall
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1844
// when loading from memory. But for old Opteron use movlpd instead of movsd.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1845
// The selection is done in MacroAssembler::movdbl() and movflt().
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1846
void Assembler::movlpd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1847
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1848
  emit_simd_arith(0x12, dst, src, VEX_SIMD_66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1849
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1850
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1851
void Assembler::movq( MMXRegister dst, Address src ) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1852
  assert( VM_Version::supports_mmx(), "" );
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1853
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1854
  emit_int8(0x6F);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1855
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1856
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1857
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1858
void Assembler::movq( Address dst, MMXRegister src ) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1859
  assert( VM_Version::supports_mmx(), "" );
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1860
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1861
  emit_int8(0x7F);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1862
  // workaround gcc (3.2.1-7a) bug
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1863
  // In that version of gcc with only an emit_operand(MMX, Address)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1864
  // gcc will tail jump and try and reverse the parameters completely
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1865
  // obliterating dst in the process. By having a version available
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1866
  // that doesn't need to swap the args at the tail jump the bug is
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1867
  // avoided.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1868
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1869
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1870
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1871
void Assembler::movq(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1872
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1873
  InstructionMark im(this);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1874
  simd_prefix(dst, src, VEX_SIMD_F3);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1875
  emit_int8(0x7E);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1876
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1877
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1878
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1879
void Assembler::movq(Address dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1880
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1881
  InstructionMark im(this);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1882
  simd_prefix(dst, src, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1883
  emit_int8((unsigned char)0xD6);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1884
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1885
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1886
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1887
void Assembler::movsbl(Register dst, Address src) { // movsxb
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1888
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1889
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1890
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1891
  emit_int8((unsigned char)0xBE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1892
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1893
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1894
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1895
void Assembler::movsbl(Register dst, Register src) { // movsxb
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1896
  NOT_LP64(assert(src->has_byte_register(), "must have byte register"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1897
  int encode = prefix_and_encode(dst->encoding(), src->encoding(), true);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1898
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1899
  emit_int8((unsigned char)0xBE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1900
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1901
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1902
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1903
void Assembler::movsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1904
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1905
  emit_simd_arith(0x10, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1906
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1907
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1908
void Assembler::movsd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1909
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1910
  emit_simd_arith_nonds(0x10, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1911
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1912
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1913
void Assembler::movsd(Address dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1914
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1915
  InstructionMark im(this);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1916
  simd_prefix(dst, src, VEX_SIMD_F2);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1917
  emit_int8(0x11);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1918
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1919
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1920
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1921
void Assembler::movss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1922
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1923
  emit_simd_arith(0x10, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1924
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1925
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1926
void Assembler::movss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1927
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  1928
  emit_simd_arith_nonds(0x10, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1929
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1930
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1931
void Assembler::movss(Address dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1932
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1933
  InstructionMark im(this);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1934
  simd_prefix(dst, src, VEX_SIMD_F3);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1935
  emit_int8(0x11);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1936
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1937
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1938
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1939
void Assembler::movswl(Register dst, Address src) { // movsxw
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1940
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1941
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1942
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1943
  emit_int8((unsigned char)0xBF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1944
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1945
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1946
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1947
void Assembler::movswl(Register dst, Register src) { // movsxw
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1948
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1949
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1950
  emit_int8((unsigned char)0xBF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1951
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1952
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1953
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1954
void Assembler::movw(Address dst, int imm16) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1955
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1956
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1957
  emit_int8(0x66); // switch to 16-bit mode
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1958
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1959
  emit_int8((unsigned char)0xC7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1960
  emit_operand(rax, dst, 2);
14831
84828ee2a91c 8004536: replace AbstractAssembler emit_word with emit_int16
twisti
parents: 14626
diff changeset
  1961
  emit_int16(imm16);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1962
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1963
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1964
void Assembler::movw(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1965
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1966
  emit_int8(0x66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1967
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1968
  emit_int8((unsigned char)0x8B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1969
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1970
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1971
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1972
void Assembler::movw(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1973
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1974
  emit_int8(0x66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1975
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1976
  emit_int8((unsigned char)0x89);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1977
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1978
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1979
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1980
void Assembler::movzbl(Register dst, Address src) { // movzxb
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1981
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1982
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1983
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1984
  emit_int8((unsigned char)0xB6);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1985
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1986
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1987
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1988
void Assembler::movzbl(Register dst, Register src) { // movzxb
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1989
  NOT_LP64(assert(src->has_byte_register(), "must have byte register"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1990
  int encode = prefix_and_encode(dst->encoding(), src->encoding(), true);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1991
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1992
  emit_int8((unsigned char)0xB6);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1993
  emit_int8(0xC0 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1994
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1995
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1996
void Assembler::movzwl(Register dst, Address src) { // movzxw
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1997
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1998
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1999
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2000
  emit_int8((unsigned char)0xB7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2001
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2002
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2003
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2004
void Assembler::movzwl(Register dst, Register src) { // movzxw
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2005
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2006
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2007
  emit_int8((unsigned char)0xB7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2008
  emit_int8(0xC0 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2009
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2010
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2011
void Assembler::mull(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2012
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2013
  prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2014
  emit_int8((unsigned char)0xF7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2015
  emit_operand(rsp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2016
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2017
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2018
void Assembler::mull(Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2019
  int encode = prefix_and_encode(src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2020
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2021
  emit_int8((unsigned char)(0xE0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2022
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2023
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2024
void Assembler::mulsd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2025
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2026
  emit_simd_arith(0x59, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2027
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2028
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2029
void Assembler::mulsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2030
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2031
  emit_simd_arith(0x59, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2032
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2033
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2034
void Assembler::mulss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2035
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2036
  emit_simd_arith(0x59, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2037
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2038
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2039
void Assembler::mulss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2040
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2041
  emit_simd_arith(0x59, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2042
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2043
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2044
void Assembler::negl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2045
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2046
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2047
  emit_int8((unsigned char)(0xD8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2048
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2049
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2050
void Assembler::nop(int i) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2051
#ifdef ASSERT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2052
  assert(i > 0, " ");
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2053
  // The fancy nops aren't currently recognized by debuggers making it a
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2054
  // pain to disassemble code while debugging. If asserts are on clearly
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2055
  // speed is not an issue so simply use the single byte traditional nop
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2056
  // to do alignment.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2057
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2058
  for (; i > 0 ; i--) emit_int8((unsigned char)0x90);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2059
  return;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2060
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2061
#endif // ASSERT
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2062
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2063
  if (UseAddressNop && VM_Version::is_intel()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2064
    //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2065
    // Using multi-bytes nops "0x0F 0x1F [address]" for Intel
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2066
    //  1: 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2067
    //  2: 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2068
    //  3: 0x66 0x66 0x90 (don't use "0x0F 0x1F 0x00" - need patching safe padding)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2069
    //  4: 0x0F 0x1F 0x40 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2070
    //  5: 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2071
    //  6: 0x66 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2072
    //  7: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2073
    //  8: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2074
    //  9: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2075
    // 10: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2076
    // 11: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2077
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2078
    // The rest coding is Intel specific - don't use consecutive address nops
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2079
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2080
    // 12: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2081
    // 13: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2082
    // 14: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2083
    // 15: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2084
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2085
    while(i >= 15) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2086
      // For Intel don't generate consecutive addess nops (mix with regular nops)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2087
      i -= 15;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2088
      emit_int8(0x66);   // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2089
      emit_int8(0x66);   // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2090
      emit_int8(0x66);   // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2091
      addr_nop_8();
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2092
      emit_int8(0x66);   // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2093
      emit_int8(0x66);   // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2094
      emit_int8(0x66);   // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2095
      emit_int8((unsigned char)0x90);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2096
                         // nop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2097
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2098
    switch (i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2099
      case 14:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2100
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2101
      case 13:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2102
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2103
      case 12:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2104
        addr_nop_8();
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2105
        emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2106
        emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2107
        emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2108
        emit_int8((unsigned char)0x90);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2109
                         // nop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2110
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2111
      case 11:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2112
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2113
      case 10:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2114
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2115
      case 9:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2116
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2117
      case 8:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2118
        addr_nop_8();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2119
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2120
      case 7:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2121
        addr_nop_7();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2122
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2123
      case 6:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2124
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2125
      case 5:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2126
        addr_nop_5();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2127
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2128
      case 4:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2129
        addr_nop_4();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2130
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2131
      case 3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2132
        // Don't use "0x0F 0x1F 0x00" - need patching safe padding
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2133
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2134
      case 2:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2135
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2136
      case 1:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2137
        emit_int8((unsigned char)0x90);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2138
                         // nop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2139
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2140
      default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2141
        assert(i == 0, " ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2142
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2143
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2144
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2145
  if (UseAddressNop && VM_Version::is_amd()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2146
    //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2147
    // Using multi-bytes nops "0x0F 0x1F [address]" for AMD.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2148
    //  1: 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2149
    //  2: 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2150
    //  3: 0x66 0x66 0x90 (don't use "0x0F 0x1F 0x00" - need patching safe padding)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2151
    //  4: 0x0F 0x1F 0x40 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2152
    //  5: 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2153
    //  6: 0x66 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2154
    //  7: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2155
    //  8: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2156
    //  9: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2157
    // 10: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2158
    // 11: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2159
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2160
    // The rest coding is AMD specific - use consecutive address nops
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2161
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2162
    // 12: 0x66 0x0F 0x1F 0x44 0x00 0x00 0x66 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2163
    // 13: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00 0x66 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2164
    // 14: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2165
    // 15: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2166
    // 16: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2167
    //     Size prefixes (0x66) are added for larger sizes
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2168
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2169
    while(i >= 22) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2170
      i -= 11;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2171
      emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2172
      emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2173
      emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2174
      addr_nop_8();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2175
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2176
    // Generate first nop for size between 21-12
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2177
    switch (i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2178
      case 21:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2179
        i -= 1;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2180
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2181
      case 20:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2182
      case 19:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2183
        i -= 1;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2184
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2185
      case 18:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2186
      case 17:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2187
        i -= 1;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2188
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2189
      case 16:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2190
      case 15:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2191
        i -= 8;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2192
        addr_nop_8();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2193
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2194
      case 14:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2195
      case 13:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2196
        i -= 7;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2197
        addr_nop_7();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2198
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2199
      case 12:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2200
        i -= 6;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2201
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2202
        addr_nop_5();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2203
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2204
      default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2205
        assert(i < 12, " ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2206
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2207
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2208
    // Generate second nop for size between 11-1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2209
    switch (i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2210
      case 11:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2211
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2212
      case 10:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2213
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2214
      case 9:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2215
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2216
      case 8:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2217
        addr_nop_8();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2218
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2219
      case 7:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2220
        addr_nop_7();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2221
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2222
      case 6:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2223
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2224
      case 5:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2225
        addr_nop_5();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2226
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2227
      case 4:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2228
        addr_nop_4();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2229
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2230
      case 3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2231
        // Don't use "0x0F 0x1F 0x00" - need patching safe padding
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2232
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2233
      case 2:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2234
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2235
      case 1:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2236
        emit_int8((unsigned char)0x90);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2237
                         // nop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2238
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2239
      default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2240
        assert(i == 0, " ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2241
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2242
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2243
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2244
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2245
  // Using nops with size prefixes "0x66 0x90".
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2246
  // From AMD Optimization Guide:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2247
  //  1: 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2248
  //  2: 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2249
  //  3: 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2250
  //  4: 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2251
  //  5: 0x66 0x66 0x90 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2252
  //  6: 0x66 0x66 0x90 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2253
  //  7: 0x66 0x66 0x66 0x90 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2254
  //  8: 0x66 0x66 0x66 0x90 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2255
  //  9: 0x66 0x66 0x90 0x66 0x66 0x90 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2256
  // 10: 0x66 0x66 0x66 0x90 0x66 0x66 0x90 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2257
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2258
  while(i > 12) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2259
    i -= 4;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2260
    emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2261
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2262
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2263
    emit_int8((unsigned char)0x90);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2264
                     // nop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2265
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2266
  // 1 - 12 nops
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2267
  if(i > 8) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2268
    if(i > 9) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2269
      i -= 1;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2270
      emit_int8(0x66);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2271
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2272
    i -= 3;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2273
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2274
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2275
    emit_int8((unsigned char)0x90);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2276
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2277
  // 1 - 8 nops
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2278
  if(i > 4) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2279
    if(i > 6) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2280
      i -= 1;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2281
      emit_int8(0x66);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2282
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2283
    i -= 3;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2284
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2285
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2286
    emit_int8((unsigned char)0x90);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2287
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2288
  switch (i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2289
    case 4:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2290
      emit_int8(0x66);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2291
    case 3:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2292
      emit_int8(0x66);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2293
    case 2:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2294
      emit_int8(0x66);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2295
    case 1:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2296
      emit_int8((unsigned char)0x90);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2297
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2298
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2299
      assert(i == 0, " ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2300
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2301
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2302
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2303
void Assembler::notl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2304
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2305
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2306
  emit_int8((unsigned char)(0xD0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2307
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2308
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2309
void Assembler::orl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2310
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2311
  prefix(dst);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  2312
  emit_arith_operand(0x81, rcx, dst, imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2313
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2314
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2315
void Assembler::orl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2316
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2317
  emit_arith(0x81, 0xC8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2318
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2319
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2320
void Assembler::orl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2321
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2322
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2323
  emit_int8(0x0B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2324
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2325
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2326
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2327
void Assembler::orl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2328
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2329
  emit_arith(0x0B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2330
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2331
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2332
void Assembler::packuswb(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2333
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2334
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2335
  emit_simd_arith(0x67, dst, src, VEX_SIMD_66);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2336
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2337
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2338
void Assembler::packuswb(XMMRegister dst, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2339
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2340
  emit_simd_arith(0x67, dst, src, VEX_SIMD_66);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2341
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2342
15242
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  2343
void Assembler::vpackuswb(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  2344
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  2345
  emit_vex_arith(0x67, dst, nds, src, VEX_SIMD_66, vector256);
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  2346
}
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  2347
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  2348
void Assembler::vpermq(XMMRegister dst, XMMRegister src, int imm8, bool vector256) {
15612
d4073ad8ce3d 8007708: compiler/6855215 assert(VM_Version::supports_sse4_2())
kvn
parents: 15483
diff changeset
  2349
  assert(VM_Version::supports_avx2(), "");
d4073ad8ce3d 8007708: compiler/6855215 assert(VM_Version::supports_sse4_2())
kvn
parents: 15483
diff changeset
  2350
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, true, vector256);
d4073ad8ce3d 8007708: compiler/6855215 assert(VM_Version::supports_sse4_2())
kvn
parents: 15483
diff changeset
  2351
  emit_int8(0x00);
d4073ad8ce3d 8007708: compiler/6855215 assert(VM_Version::supports_sse4_2())
kvn
parents: 15483
diff changeset
  2352
  emit_int8(0xC0 | encode);
d4073ad8ce3d 8007708: compiler/6855215 assert(VM_Version::supports_sse4_2())
kvn
parents: 15483
diff changeset
  2353
  emit_int8(imm8);
15242
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  2354
}
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  2355
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2356
void Assembler::pause() {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2357
  emit_int8((unsigned char)0xF3);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2358
  emit_int8((unsigned char)0x90);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2359
}
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2360
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2361
void Assembler::pcmpestri(XMMRegister dst, Address src, int imm8) {
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2362
  assert(VM_Version::supports_sse4_2(), "");
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2363
  InstructionMark im(this);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2364
  simd_prefix(dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2365
  emit_int8(0x61);
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2366
  emit_operand(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2367
  emit_int8(imm8);
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2368
}
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2369
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2370
void Assembler::pcmpestri(XMMRegister dst, XMMRegister src, int imm8) {
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2371
  assert(VM_Version::supports_sse4_2(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2372
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2373
  emit_int8(0x61);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2374
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2375
  emit_int8(imm8);
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2376
}
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2377
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2378
void Assembler::pextrd(Register dst, XMMRegister src, int imm8) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2379
  assert(VM_Version::supports_sse4_1(), "");
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2380
  int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, false);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2381
  emit_int8(0x16);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2382
  emit_int8((unsigned char)(0xC0 | encode));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2383
  emit_int8(imm8);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2384
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2385
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2386
void Assembler::pextrq(Register dst, XMMRegister src, int imm8) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2387
  assert(VM_Version::supports_sse4_1(), "");
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2388
  int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, true);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2389
  emit_int8(0x16);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2390
  emit_int8((unsigned char)(0xC0 | encode));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2391
  emit_int8(imm8);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2392
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2393
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2394
void Assembler::pinsrd(XMMRegister dst, Register src, int imm8) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2395
  assert(VM_Version::supports_sse4_1(), "");
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2396
  int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, false);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2397
  emit_int8(0x22);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2398
  emit_int8((unsigned char)(0xC0 | encode));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2399
  emit_int8(imm8);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2400
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2401
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2402
void Assembler::pinsrq(XMMRegister dst, Register src, int imm8) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2403
  assert(VM_Version::supports_sse4_1(), "");
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2404
  int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, true);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2405
  emit_int8(0x22);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2406
  emit_int8((unsigned char)(0xC0 | encode));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2407
  emit_int8(imm8);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2408
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2409
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2410
void Assembler::pmovzxbw(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2411
  assert(VM_Version::supports_sse4_1(), "");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2412
  InstructionMark im(this);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2413
  simd_prefix(dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2414
  emit_int8(0x30);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2415
  emit_operand(dst, src);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2416
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2417
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2418
void Assembler::pmovzxbw(XMMRegister dst, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2419
  assert(VM_Version::supports_sse4_1(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2420
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2421
  emit_int8(0x30);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2422
  emit_int8((unsigned char)(0xC0 | encode));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2423
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2424
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2425
// generic
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2426
void Assembler::pop(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2427
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2428
  emit_int8(0x58 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2429
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2430
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2431
void Assembler::popcntl(Register dst, Address src) {
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2432
  assert(VM_Version::supports_popcnt(), "must support");
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2433
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2434
  emit_int8((unsigned char)0xF3);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2435
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2436
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2437
  emit_int8((unsigned char)0xB8);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2438
  emit_operand(dst, src);
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2439
}
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2440
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2441
void Assembler::popcntl(Register dst, Register src) {
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2442
  assert(VM_Version::supports_popcnt(), "must support");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2443
  emit_int8((unsigned char)0xF3);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2444
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2445
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2446
  emit_int8((unsigned char)0xB8);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2447
  emit_int8((unsigned char)(0xC0 | encode));
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2448
}
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  2449
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2450
void Assembler::popf() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2451
  emit_int8((unsigned char)0x9D);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2452
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2453
4430
95b539dfa1e8 6769124: various 64-bit fixes for c1
roland
parents: 4019
diff changeset
  2454
#ifndef _LP64 // no 32bit push/pop on amd64
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2455
void Assembler::popl(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2456
  // NOTE: this will adjust stack by 8byte on 64bits
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2457
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2458
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2459
  emit_int8((unsigned char)0x8F);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2460
  emit_operand(rax, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2461
}
4430
95b539dfa1e8 6769124: various 64-bit fixes for c1
roland
parents: 4019
diff changeset
  2462
#endif
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2463
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2464
void Assembler::prefetch_prefix(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2465
  prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2466
  emit_int8(0x0F);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2467
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2468
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2469
void Assembler::prefetchnta(Address src) {
10286
74b0f625d56a 7081926: assert(VM_Version::supports_sse2()) failed: must support
kvn
parents: 10268
diff changeset
  2470
  NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2471
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2472
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2473
  emit_int8(0x18);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2474
  emit_operand(rax, src); // 0, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2475
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2476
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2477
void Assembler::prefetchr(Address src) {
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
  2478
  assert(VM_Version::supports_3dnow_prefetch(), "must support");
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2479
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2480
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2481
  emit_int8(0x0D);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2482
  emit_operand(rax, src); // 0, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2483
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2484
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2485
void Assembler::prefetcht0(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2486
  NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2487
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2488
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2489
  emit_int8(0x18);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2490
  emit_operand(rcx, src); // 1, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2491
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2492
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2493
void Assembler::prefetcht1(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2494
  NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2495
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2496
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2497
  emit_int8(0x18);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2498
  emit_operand(rdx, src); // 2, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2499
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2500
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2501
void Assembler::prefetcht2(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2502
  NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2503
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2504
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2505
  emit_int8(0x18);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2506
  emit_operand(rbx, src); // 3, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2507
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2508
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2509
void Assembler::prefetchw(Address src) {
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
  2510
  assert(VM_Version::supports_3dnow_prefetch(), "must support");
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2511
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2512
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2513
  emit_int8(0x0D);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2514
  emit_operand(rcx, src); // 1, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2515
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2516
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2517
void Assembler::prefix(Prefix p) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2518
  emit_int8(p);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2519
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2520
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2521
void Assembler::pshufb(XMMRegister dst, XMMRegister src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2522
  assert(VM_Version::supports_ssse3(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2523
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2524
  emit_int8(0x00);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2525
  emit_int8((unsigned char)(0xC0 | encode));
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2526
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2527
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2528
void Assembler::pshufb(XMMRegister dst, Address src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2529
  assert(VM_Version::supports_ssse3(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2530
  InstructionMark im(this);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2531
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2532
  emit_int8(0x00);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2533
  emit_operand(dst, src);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2534
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  2535
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2536
void Assembler::pshufd(XMMRegister dst, XMMRegister src, int mode) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2537
  assert(isByte(mode), "invalid value");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2538
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2539
  emit_simd_arith_nonds(0x70, dst, src, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2540
  emit_int8(mode & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2541
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2542
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2543
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2544
void Assembler::pshufd(XMMRegister dst, Address src, int mode) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2545
  assert(isByte(mode), "invalid value");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2546
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2547
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2548
  InstructionMark im(this);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2549
  simd_prefix(dst, src, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2550
  emit_int8(0x70);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2551
  emit_operand(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2552
  emit_int8(mode & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2553
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2554
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2555
void Assembler::pshuflw(XMMRegister dst, XMMRegister src, int mode) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2556
  assert(isByte(mode), "invalid value");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2557
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2558
  emit_simd_arith_nonds(0x70, dst, src, VEX_SIMD_F2);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2559
  emit_int8(mode & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2560
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2561
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2562
void Assembler::pshuflw(XMMRegister dst, Address src, int mode) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2563
  assert(isByte(mode), "invalid value");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2564
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2565
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2566
  InstructionMark im(this);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2567
  simd_prefix(dst, src, VEX_SIMD_F2);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2568
  emit_int8(0x70);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2569
  emit_operand(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2570
  emit_int8(mode & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2571
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2572
8494
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  2573
void Assembler::psrldq(XMMRegister dst, int shift) {
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  2574
  // Shift 128 bit value in xmm register by number of bytes.
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  2575
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2576
  int encode = simd_prefix_and_encode(xmm3, dst, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2577
  emit_int8(0x73);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2578
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2579
  emit_int8(shift);
8494
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  2580
}
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  2581
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2582
void Assembler::ptest(XMMRegister dst, Address src) {
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2583
  assert(VM_Version::supports_sse4_1(), "");
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2584
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2585
  InstructionMark im(this);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2586
  simd_prefix(dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2587
  emit_int8(0x17);
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2588
  emit_operand(dst, src);
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2589
}
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2590
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2591
void Assembler::ptest(XMMRegister dst, XMMRegister src) {
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2592
  assert(VM_Version::supports_sse4_1(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2593
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2594
  emit_int8(0x17);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2595
  emit_int8((unsigned char)(0xC0 | encode));
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2596
}
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  2597
15117
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2598
void Assembler::vptest(XMMRegister dst, Address src) {
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2599
  assert(VM_Version::supports_avx(), "");
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2600
  InstructionMark im(this);
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2601
  bool vector256 = true;
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2602
  assert(dst != xnoreg, "sanity");
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2603
  int dst_enc = dst->encoding();
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2604
  // swap src<->dst for encoding
15242
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  2605
  vex_prefix(src, 0, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_38, false, vector256);
15117
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2606
  emit_int8(0x17);
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2607
  emit_operand(dst, src);
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2608
}
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2609
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2610
void Assembler::vptest(XMMRegister dst, XMMRegister src) {
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2611
  assert(VM_Version::supports_avx(), "");
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2612
  bool vector256 = true;
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2613
  int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_38);
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2614
  emit_int8(0x17);
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2615
  emit_int8((unsigned char)(0xC0 | encode));
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2616
}
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  2617
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2618
void Assembler::punpcklbw(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2619
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2620
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2621
  emit_simd_arith(0x60, dst, src, VEX_SIMD_66);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2622
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2623
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2624
void Assembler::punpcklbw(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2625
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2626
  emit_simd_arith(0x60, dst, src, VEX_SIMD_66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2627
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2628
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2629
void Assembler::punpckldq(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2630
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2631
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2632
  emit_simd_arith(0x62, dst, src, VEX_SIMD_66);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2633
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2634
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2635
void Assembler::punpckldq(XMMRegister dst, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2636
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2637
  emit_simd_arith(0x62, dst, src, VEX_SIMD_66);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2638
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2639
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  2640
void Assembler::punpcklqdq(XMMRegister dst, XMMRegister src) {
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  2641
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2642
  emit_simd_arith(0x6C, dst, src, VEX_SIMD_66);
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  2643
}
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  2644
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2645
void Assembler::push(int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2646
  // in 64bits we push 64bits onto the stack but only
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2647
  // take a 32bit immediate
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2648
  emit_int8(0x68);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  2649
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2650
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2651
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2652
void Assembler::push(Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2653
  int encode = prefix_and_encode(src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2654
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2655
  emit_int8(0x50 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2656
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2657
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2658
void Assembler::pushf() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2659
  emit_int8((unsigned char)0x9C);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2660
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2661
4430
95b539dfa1e8 6769124: various 64-bit fixes for c1
roland
parents: 4019
diff changeset
  2662
#ifndef _LP64 // no 32bit push/pop on amd64
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2663
void Assembler::pushl(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2664
  // Note this will push 64bit on 64bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2665
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2666
  prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2667
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2668
  emit_operand(rsi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2669
}
4430
95b539dfa1e8 6769124: various 64-bit fixes for c1
roland
parents: 4019
diff changeset
  2670
#endif
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2671
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2672
void Assembler::rcll(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2673
  assert(isShiftCount(imm8), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2674
  int encode = prefix_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2675
  if (imm8 == 1) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2676
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2677
    emit_int8((unsigned char)(0xD0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2678
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2679
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2680
    emit_int8((unsigned char)0xD0 | encode);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2681
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2682
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2683
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2684
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2685
void Assembler::rdtsc() {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2686
  emit_int8((unsigned char)0x0F);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2687
  emit_int8((unsigned char)0x31);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2688
}
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2689
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2690
// copies data from [esi] to [edi] using rcx pointer sized words
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2691
// generic
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2692
void Assembler::rep_mov() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2693
  emit_int8((unsigned char)0xF3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2694
  // MOVSQ
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2695
  LP64_ONLY(prefix(REX_W));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2696
  emit_int8((unsigned char)0xA5);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2697
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2698
15114
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  2699
// sets rcx bytes with rax, value at [edi]
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  2700
void Assembler::rep_stosb() {
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  2701
  emit_int8((unsigned char)0xF3); // REP
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  2702
  LP64_ONLY(prefix(REX_W));
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  2703
  emit_int8((unsigned char)0xAA); // STOSB
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  2704
}
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  2705
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2706
// sets rcx pointer sized words with rax, value at [edi]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2707
// generic
15114
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  2708
void Assembler::rep_stos() {
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  2709
  emit_int8((unsigned char)0xF3); // REP
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  2710
  LP64_ONLY(prefix(REX_W));       // LP64:STOSQ, LP32:STOSD
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2711
  emit_int8((unsigned char)0xAB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2712
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2713
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2714
// scans rcx pointer sized words at [edi] for occurance of rax,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2715
// generic
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2716
void Assembler::repne_scan() { // repne_scan
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2717
  emit_int8((unsigned char)0xF2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2718
  // SCASQ
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2719
  LP64_ONLY(prefix(REX_W));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2720
  emit_int8((unsigned char)0xAF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2721
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2722
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2723
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2724
// scans rcx 4 byte words at [edi] for occurance of rax,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2725
// generic
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2726
void Assembler::repne_scanl() { // repne_scan
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2727
  emit_int8((unsigned char)0xF2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2728
  // SCASL
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2729
  emit_int8((unsigned char)0xAF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2730
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2731
#endif
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2732
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2733
void Assembler::ret(int imm16) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2734
  if (imm16 == 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2735
    emit_int8((unsigned char)0xC3);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2736
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2737
    emit_int8((unsigned char)0xC2);
14831
84828ee2a91c 8004536: replace AbstractAssembler emit_word with emit_int16
twisti
parents: 14626
diff changeset
  2738
    emit_int16(imm16);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2739
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2740
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2741
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2742
void Assembler::sahf() {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2743
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2744
  // Not supported in 64bit mode
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2745
  ShouldNotReachHere();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2746
#endif
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2747
  emit_int8((unsigned char)0x9E);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2748
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2749
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2750
void Assembler::sarl(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2751
  int encode = prefix_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2752
  assert(isShiftCount(imm8), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2753
  if (imm8 == 1) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2754
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2755
    emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2756
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2757
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2758
    emit_int8((unsigned char)(0xF8 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2759
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2760
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2761
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2762
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2763
void Assembler::sarl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2764
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2765
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2766
  emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2767
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2768
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2769
void Assembler::sbbl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2770
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2771
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2772
  emit_arith_operand(0x81, rbx, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2773
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2774
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2775
void Assembler::sbbl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2776
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2777
  emit_arith(0x81, 0xD8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2778
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2779
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2780
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2781
void Assembler::sbbl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2782
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2783
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2784
  emit_int8(0x1B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2785
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2786
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2787
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2788
void Assembler::sbbl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2789
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2790
  emit_arith(0x1B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2791
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2792
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2793
void Assembler::setb(Condition cc, Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2794
  assert(0 <= cc && cc < 16, "illegal cc");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2795
  int encode = prefix_and_encode(dst->encoding(), true);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2796
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2797
  emit_int8((unsigned char)0x90 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2798
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2799
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2800
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2801
void Assembler::shll(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2802
  assert(isShiftCount(imm8), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2803
  int encode = prefix_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2804
  if (imm8 == 1 ) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2805
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2806
    emit_int8((unsigned char)(0xE0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2807
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2808
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2809
    emit_int8((unsigned char)(0xE0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2810
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2811
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2812
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2813
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2814
void Assembler::shll(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2815
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2816
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2817
  emit_int8((unsigned char)(0xE0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2818
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2819
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2820
void Assembler::shrl(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2821
  assert(isShiftCount(imm8), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2822
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2823
  emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2824
  emit_int8((unsigned char)(0xE8 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2825
  emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2826
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2827
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2828
void Assembler::shrl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2829
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2830
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2831
  emit_int8((unsigned char)(0xE8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2832
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2833
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2834
// copies a single word from [esi] to [edi]
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2835
void Assembler::smovl() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2836
  emit_int8((unsigned char)0xA5);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2837
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2838
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2839
void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2840
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2841
  emit_simd_arith(0x51, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2842
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2843
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  2844
void Assembler::sqrtsd(XMMRegister dst, Address src) {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  2845
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2846
  emit_simd_arith(0x51, dst, src, VEX_SIMD_F2);
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  2847
}
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  2848
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  2849
void Assembler::sqrtss(XMMRegister dst, XMMRegister src) {
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2850
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2851
  emit_simd_arith(0x51, dst, src, VEX_SIMD_F3);
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  2852
}
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  2853
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  2854
void Assembler::std() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2855
  emit_int8((unsigned char)0xFD);
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  2856
}
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  2857
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  2858
void Assembler::sqrtss(XMMRegister dst, Address src) {
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  2859
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2860
  emit_simd_arith(0x51, dst, src, VEX_SIMD_F3);
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  2861
}
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  2862
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2863
void Assembler::stmxcsr( Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2864
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2865
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2866
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2867
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2868
  emit_int8((unsigned char)0xAE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2869
  emit_operand(as_Register(3), dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2870
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2871
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2872
void Assembler::subl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2873
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2874
  prefix(dst);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  2875
  emit_arith_operand(0x81, rbp, dst, imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2876
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2877
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2878
void Assembler::subl(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2879
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2880
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2881
  emit_int8(0x29);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2882
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2883
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2884
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  2885
void Assembler::subl(Register dst, int32_t imm32) {
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  2886
  prefix(dst);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  2887
  emit_arith(0x81, 0xE8, dst, imm32);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  2888
}
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  2889
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  2890
// Force generation of a 4 byte immediate value even if it fits into 8bit
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  2891
void Assembler::subl_imm32(Register dst, int32_t imm32) {
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  2892
  prefix(dst);
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  2893
  emit_arith_imm32(0x81, 0xE8, dst, imm32);
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  2894
}
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  2895
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2896
void Assembler::subl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2897
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2898
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2899
  emit_int8(0x2B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2900
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2901
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2902
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2903
void Assembler::subl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2904
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2905
  emit_arith(0x2B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2906
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2907
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2908
void Assembler::subsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2909
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2910
  emit_simd_arith(0x5C, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2911
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2912
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2913
void Assembler::subsd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2914
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2915
  emit_simd_arith(0x5C, dst, src, VEX_SIMD_F2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2916
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2917
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2918
void Assembler::subss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2919
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2920
  emit_simd_arith(0x5C, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2921
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2922
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2923
void Assembler::subss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2924
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2925
  emit_simd_arith(0x5C, dst, src, VEX_SIMD_F3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2926
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2927
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2928
void Assembler::testb(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2929
  NOT_LP64(assert(dst->has_byte_register(), "must have byte register"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2930
  (void) prefix_and_encode(dst->encoding(), true);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2931
  emit_arith_b(0xF6, 0xC0, dst, imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2932
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2933
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2934
void Assembler::testl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2935
  // not using emit_arith because test
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2936
  // doesn't support sign-extension of
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2937
  // 8bit operands
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2938
  int encode = dst->encoding();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2939
  if (encode == 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2940
    emit_int8((unsigned char)0xA9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2941
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2942
    encode = prefix_and_encode(encode);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2943
    emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2944
    emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2945
  }
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  2946
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2947
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2948
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2949
void Assembler::testl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2950
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2951
  emit_arith(0x85, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2952
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2953
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2954
void Assembler::testl(Register dst, Address  src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2955
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2956
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2957
  emit_int8((unsigned char)0x85);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2958
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2959
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2960
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2961
void Assembler::tzcntl(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2962
  assert(VM_Version::supports_bmi1(), "tzcnt instruction not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2963
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2964
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2965
  emit_int8(0x0F);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2966
  emit_int8((unsigned char)0xBC);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2967
  emit_int8((unsigned char)0xC0 | encode);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2968
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2969
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2970
void Assembler::tzcntq(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2971
  assert(VM_Version::supports_bmi1(), "tzcnt instruction not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2972
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2973
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2974
  emit_int8(0x0F);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2975
  emit_int8((unsigned char)0xBC);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2976
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2977
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  2978
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2979
void Assembler::ucomisd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2980
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2981
  emit_simd_arith_nonds(0x2E, dst, src, VEX_SIMD_66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2982
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2983
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2984
void Assembler::ucomisd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2985
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2986
  emit_simd_arith_nonds(0x2E, dst, src, VEX_SIMD_66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2987
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2988
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2989
void Assembler::ucomiss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2990
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2991
  emit_simd_arith_nonds(0x2E, dst, src, VEX_SIMD_NONE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2992
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2993
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2994
void Assembler::ucomiss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2995
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  2996
  emit_simd_arith_nonds(0x2E, dst, src, VEX_SIMD_NONE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2997
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2998
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  2999
void Assembler::xabort(int8_t imm8) {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3000
  emit_int8((unsigned char)0xC6);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3001
  emit_int8((unsigned char)0xF8);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3002
  emit_int8((unsigned char)(imm8 & 0xFF));
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3003
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3004
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3005
void Assembler::xaddl(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3006
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3007
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3008
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3009
  emit_int8((unsigned char)0xC1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3010
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3011
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3012
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3013
void Assembler::xbegin(Label& abort, relocInfo::relocType rtype) {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3014
  InstructionMark im(this);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3015
  relocate(rtype);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3016
  if (abort.is_bound()) {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3017
    address entry = target(abort);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3018
    assert(entry != NULL, "abort entry NULL");
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3019
    intptr_t offset = entry - pc();
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3020
    emit_int8((unsigned char)0xC7);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3021
    emit_int8((unsigned char)0xF8);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3022
    emit_int32(offset - 6); // 2 opcode + 4 address
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3023
  } else {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3024
    abort.add_patch_at(code(), locator());
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3025
    emit_int8((unsigned char)0xC7);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3026
    emit_int8((unsigned char)0xF8);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3027
    emit_int32(0);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3028
  }
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3029
}
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3030
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3031
void Assembler::xchgl(Register dst, Address src) { // xchg
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3032
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3033
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3034
  emit_int8((unsigned char)0x87);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3035
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3036
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3037
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3038
void Assembler::xchgl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3039
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3040
  emit_int8((unsigned char)0x87);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3041
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3042
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3043
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3044
void Assembler::xend() {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3045
  emit_int8((unsigned char)0x0F);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3046
  emit_int8((unsigned char)0x01);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3047
  emit_int8((unsigned char)0xD5);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3048
}
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3049
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  3050
void Assembler::xgetbv() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3051
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3052
  emit_int8(0x01);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3053
  emit_int8((unsigned char)0xD0);
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  3054
}
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  3055
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3056
void Assembler::xorl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3057
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3058
  emit_arith(0x81, 0xF0, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3059
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3060
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3061
void Assembler::xorl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3062
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3063
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3064
  emit_int8(0x33);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3065
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3066
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3067
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3068
void Assembler::xorl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3069
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3070
  emit_arith(0x33, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3071
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3072
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3073
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3074
// AVX 3-operands scalar float-point arithmetic instructions
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3075
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3076
void Assembler::vaddsd(XMMRegister dst, XMMRegister nds, Address src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3077
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3078
  emit_vex_arith(0x58, dst, nds, src, VEX_SIMD_F2, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3079
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3080
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3081
void Assembler::vaddsd(XMMRegister dst, XMMRegister nds, XMMRegister src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3082
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3083
  emit_vex_arith(0x58, dst, nds, src, VEX_SIMD_F2, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3084
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3085
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3086
void Assembler::vaddss(XMMRegister dst, XMMRegister nds, Address src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3087
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3088
  emit_vex_arith(0x58, dst, nds, src, VEX_SIMD_F3, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3089
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3090
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3091
void Assembler::vaddss(XMMRegister dst, XMMRegister nds, XMMRegister src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3092
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3093
  emit_vex_arith(0x58, dst, nds, src, VEX_SIMD_F3, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3094
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3095
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3096
void Assembler::vdivsd(XMMRegister dst, XMMRegister nds, Address src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3097
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3098
  emit_vex_arith(0x5E, dst, nds, src, VEX_SIMD_F2, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3099
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3100
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3101
void Assembler::vdivsd(XMMRegister dst, XMMRegister nds, XMMRegister src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3102
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3103
  emit_vex_arith(0x5E, dst, nds, src, VEX_SIMD_F2, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3104
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3105
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3106
void Assembler::vdivss(XMMRegister dst, XMMRegister nds, Address src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3107
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3108
  emit_vex_arith(0x5E, dst, nds, src, VEX_SIMD_F3, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3109
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3110
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3111
void Assembler::vdivss(XMMRegister dst, XMMRegister nds, XMMRegister src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3112
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3113
  emit_vex_arith(0x5E, dst, nds, src, VEX_SIMD_F3, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3114
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3115
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3116
void Assembler::vmulsd(XMMRegister dst, XMMRegister nds, Address src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3117
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3118
  emit_vex_arith(0x59, dst, nds, src, VEX_SIMD_F2, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3119
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3120
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3121
void Assembler::vmulsd(XMMRegister dst, XMMRegister nds, XMMRegister src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3122
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3123
  emit_vex_arith(0x59, dst, nds, src, VEX_SIMD_F2, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3124
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3125
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3126
void Assembler::vmulss(XMMRegister dst, XMMRegister nds, Address src) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3127
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3128
  emit_vex_arith(0x59, dst, nds, src, VEX_SIMD_F3, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3129
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3130
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3131
void Assembler::vmulss(XMMRegister dst, XMMRegister nds, XMMRegister src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3132
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3133
  emit_vex_arith(0x59, dst, nds, src, VEX_SIMD_F3, /* vector256 */ false);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3134
}
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3135
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3136
void Assembler::vsubsd(XMMRegister dst, XMMRegister nds, Address src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3137
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3138
  emit_vex_arith(0x5C, dst, nds, src, VEX_SIMD_F2, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3139
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3140
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3141
void Assembler::vsubsd(XMMRegister dst, XMMRegister nds, XMMRegister src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3142
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3143
  emit_vex_arith(0x5C, dst, nds, src, VEX_SIMD_F2, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3144
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3145
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3146
void Assembler::vsubss(XMMRegister dst, XMMRegister nds, Address src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3147
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3148
  emit_vex_arith(0x5C, dst, nds, src, VEX_SIMD_F3, /* vector256 */ false);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3149
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3150
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3151
void Assembler::vsubss(XMMRegister dst, XMMRegister nds, XMMRegister src) {
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3152
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3153
  emit_vex_arith(0x5C, dst, nds, src, VEX_SIMD_F3, /* vector256 */ false);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3154
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3155
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3156
//====================VECTOR ARITHMETIC=====================================
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3157
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3158
// Float-point vector arithmetic
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3159
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3160
void Assembler::addpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3161
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3162
  emit_simd_arith(0x58, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3163
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3164
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3165
void Assembler::addps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3166
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3167
  emit_simd_arith(0x58, dst, src, VEX_SIMD_NONE);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3168
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3169
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3170
void Assembler::vaddpd(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3171
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3172
  emit_vex_arith(0x58, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3173
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3174
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3175
void Assembler::vaddps(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3176
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3177
  emit_vex_arith(0x58, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3178
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3179
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3180
void Assembler::vaddpd(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3181
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3182
  emit_vex_arith(0x58, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3183
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3184
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3185
void Assembler::vaddps(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3186
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3187
  emit_vex_arith(0x58, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3188
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3189
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3190
void Assembler::subpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3191
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3192
  emit_simd_arith(0x5C, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3193
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3194
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3195
void Assembler::subps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3196
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3197
  emit_simd_arith(0x5C, dst, src, VEX_SIMD_NONE);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3198
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3199
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3200
void Assembler::vsubpd(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3201
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3202
  emit_vex_arith(0x5C, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3203
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3204
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3205
void Assembler::vsubps(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3206
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3207
  emit_vex_arith(0x5C, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3208
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3209
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3210
void Assembler::vsubpd(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3211
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3212
  emit_vex_arith(0x5C, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3213
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3214
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3215
void Assembler::vsubps(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3216
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3217
  emit_vex_arith(0x5C, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3218
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3219
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3220
void Assembler::mulpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3221
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3222
  emit_simd_arith(0x59, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3223
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3224
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3225
void Assembler::mulps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3226
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3227
  emit_simd_arith(0x59, dst, src, VEX_SIMD_NONE);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3228
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3229
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3230
void Assembler::vmulpd(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3231
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3232
  emit_vex_arith(0x59, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3233
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3234
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3235
void Assembler::vmulps(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3236
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3237
  emit_vex_arith(0x59, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3238
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3239
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3240
void Assembler::vmulpd(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3241
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3242
  emit_vex_arith(0x59, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3243
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3244
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3245
void Assembler::vmulps(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3246
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3247
  emit_vex_arith(0x59, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3248
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3249
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3250
void Assembler::divpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3251
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3252
  emit_simd_arith(0x5E, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3253
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3254
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3255
void Assembler::divps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3256
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3257
  emit_simd_arith(0x5E, dst, src, VEX_SIMD_NONE);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3258
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3259
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3260
void Assembler::vdivpd(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3261
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3262
  emit_vex_arith(0x5E, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3263
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3264
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3265
void Assembler::vdivps(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3266
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3267
  emit_vex_arith(0x5E, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3268
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3269
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3270
void Assembler::vdivpd(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3271
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3272
  emit_vex_arith(0x5E, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3273
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3274
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3275
void Assembler::vdivps(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3276
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3277
  emit_vex_arith(0x5E, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3278
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3279
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3280
void Assembler::andpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3281
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3282
  emit_simd_arith(0x54, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3283
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3284
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3285
void Assembler::andps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3286
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3287
  emit_simd_arith(0x54, dst, src, VEX_SIMD_NONE);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3288
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3289
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3290
void Assembler::andps(XMMRegister dst, Address src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3291
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3292
  emit_simd_arith(0x54, dst, src, VEX_SIMD_NONE);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3293
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3294
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3295
void Assembler::andpd(XMMRegister dst, Address src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3296
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3297
  emit_simd_arith(0x54, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3298
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3299
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3300
void Assembler::vandpd(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3301
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3302
  emit_vex_arith(0x54, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3303
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3304
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3305
void Assembler::vandps(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3306
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3307
  emit_vex_arith(0x54, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3308
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3309
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3310
void Assembler::vandpd(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3311
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3312
  emit_vex_arith(0x54, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3313
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3314
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3315
void Assembler::vandps(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3316
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3317
  emit_vex_arith(0x54, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3318
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3319
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3320
void Assembler::xorpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3321
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3322
  emit_simd_arith(0x57, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3323
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3324
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3325
void Assembler::xorps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3326
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3327
  emit_simd_arith(0x57, dst, src, VEX_SIMD_NONE);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3328
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3329
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3330
void Assembler::xorpd(XMMRegister dst, Address src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3331
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3332
  emit_simd_arith(0x57, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3333
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3334
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3335
void Assembler::xorps(XMMRegister dst, Address src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3336
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3337
  emit_simd_arith(0x57, dst, src, VEX_SIMD_NONE);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3338
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3339
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3340
void Assembler::vxorpd(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3341
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3342
  emit_vex_arith(0x57, dst, nds, src, VEX_SIMD_66, vector256);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3343
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3344
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3345
void Assembler::vxorps(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3346
  assert(VM_Version::supports_avx(), "");
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3347
  emit_vex_arith(0x57, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3348
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3349
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3350
void Assembler::vxorpd(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3351
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3352
  emit_vex_arith(0x57, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3353
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3354
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3355
void Assembler::vxorps(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3356
  assert(VM_Version::supports_avx(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3357
  emit_vex_arith(0x57, dst, nds, src, VEX_SIMD_NONE, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3358
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3359
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3360
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3361
// Integer vector arithmetic
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3362
void Assembler::paddb(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3363
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3364
  emit_simd_arith(0xFC, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3365
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3366
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3367
void Assembler::paddw(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3368
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3369
  emit_simd_arith(0xFD, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3370
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3371
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3372
void Assembler::paddd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3373
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3374
  emit_simd_arith(0xFE, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3375
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3376
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3377
void Assembler::paddq(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3378
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3379
  emit_simd_arith(0xD4, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3380
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3381
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3382
void Assembler::vpaddb(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3383
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3384
  emit_vex_arith(0xFC, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3385
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3386
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3387
void Assembler::vpaddw(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3388
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3389
  emit_vex_arith(0xFD, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3390
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3391
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3392
void Assembler::vpaddd(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3393
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3394
  emit_vex_arith(0xFE, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3395
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3396
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3397
void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3398
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3399
  emit_vex_arith(0xD4, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3400
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3401
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3402
void Assembler::vpaddb(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3403
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3404
  emit_vex_arith(0xFC, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3405
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3406
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3407
void Assembler::vpaddw(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3408
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3409
  emit_vex_arith(0xFD, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3410
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3411
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3412
void Assembler::vpaddd(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3413
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3414
  emit_vex_arith(0xFE, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3415
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3416
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3417
void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3418
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3419
  emit_vex_arith(0xD4, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3420
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3421
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3422
void Assembler::psubb(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3423
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3424
  emit_simd_arith(0xF8, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3425
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3426
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3427
void Assembler::psubw(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3428
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3429
  emit_simd_arith(0xF9, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3430
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3431
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3432
void Assembler::psubd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3433
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3434
  emit_simd_arith(0xFA, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3435
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3436
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3437
void Assembler::psubq(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3438
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3439
  emit_simd_arith(0xFB, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3440
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3441
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3442
void Assembler::vpsubb(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3443
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3444
  emit_vex_arith(0xF8, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3445
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3446
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3447
void Assembler::vpsubw(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3448
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3449
  emit_vex_arith(0xF9, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3450
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3451
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3452
void Assembler::vpsubd(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3453
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3454
  emit_vex_arith(0xFA, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3455
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3456
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3457
void Assembler::vpsubq(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3458
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3459
  emit_vex_arith(0xFB, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3460
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3461
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3462
void Assembler::vpsubb(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3463
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3464
  emit_vex_arith(0xF8, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3465
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3466
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3467
void Assembler::vpsubw(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3468
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3469
  emit_vex_arith(0xF9, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3470
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3471
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3472
void Assembler::vpsubd(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3473
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3474
  emit_vex_arith(0xFA, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3475
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3476
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3477
void Assembler::vpsubq(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3478
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3479
  emit_vex_arith(0xFB, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3480
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3481
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3482
void Assembler::pmullw(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3483
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3484
  emit_simd_arith(0xD5, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3485
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3486
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3487
void Assembler::pmulld(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3488
  assert(VM_Version::supports_sse4_1(), "");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3489
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3490
  emit_int8(0x40);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3491
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3492
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3493
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3494
void Assembler::vpmullw(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3495
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3496
  emit_vex_arith(0xD5, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3497
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3498
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3499
void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3500
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3501
  int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_38);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3502
  emit_int8(0x40);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3503
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3504
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3505
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3506
void Assembler::vpmullw(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3507
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3508
  emit_vex_arith(0xD5, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3509
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3510
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3511
void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3512
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3513
  InstructionMark im(this);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3514
  int dst_enc = dst->encoding();
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3515
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3516
  vex_prefix(src, nds_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_38, false, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3517
  emit_int8(0x40);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3518
  emit_operand(dst, src);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3519
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3520
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3521
// Shift packed integers left by specified number of bits.
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3522
void Assembler::psllw(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3523
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3524
  // XMM6 is for /6 encoding: 66 0F 71 /6 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3525
  int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3526
  emit_int8(0x71);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3527
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3528
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3529
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3530
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3531
void Assembler::pslld(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3532
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3533
  // XMM6 is for /6 encoding: 66 0F 72 /6 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3534
  int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3535
  emit_int8(0x72);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3536
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3537
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3538
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3539
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3540
void Assembler::psllq(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3541
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3542
  // XMM6 is for /6 encoding: 66 0F 73 /6 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3543
  int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3544
  emit_int8(0x73);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3545
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3546
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3547
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3548
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3549
void Assembler::psllw(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3550
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3551
  emit_simd_arith(0xF1, dst, shift, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3552
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3553
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3554
void Assembler::pslld(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3555
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3556
  emit_simd_arith(0xF2, dst, shift, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3557
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3558
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3559
void Assembler::psllq(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3560
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3561
  emit_simd_arith(0xF3, dst, shift, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3562
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3563
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3564
void Assembler::vpsllw(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3565
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3566
  // XMM6 is for /6 encoding: 66 0F 71 /6 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3567
  emit_vex_arith(0x71, xmm6, dst, src, VEX_SIMD_66, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3568
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3569
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3570
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3571
void Assembler::vpslld(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3572
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3573
  // XMM6 is for /6 encoding: 66 0F 72 /6 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3574
  emit_vex_arith(0x72, xmm6, dst, src, VEX_SIMD_66, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3575
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3576
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3577
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3578
void Assembler::vpsllq(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3579
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3580
  // XMM6 is for /6 encoding: 66 0F 73 /6 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3581
  emit_vex_arith(0x73, xmm6, dst, src, VEX_SIMD_66, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3582
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3583
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3584
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3585
void Assembler::vpsllw(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3586
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3587
  emit_vex_arith(0xF1, dst, src, shift, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3588
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3589
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3590
void Assembler::vpslld(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3591
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3592
  emit_vex_arith(0xF2, dst, src, shift, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3593
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3594
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3595
void Assembler::vpsllq(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3596
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3597
  emit_vex_arith(0xF3, dst, src, shift, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3598
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3599
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3600
// Shift packed integers logically right by specified number of bits.
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3601
void Assembler::psrlw(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3602
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3603
  // XMM2 is for /2 encoding: 66 0F 71 /2 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3604
  int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3605
  emit_int8(0x71);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3606
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3607
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3608
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3609
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3610
void Assembler::psrld(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3611
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3612
  // XMM2 is for /2 encoding: 66 0F 72 /2 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3613
  int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3614
  emit_int8(0x72);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3615
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3616
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3617
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3618
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3619
void Assembler::psrlq(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3620
  // Do not confuse it with psrldq SSE2 instruction which
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3621
  // shifts 128 bit value in xmm register by number of bytes.
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3622
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3623
  // XMM2 is for /2 encoding: 66 0F 73 /2 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3624
  int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3625
  emit_int8(0x73);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3626
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3627
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3628
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3629
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3630
void Assembler::psrlw(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3631
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3632
  emit_simd_arith(0xD1, dst, shift, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3633
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3634
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3635
void Assembler::psrld(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3636
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3637
  emit_simd_arith(0xD2, dst, shift, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3638
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3639
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3640
void Assembler::psrlq(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3641
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3642
  emit_simd_arith(0xD3, dst, shift, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3643
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3644
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3645
void Assembler::vpsrlw(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3646
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3647
  // XMM2 is for /2 encoding: 66 0F 73 /2 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3648
  emit_vex_arith(0x71, xmm2, dst, src, VEX_SIMD_66, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3649
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3650
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3651
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3652
void Assembler::vpsrld(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3653
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3654
  // XMM2 is for /2 encoding: 66 0F 73 /2 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3655
  emit_vex_arith(0x72, xmm2, dst, src, VEX_SIMD_66, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3656
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3657
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3658
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3659
void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3660
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3661
  // XMM2 is for /2 encoding: 66 0F 73 /2 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3662
  emit_vex_arith(0x73, xmm2, dst, src, VEX_SIMD_66, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3663
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3664
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3665
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3666
void Assembler::vpsrlw(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3667
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3668
  emit_vex_arith(0xD1, dst, src, shift, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3669
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3670
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3671
void Assembler::vpsrld(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3672
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3673
  emit_vex_arith(0xD2, dst, src, shift, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3674
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3675
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3676
void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3677
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3678
  emit_vex_arith(0xD3, dst, src, shift, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3679
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3680
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3681
// Shift packed integers arithmetically right by specified number of bits.
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3682
void Assembler::psraw(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3683
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3684
  // XMM4 is for /4 encoding: 66 0F 71 /4 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3685
  int encode = simd_prefix_and_encode(xmm4, dst, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3686
  emit_int8(0x71);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3687
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3688
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3689
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3690
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3691
void Assembler::psrad(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3692
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3693
  // XMM4 is for /4 encoding: 66 0F 72 /4 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3694
  int encode = simd_prefix_and_encode(xmm4, dst, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3695
  emit_int8(0x72);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3696
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3697
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3698
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3699
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3700
void Assembler::psraw(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3701
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3702
  emit_simd_arith(0xE1, dst, shift, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3703
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3704
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3705
void Assembler::psrad(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3706
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3707
  emit_simd_arith(0xE2, dst, shift, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3708
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3709
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3710
void Assembler::vpsraw(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3711
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3712
  // XMM4 is for /4 encoding: 66 0F 71 /4 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3713
  emit_vex_arith(0x71, xmm4, dst, src, VEX_SIMD_66, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3714
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3715
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3716
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3717
void Assembler::vpsrad(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3718
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3719
  // XMM4 is for /4 encoding: 66 0F 71 /4 ib
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3720
  emit_vex_arith(0x72, xmm4, dst, src, VEX_SIMD_66, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3721
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3722
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3723
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3724
void Assembler::vpsraw(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3725
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3726
  emit_vex_arith(0xE1, dst, src, shift, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3727
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3728
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3729
void Assembler::vpsrad(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3730
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3731
  emit_vex_arith(0xE2, dst, src, shift, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3732
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3733
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3734
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3735
// AND packed integers
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3736
void Assembler::pand(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3737
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3738
  emit_simd_arith(0xDB, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3739
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3740
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3741
void Assembler::vpand(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3742
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3743
  emit_vex_arith(0xDB, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3744
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3745
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3746
void Assembler::vpand(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3747
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3748
  emit_vex_arith(0xDB, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3749
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3750
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3751
void Assembler::por(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3752
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3753
  emit_simd_arith(0xEB, dst, src, VEX_SIMD_66);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3754
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3755
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3756
void Assembler::vpor(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3757
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3758
  emit_vex_arith(0xEB, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3759
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3760
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3761
void Assembler::vpor(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3762
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3763
  emit_vex_arith(0xEB, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3764
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3765
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3766
void Assembler::pxor(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3767
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3768
  emit_simd_arith(0xEF, dst, src, VEX_SIMD_66);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3769
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3770
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3771
void Assembler::vpxor(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3772
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3773
  emit_vex_arith(0xEF, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3774
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3775
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3776
void Assembler::vpxor(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3777
  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3778
  emit_vex_arith(0xEF, dst, nds, src, VEX_SIMD_66, vector256);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3779
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  3780
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3781
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3782
void Assembler::vinsertf128h(XMMRegister dst, XMMRegister nds, XMMRegister src) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3783
  assert(VM_Version::supports_avx(), "");
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3784
  bool vector256 = true;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3785
  int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_3A);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3786
  emit_int8(0x18);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3787
  emit_int8((unsigned char)(0xC0 | encode));
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3788
  // 0x00 - insert into lower 128 bits
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3789
  // 0x01 - insert into upper 128 bits
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3790
  emit_int8(0x01);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3791
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3792
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3793
void Assembler::vinsertf128h(XMMRegister dst, Address src) {
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3794
  assert(VM_Version::supports_avx(), "");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3795
  InstructionMark im(this);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3796
  bool vector256 = true;
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3797
  assert(dst != xnoreg, "sanity");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3798
  int dst_enc = dst->encoding();
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3799
  // swap src<->dst for encoding
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3800
  vex_prefix(src, dst_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3801
  emit_int8(0x18);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3802
  emit_operand(dst, src);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3803
  // 0x01 - insert into upper 128 bits
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3804
  emit_int8(0x01);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3805
}
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3806
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3807
void Assembler::vextractf128h(Address dst, XMMRegister src) {
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3808
  assert(VM_Version::supports_avx(), "");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3809
  InstructionMark im(this);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3810
  bool vector256 = true;
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3811
  assert(src != xnoreg, "sanity");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3812
  int src_enc = src->encoding();
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3813
  vex_prefix(dst, 0, src_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3814
  emit_int8(0x19);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3815
  emit_operand(src, dst);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3816
  // 0x01 - extract from upper 128 bits
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3817
  emit_int8(0x01);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3818
}
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3819
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3820
void Assembler::vinserti128h(XMMRegister dst, XMMRegister nds, XMMRegister src) {
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3821
  assert(VM_Version::supports_avx2(), "");
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3822
  bool vector256 = true;
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3823
  int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_3A);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3824
  emit_int8(0x38);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3825
  emit_int8((unsigned char)(0xC0 | encode));
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3826
  // 0x00 - insert into lower 128 bits
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3827
  // 0x01 - insert into upper 128 bits
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3828
  emit_int8(0x01);
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3829
}
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3830
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3831
void Assembler::vinserti128h(XMMRegister dst, Address src) {
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3832
  assert(VM_Version::supports_avx2(), "");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3833
  InstructionMark im(this);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3834
  bool vector256 = true;
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3835
  assert(dst != xnoreg, "sanity");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3836
  int dst_enc = dst->encoding();
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3837
  // swap src<->dst for encoding
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3838
  vex_prefix(src, dst_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3839
  emit_int8(0x38);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3840
  emit_operand(dst, src);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3841
  // 0x01 - insert into upper 128 bits
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3842
  emit_int8(0x01);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3843
}
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3844
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3845
void Assembler::vextracti128h(Address dst, XMMRegister src) {
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3846
  assert(VM_Version::supports_avx2(), "");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3847
  InstructionMark im(this);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3848
  bool vector256 = true;
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3849
  assert(src != xnoreg, "sanity");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3850
  int src_enc = src->encoding();
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3851
  vex_prefix(dst, 0, src_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3852
  emit_int8(0x39);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3853
  emit_operand(src, dst);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3854
  // 0x01 - extract from upper 128 bits
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3855
  emit_int8(0x01);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3856
}
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  3857
15115
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  3858
// duplicate 4-bytes integer data from src into 8 locations in dest
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  3859
void Assembler::vpbroadcastd(XMMRegister dst, XMMRegister src) {
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  3860
  assert(VM_Version::supports_avx2(), "");
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  3861
  bool vector256 = true;
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  3862
  int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_38);
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  3863
  emit_int8(0x58);
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  3864
  emit_int8((unsigned char)(0xC0 | encode));
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  3865
}
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  3866
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3867
// Carry-Less Multiplication Quadword
25932
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  3868
void Assembler::pclmulqdq(XMMRegister dst, XMMRegister src, int mask) {
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  3869
  assert(VM_Version::supports_clmul(), "");
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  3870
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A);
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  3871
  emit_int8(0x44);
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  3872
  emit_int8((unsigned char)(0xC0 | encode));
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  3873
  emit_int8((unsigned char)mask);
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  3874
}
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  3875
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  3876
// Carry-Less Multiplication Quadword
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3877
void Assembler::vpclmulqdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int mask) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3878
  assert(VM_Version::supports_avx() && VM_Version::supports_clmul(), "");
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3879
  bool vector256 = false;
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3880
  int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_3A);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3881
  emit_int8(0x44);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3882
  emit_int8((unsigned char)(0xC0 | encode));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3883
  emit_int8((unsigned char)mask);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3884
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3885
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3886
void Assembler::vzeroupper() {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3887
  assert(VM_Version::supports_avx(), "");
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3888
  (void)vex_prefix_and_encode(xmm0, xmm0, xmm0, VEX_SIMD_NONE);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3889
  emit_int8(0x77);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3890
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  3891
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  3892
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3893
#ifndef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3894
// 32bit only pieces of the assembler
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3895
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3896
void Assembler::cmp_literal32(Register src1, int32_t imm32, RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3897
  // NO PREFIX AS NEVER 64BIT
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3898
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3899
  emit_int8((unsigned char)0x81);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3900
  emit_int8((unsigned char)(0xF8 | src1->encoding()));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3901
  emit_data(imm32, rspec, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3902
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3903
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3904
void Assembler::cmp_literal32(Address src1, int32_t imm32, RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3905
  // NO PREFIX AS NEVER 64BIT (not even 32bit versions of 64bit regs
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3906
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3907
  emit_int8((unsigned char)0x81);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3908
  emit_operand(rdi, src1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3909
  emit_data(imm32, rspec, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3910
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3911
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3912
// The 64-bit (32bit platform) cmpxchg compares the value at adr with the contents of rdx:rax,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3913
// and stores rcx:rbx into adr if so; otherwise, the value at adr is loaded
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3914
// into rdx:rax.  The ZF is set if the compared values were equal, and cleared otherwise.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3915
void Assembler::cmpxchg8(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3916
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3917
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3918
  emit_int8((unsigned char)0xC7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3919
  emit_operand(rcx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3920
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3921
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3922
void Assembler::decl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3923
  // Don't use it directly. Use MacroAssembler::decrementl() instead.
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3924
 emit_int8(0x48 | dst->encoding());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3925
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3926
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3927
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3928
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3929
// 64bit typically doesn't use the x87 but needs to for the trig funcs
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3930
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3931
void Assembler::fabs() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3932
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3933
  emit_int8((unsigned char)0xE1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3934
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3935
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3936
void Assembler::fadd(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3937
  emit_farith(0xD8, 0xC0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3938
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3939
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3940
void Assembler::fadd_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3941
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3942
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3943
  emit_operand32(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3944
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3945
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3946
void Assembler::fadd_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3947
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3948
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3949
  emit_operand32(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3950
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3951
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3952
void Assembler::fadda(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3953
  emit_farith(0xDC, 0xC0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3954
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3955
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3956
void Assembler::faddp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3957
  emit_farith(0xDE, 0xC0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3958
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3959
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3960
void Assembler::fchs() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3961
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3962
  emit_int8((unsigned char)0xE0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3963
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3964
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3965
void Assembler::fcom(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3966
  emit_farith(0xD8, 0xD0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3967
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3968
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3969
void Assembler::fcomp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3970
  emit_farith(0xD8, 0xD8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3971
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3972
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3973
void Assembler::fcomp_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3974
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3975
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3976
  emit_operand32(rbx, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3977
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3978
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3979
void Assembler::fcomp_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3980
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3981
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3982
  emit_operand32(rbx, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3983
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3984
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3985
void Assembler::fcompp() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3986
  emit_int8((unsigned char)0xDE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3987
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3988
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3989
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3990
void Assembler::fcos() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3991
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3992
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3993
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3994
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3995
void Assembler::fdecstp() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3996
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3997
  emit_int8((unsigned char)0xF6);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3998
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3999
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4000
void Assembler::fdiv(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4001
  emit_farith(0xD8, 0xF0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4002
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4003
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4004
void Assembler::fdiv_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4005
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4006
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4007
  emit_operand32(rsi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4008
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4009
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4010
void Assembler::fdiv_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4011
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4012
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4013
  emit_operand32(rsi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4014
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4015
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4016
void Assembler::fdiva(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4017
  emit_farith(0xDC, 0xF8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4018
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4019
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4020
// Note: The Intel manual (Pentium Processor User's Manual, Vol.3, 1994)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4021
//       is erroneous for some of the floating-point instructions below.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4022
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4023
void Assembler::fdivp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4024
  emit_farith(0xDE, 0xF8, i);                    // ST(0) <- ST(0) / ST(1) and pop (Intel manual wrong)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4025
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4026
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4027
void Assembler::fdivr(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4028
  emit_farith(0xD8, 0xF8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4029
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4030
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4031
void Assembler::fdivr_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4032
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4033
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4034
  emit_operand32(rdi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4035
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4036
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4037
void Assembler::fdivr_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4038
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4039
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4040
  emit_operand32(rdi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4041
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4042
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4043
void Assembler::fdivra(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4044
  emit_farith(0xDC, 0xF0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4045
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4046
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4047
void Assembler::fdivrp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4048
  emit_farith(0xDE, 0xF0, i);                    // ST(0) <- ST(1) / ST(0) and pop (Intel manual wrong)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4049
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4050
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4051
void Assembler::ffree(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4052
  emit_farith(0xDD, 0xC0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4053
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4054
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4055
void Assembler::fild_d(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4056
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4057
  emit_int8((unsigned char)0xDF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4058
  emit_operand32(rbp, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4059
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4060
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4061
void Assembler::fild_s(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4062
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4063
  emit_int8((unsigned char)0xDB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4064
  emit_operand32(rax, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4065
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4067
void Assembler::fincstp() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4068
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4069
  emit_int8((unsigned char)0xF7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4070
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4071
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4072
void Assembler::finit() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4073
  emit_int8((unsigned char)0x9B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4074
  emit_int8((unsigned char)0xDB);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4075
  emit_int8((unsigned char)0xE3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4076
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4077
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4078
void Assembler::fist_s(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4079
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4080
  emit_int8((unsigned char)0xDB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4081
  emit_operand32(rdx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4082
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4083
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4084
void Assembler::fistp_d(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4085
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4086
  emit_int8((unsigned char)0xDF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4087
  emit_operand32(rdi, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4088
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4089
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4090
void Assembler::fistp_s(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4091
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4092
  emit_int8((unsigned char)0xDB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4093
  emit_operand32(rbx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4094
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4095
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4096
void Assembler::fld1() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4097
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4098
  emit_int8((unsigned char)0xE8);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4099
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4100
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4101
void Assembler::fld_d(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4102
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4103
  emit_int8((unsigned char)0xDD);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4104
  emit_operand32(rax, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4105
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4106
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4107
void Assembler::fld_s(Address adr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4108
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4109
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4110
  emit_operand32(rax, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4111
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4112
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4113
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4114
void Assembler::fld_s(int index) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4115
  emit_farith(0xD9, 0xC0, index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4116
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4117
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4118
void Assembler::fld_x(Address adr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4119
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4120
  emit_int8((unsigned char)0xDB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4121
  emit_operand32(rbp, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4122
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4123
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4124
void Assembler::fldcw(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4125
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4126
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4127
  emit_operand32(rbp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4128
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4129
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4130
void Assembler::fldenv(Address src) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4131
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4132
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4133
  emit_operand32(rsp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4134
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4135
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4136
void Assembler::fldlg2() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4137
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4138
  emit_int8((unsigned char)0xEC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4139
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4140
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4141
void Assembler::fldln2() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4142
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4143
  emit_int8((unsigned char)0xED);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4144
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4145
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4146
void Assembler::fldz() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4147
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4148
  emit_int8((unsigned char)0xEE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4149
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4150
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4151
void Assembler::flog() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4152
  fldln2();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4153
  fxch();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4154
  fyl2x();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4155
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4156
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4157
void Assembler::flog10() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4158
  fldlg2();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4159
  fxch();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4160
  fyl2x();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4161
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4162
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4163
void Assembler::fmul(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4164
  emit_farith(0xD8, 0xC8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4165
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4166
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4167
void Assembler::fmul_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4168
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4169
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4170
  emit_operand32(rcx, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4171
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4172
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4173
void Assembler::fmul_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4174
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4175
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4176
  emit_operand32(rcx, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4177
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4178
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4179
void Assembler::fmula(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4180
  emit_farith(0xDC, 0xC8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4181
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4182
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4183
void Assembler::fmulp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4184
  emit_farith(0xDE, 0xC8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4185
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4186
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4187
void Assembler::fnsave(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4188
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4189
  emit_int8((unsigned char)0xDD);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4190
  emit_operand32(rsi, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4191
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4192
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4193
void Assembler::fnstcw(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4194
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4195
  emit_int8((unsigned char)0x9B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4196
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4197
  emit_operand32(rdi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4198
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4199
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4200
void Assembler::fnstsw_ax() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4201
  emit_int8((unsigned char)0xDF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4202
  emit_int8((unsigned char)0xE0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4203
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4204
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4205
void Assembler::fprem() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4206
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4207
  emit_int8((unsigned char)0xF8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4208
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4209
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4210
void Assembler::fprem1() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4211
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4212
  emit_int8((unsigned char)0xF5);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4213
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4214
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4215
void Assembler::frstor(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4216
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4217
  emit_int8((unsigned char)0xDD);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4218
  emit_operand32(rsp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4219
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4220
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4221
void Assembler::fsin() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4222
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4223
  emit_int8((unsigned char)0xFE);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4224
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4225
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4226
void Assembler::fsqrt() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4227
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4228
  emit_int8((unsigned char)0xFA);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4229
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4230
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4231
void Assembler::fst_d(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4232
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4233
  emit_int8((unsigned char)0xDD);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4234
  emit_operand32(rdx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4235
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4236
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4237
void Assembler::fst_s(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4238
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4239
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4240
  emit_operand32(rdx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4241
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4242
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4243
void Assembler::fstp_d(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4244
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4245
  emit_int8((unsigned char)0xDD);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4246
  emit_operand32(rbx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4247
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4248
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4249
void Assembler::fstp_d(int index) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4250
  emit_farith(0xDD, 0xD8, index);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4251
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4252
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4253
void Assembler::fstp_s(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4254
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4255
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4256
  emit_operand32(rbx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4257
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4258
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4259
void Assembler::fstp_x(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4260
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4261
  emit_int8((unsigned char)0xDB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4262
  emit_operand32(rdi, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4263
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4264
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4265
void Assembler::fsub(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4266
  emit_farith(0xD8, 0xE0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4267
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4268
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4269
void Assembler::fsub_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4270
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4271
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4272
  emit_operand32(rsp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4273
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4274
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4275
void Assembler::fsub_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4276
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4277
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4278
  emit_operand32(rsp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4279
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4280
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4281
void Assembler::fsuba(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4282
  emit_farith(0xDC, 0xE8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4283
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4284
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4285
void Assembler::fsubp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4286
  emit_farith(0xDE, 0xE8, i);                    // ST(0) <- ST(0) - ST(1) and pop (Intel manual wrong)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4287
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4288
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4289
void Assembler::fsubr(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4290
  emit_farith(0xD8, 0xE8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4291
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4292
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4293
void Assembler::fsubr_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4294
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4295
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4296
  emit_operand32(rbp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4297
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4298
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4299
void Assembler::fsubr_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4300
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4301
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4302
  emit_operand32(rbp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4303
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4304
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4305
void Assembler::fsubra(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4306
  emit_farith(0xDC, 0xE0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4307
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4308
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4309
void Assembler::fsubrp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4310
  emit_farith(0xDE, 0xE0, i);                    // ST(0) <- ST(1) - ST(0) and pop (Intel manual wrong)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4311
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4312
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4313
void Assembler::ftan() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4314
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4315
  emit_int8((unsigned char)0xF2);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4316
  emit_int8((unsigned char)0xDD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4317
  emit_int8((unsigned char)0xD8);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4318
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4319
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4320
void Assembler::ftst() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4321
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4322
  emit_int8((unsigned char)0xE4);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4323
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4324
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4325
void Assembler::fucomi(int i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4326
  // make sure the instruction is supported (introduced for P6, together with cmov)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4327
  guarantee(VM_Version::supports_cmov(), "illegal instruction");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4328
  emit_farith(0xDB, 0xE8, i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4329
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4330
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4331
void Assembler::fucomip(int i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4332
  // make sure the instruction is supported (introduced for P6, together with cmov)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4333
  guarantee(VM_Version::supports_cmov(), "illegal instruction");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4334
  emit_farith(0xDF, 0xE8, i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4335
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4336
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4337
void Assembler::fwait() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4338
  emit_int8((unsigned char)0x9B);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4339
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  4340
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4341
void Assembler::fxch(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4342
  emit_farith(0xD9, 0xC8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4343
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4344
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4345
void Assembler::fyl2x() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4346
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4347
  emit_int8((unsigned char)0xF1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4348
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4349
12739
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  4350
void Assembler::frndint() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4351
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4352
  emit_int8((unsigned char)0xFC);
12739
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  4353
}
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  4354
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  4355
void Assembler::f2xm1() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4356
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4357
  emit_int8((unsigned char)0xF0);
12739
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  4358
}
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  4359
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  4360
void Assembler::fldl2e() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4361
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4362
  emit_int8((unsigned char)0xEA);
12739
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  4363
}
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  4364
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4365
// SSE SIMD prefix byte values corresponding to VexSimdPrefix encoding.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4366
static int simd_pre[4] = { 0, 0x66, 0xF3, 0xF2 };
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4367
// SSE opcode second byte values (first is 0x0F) corresponding to VexOpcode encoding.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4368
static int simd_opc[4] = { 0,    0, 0x38, 0x3A };
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4369
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4370
// Generate SSE legacy REX prefix and SIMD opcode based on VEX encoding.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4371
void Assembler::rex_prefix(Address adr, XMMRegister xreg, VexSimdPrefix pre, VexOpcode opc, bool rex_w) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4372
  if (pre > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4373
    emit_int8(simd_pre[pre]);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4374
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4375
  if (rex_w) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4376
    prefixq(adr, xreg);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4377
  } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4378
    prefix(adr, xreg);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4379
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4380
  if (opc > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4381
    emit_int8(0x0F);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4382
    int opc2 = simd_opc[opc];
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4383
    if (opc2 > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4384
      emit_int8(opc2);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4385
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4386
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4387
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4388
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4389
int Assembler::rex_prefix_and_encode(int dst_enc, int src_enc, VexSimdPrefix pre, VexOpcode opc, bool rex_w) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4390
  if (pre > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4391
    emit_int8(simd_pre[pre]);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4392
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4393
  int encode = (rex_w) ? prefixq_and_encode(dst_enc, src_enc) :
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4394
                          prefix_and_encode(dst_enc, src_enc);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4395
  if (opc > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4396
    emit_int8(0x0F);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4397
    int opc2 = simd_opc[opc];
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4398
    if (opc2 > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4399
      emit_int8(opc2);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4400
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4401
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4402
  return encode;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4403
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4404
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4405
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4406
void Assembler::vex_prefix(bool vex_r, bool vex_b, bool vex_x, bool vex_w, int nds_enc, VexSimdPrefix pre, VexOpcode opc, bool vector256) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4407
  if (vex_b || vex_x || vex_w || (opc == VEX_OPCODE_0F_38) || (opc == VEX_OPCODE_0F_3A)) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4408
    prefix(VEX_3bytes);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4409
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4410
    int byte1 = (vex_r ? VEX_R : 0) | (vex_x ? VEX_X : 0) | (vex_b ? VEX_B : 0);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4411
    byte1 = (~byte1) & 0xE0;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4412
    byte1 |= opc;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4413
    emit_int8(byte1);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4414
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4415
    int byte2 = ((~nds_enc) & 0xf) << 3;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4416
    byte2 |= (vex_w ? VEX_W : 0) | (vector256 ? 4 : 0) | pre;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4417
    emit_int8(byte2);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4418
  } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4419
    prefix(VEX_2bytes);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4420
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4421
    int byte1 = vex_r ? VEX_R : 0;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4422
    byte1 = (~byte1) & 0x80;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4423
    byte1 |= ((~nds_enc) & 0xf) << 3;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4424
    byte1 |= (vector256 ? 4 : 0) | pre;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4425
    emit_int8(byte1);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4426
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4427
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4428
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4429
void Assembler::vex_prefix(Address adr, int nds_enc, int xreg_enc, VexSimdPrefix pre, VexOpcode opc, bool vex_w, bool vector256){
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4430
  bool vex_r = (xreg_enc >= 8);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4431
  bool vex_b = adr.base_needs_rex();
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4432
  bool vex_x = adr.index_needs_rex();
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4433
  vex_prefix(vex_r, vex_b, vex_x, vex_w, nds_enc, pre, opc, vector256);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4434
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4435
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4436
int Assembler::vex_prefix_and_encode(int dst_enc, int nds_enc, int src_enc, VexSimdPrefix pre, VexOpcode opc, bool vex_w, bool vector256) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4437
  bool vex_r = (dst_enc >= 8);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4438
  bool vex_b = (src_enc >= 8);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4439
  bool vex_x = false;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4440
  vex_prefix(vex_r, vex_b, vex_x, vex_w, nds_enc, pre, opc, vector256);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4441
  return (((dst_enc & 7) << 3) | (src_enc & 7));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4442
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4443
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4444
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4445
void Assembler::simd_prefix(XMMRegister xreg, XMMRegister nds, Address adr, VexSimdPrefix pre, VexOpcode opc, bool rex_w, bool vector256) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4446
  if (UseAVX > 0) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4447
    int xreg_enc = xreg->encoding();
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4448
    int  nds_enc = nds->is_valid() ? nds->encoding() : 0;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4449
    vex_prefix(adr, nds_enc, xreg_enc, pre, opc, rex_w, vector256);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4450
  } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4451
    assert((nds == xreg) || (nds == xnoreg), "wrong sse encoding");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4452
    rex_prefix(adr, xreg, pre, opc, rex_w);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4453
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4454
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4455
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4456
int Assembler::simd_prefix_and_encode(XMMRegister dst, XMMRegister nds, XMMRegister src, VexSimdPrefix pre, VexOpcode opc, bool rex_w, bool vector256) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4457
  int dst_enc = dst->encoding();
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4458
  int src_enc = src->encoding();
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4459
  if (UseAVX > 0) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4460
    int nds_enc = nds->is_valid() ? nds->encoding() : 0;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4461
    return vex_prefix_and_encode(dst_enc, nds_enc, src_enc, pre, opc, rex_w, vector256);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4462
  } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4463
    assert((nds == dst) || (nds == src) || (nds == xnoreg), "wrong sse encoding");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4464
    return rex_prefix_and_encode(dst_enc, src_enc, pre, opc, rex_w);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4465
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4466
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4467
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4468
void Assembler::emit_simd_arith(int opcode, XMMRegister dst, Address src, VexSimdPrefix pre) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4469
  InstructionMark im(this);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4470
  simd_prefix(dst, dst, src, pre);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4471
  emit_int8(opcode);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4472
  emit_operand(dst, src);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4473
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4474
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4475
void Assembler::emit_simd_arith(int opcode, XMMRegister dst, XMMRegister src, VexSimdPrefix pre) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4476
  int encode = simd_prefix_and_encode(dst, dst, src, pre);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4477
  emit_int8(opcode);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4478
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4479
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4480
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4481
// Versions with no second source register (non-destructive source).
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4482
void Assembler::emit_simd_arith_nonds(int opcode, XMMRegister dst, Address src, VexSimdPrefix pre) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4483
  InstructionMark im(this);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4484
  simd_prefix(dst, xnoreg, src, pre);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4485
  emit_int8(opcode);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4486
  emit_operand(dst, src);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4487
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4488
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4489
void Assembler::emit_simd_arith_nonds(int opcode, XMMRegister dst, XMMRegister src, VexSimdPrefix pre) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4490
  int encode = simd_prefix_and_encode(dst, xnoreg, src, pre);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4491
  emit_int8(opcode);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4492
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4493
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4494
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4495
// 3-operands AVX instructions
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4496
void Assembler::emit_vex_arith(int opcode, XMMRegister dst, XMMRegister nds,
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4497
                               Address src, VexSimdPrefix pre, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4498
  InstructionMark im(this);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4499
  vex_prefix(dst, nds, src, pre, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4500
  emit_int8(opcode);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4501
  emit_operand(dst, src);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4502
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4503
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4504
void Assembler::emit_vex_arith(int opcode, XMMRegister dst, XMMRegister nds,
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4505
                               XMMRegister src, VexSimdPrefix pre, bool vector256) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4506
  int encode = vex_prefix_and_encode(dst, nds, src, pre, vector256);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4507
  emit_int8(opcode);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4508
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4509
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4510
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4511
#ifndef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4512
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4513
void Assembler::incl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4514
  // Don't use it directly. Use MacroAssembler::incrementl() instead.
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4515
  emit_int8(0x40 | dst->encoding());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4516
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4517
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4518
void Assembler::lea(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4519
  leal(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4520
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4521
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4522
void Assembler::mov_literal32(Address dst, int32_t imm32,  RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4523
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4524
  emit_int8((unsigned char)0xC7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4525
  emit_operand(rax, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4526
  emit_data((int)imm32, rspec, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4527
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4528
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  4529
void Assembler::mov_literal32(Register dst, int32_t imm32, RelocationHolder const& rspec) {
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  4530
  InstructionMark im(this);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  4531
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4532
  emit_int8((unsigned char)(0xB8 | encode));
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  4533
  emit_data((int)imm32, rspec, 0);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  4534
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4535
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4536
void Assembler::popa() { // 32bit
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4537
  emit_int8(0x61);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4538
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4539
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4540
void Assembler::push_literal32(int32_t imm32, RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4541
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4542
  emit_int8(0x68);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4543
  emit_data(imm32, rspec, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4544
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4545
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4546
void Assembler::pusha() { // 32bit
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4547
  emit_int8(0x60);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4548
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4549
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4550
void Assembler::set_byte_if_not_zero(Register dst) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4551
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4552
  emit_int8((unsigned char)0x95);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4553
  emit_int8((unsigned char)(0xE0 | dst->encoding()));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4554
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4555
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4556
void Assembler::shldl(Register dst, Register src) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4557
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4558
  emit_int8((unsigned char)0xA5);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4559
  emit_int8((unsigned char)(0xC0 | src->encoding() << 3 | dst->encoding()));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4560
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4561
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4562
void Assembler::shrdl(Register dst, Register src) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4563
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4564
  emit_int8((unsigned char)0xAD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4565
  emit_int8((unsigned char)(0xC0 | src->encoding() << 3 | dst->encoding()));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4566
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4567
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4568
#else // LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4569
5253
d2c37eee9a65 6942223: c1 64 bit fixes
iveresov
parents: 5053
diff changeset
  4570
void Assembler::set_byte_if_not_zero(Register dst) {
d2c37eee9a65 6942223: c1 64 bit fixes
iveresov
parents: 5053
diff changeset
  4571
  int enc = prefix_and_encode(dst->encoding(), true);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4572
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4573
  emit_int8((unsigned char)0x95);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4574
  emit_int8((unsigned char)(0xE0 | enc));
5253
d2c37eee9a65 6942223: c1 64 bit fixes
iveresov
parents: 5053
diff changeset
  4575
}
d2c37eee9a65 6942223: c1 64 bit fixes
iveresov
parents: 5053
diff changeset
  4576
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4577
// 64bit only pieces of the assembler
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4578
// This should only be used by 64bit instructions that can use rip-relative
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4579
// it cannot be used by instructions that want an immediate value.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4580
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4581
bool Assembler::reachable(AddressLiteral adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4582
  int64_t disp;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4583
  // None will force a 64bit literal to the code stream. Likely a placeholder
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4584
  // for something that will be patched later and we need to certain it will
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4585
  // always be reachable.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4586
  if (adr.reloc() == relocInfo::none) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4587
    return false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4588
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4589
  if (adr.reloc() == relocInfo::internal_word_type) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4590
    // This should be rip relative and easily reachable.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4591
    return true;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4592
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4593
  if (adr.reloc() == relocInfo::virtual_call_type ||
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4594
      adr.reloc() == relocInfo::opt_virtual_call_type ||
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4595
      adr.reloc() == relocInfo::static_call_type ||
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4596
      adr.reloc() == relocInfo::static_stub_type ) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4597
    // This should be rip relative within the code cache and easily
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4598
    // reachable until we get huge code caches. (At which point
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4599
    // ic code is going to have issues).
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4600
    return true;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4601
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4602
  if (adr.reloc() != relocInfo::external_word_type &&
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4603
      adr.reloc() != relocInfo::poll_return_type &&  // these are really external_word but need special
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4604
      adr.reloc() != relocInfo::poll_type &&         // relocs to identify them
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4605
      adr.reloc() != relocInfo::runtime_call_type ) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4606
    return false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4607
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4608
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4609
  // Stress the correction code
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4610
  if (ForceUnreachable) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4611
    // Must be runtimecall reloc, see if it is in the codecache
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4612
    // Flipping stuff in the codecache to be unreachable causes issues
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4613
    // with things like inline caches where the additional instructions
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4614
    // are not handled.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4615
    if (CodeCache::find_blob(adr._target) == NULL) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4616
      return false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4617
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4618
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4619
  // For external_word_type/runtime_call_type if it is reachable from where we
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4620
  // are now (possibly a temp buffer) and where we might end up
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4621
  // anywhere in the codeCache then we are always reachable.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4622
  // This would have to change if we ever save/restore shared code
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4623
  // to be more pessimistic.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4624
  disp = (int64_t)adr._target - ((int64_t)CodeCache::low_bound() + sizeof(int));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4625
  if (!is_simm32(disp)) return false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4626
  disp = (int64_t)adr._target - ((int64_t)CodeCache::high_bound() + sizeof(int));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4627
  if (!is_simm32(disp)) return false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4628
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  4629
  disp = (int64_t)adr._target - ((int64_t)pc() + sizeof(int));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4630
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4631
  // Because rip relative is a disp + address_of_next_instruction and we
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4632
  // don't know the value of address_of_next_instruction we apply a fudge factor
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4633
  // to make sure we will be ok no matter the size of the instruction we get placed into.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4634
  // We don't have to fudge the checks above here because they are already worst case.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4635
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4636
  // 12 == override/rex byte, opcode byte, rm byte, sib byte, a 4-byte disp , 4-byte literal
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4637
  // + 4 because better safe than sorry.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4638
  const int fudge = 12 + 4;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4639
  if (disp < 0) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4640
    disp -= fudge;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4641
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4642
    disp += fudge;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4643
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4644
  return is_simm32(disp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4645
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4646
8871
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  4647
// Check if the polling page is not reachable from the code cache using rip-relative
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  4648
// addressing.
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  4649
bool Assembler::is_polling_page_far() {
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  4650
  intptr_t addr = (intptr_t)os::get_polling_page();
11194
ee1235a09fc3 7110489: C1: 64-bit tiered with ForceUnreachable: assert(reachable(src)) failed: Address should be reachable
never
parents: 10546
diff changeset
  4651
  return ForceUnreachable ||
ee1235a09fc3 7110489: C1: 64-bit tiered with ForceUnreachable: assert(reachable(src)) failed: Address should be reachable
never
parents: 10546
diff changeset
  4652
         !is_simm32(addr - (intptr_t)CodeCache::low_bound()) ||
8871
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  4653
         !is_simm32(addr - (intptr_t)CodeCache::high_bound());
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  4654
}
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  4655
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4656
void Assembler::emit_data64(jlong data,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4657
                            relocInfo::relocType rtype,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4658
                            int format) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4659
  if (rtype == relocInfo::none) {
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  4660
    emit_int64(data);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4661
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4662
    emit_data64(data, Relocation::spec_simple(rtype), format);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4663
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4664
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4665
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4666
void Assembler::emit_data64(jlong data,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4667
                            RelocationHolder const& rspec,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4668
                            int format) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4669
  assert(imm_operand == 0, "default format must be immediate in this file");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4670
  assert(imm_operand == format, "must be immediate");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4671
  assert(inst_mark() != NULL, "must be inside InstructionMark");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4672
  // Do not use AbstractAssembler::relocate, which is not intended for
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4673
  // embedded words.  Instead, relocate to the enclosing instruction.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4674
  code_section()->relocate(inst_mark(), rspec, format);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4675
#ifdef ASSERT
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4676
  check_relocation(rspec, format);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4677
#endif
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  4678
  emit_int64(data);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4679
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4680
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4681
int Assembler::prefix_and_encode(int reg_enc, bool byteinst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4682
  if (reg_enc >= 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4683
    prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4684
    reg_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4685
  } else if (byteinst && reg_enc >= 4) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4686
    prefix(REX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4687
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4688
  return reg_enc;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4689
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4690
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4691
int Assembler::prefixq_and_encode(int reg_enc) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4692
  if (reg_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4693
    prefix(REX_W);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4694
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4695
    prefix(REX_WB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4696
    reg_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4697
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4698
  return reg_enc;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4699
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4700
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4701
int Assembler::prefix_and_encode(int dst_enc, int src_enc, bool byteinst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4702
  if (dst_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4703
    if (src_enc >= 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4704
      prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4705
      src_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4706
    } else if (byteinst && src_enc >= 4) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4707
      prefix(REX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4708
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4709
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4710
    if (src_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4711
      prefix(REX_R);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4712
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4713
      prefix(REX_RB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4714
      src_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4715
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4716
    dst_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4717
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4718
  return dst_enc << 3 | src_enc;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4719
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4720
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4721
int Assembler::prefixq_and_encode(int dst_enc, int src_enc) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4722
  if (dst_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4723
    if (src_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4724
      prefix(REX_W);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4725
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4726
      prefix(REX_WB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4727
      src_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4728
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4729
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4730
    if (src_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4731
      prefix(REX_WR);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4732
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4733
      prefix(REX_WRB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4734
      src_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4735
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4736
    dst_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4737
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4738
  return dst_enc << 3 | src_enc;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4739
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4740
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4741
void Assembler::prefix(Register reg) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4742
  if (reg->encoding() >= 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4743
    prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4744
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4745
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4746
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4747
void Assembler::prefix(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4748
  if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4749
    if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4750
      prefix(REX_XB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4751
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4752
      prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4753
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4754
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4755
    if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4756
      prefix(REX_X);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4757
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4758
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4759
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4760
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4761
void Assembler::prefixq(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4762
  if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4763
    if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4764
      prefix(REX_WXB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4765
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4766
      prefix(REX_WB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4767
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4768
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4769
    if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4770
      prefix(REX_WX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4771
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4772
      prefix(REX_W);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4773
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4774
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4775
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4776
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4777
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4778
void Assembler::prefix(Address adr, Register reg, bool byteinst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4779
  if (reg->encoding() < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4780
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4781
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4782
        prefix(REX_XB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4783
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4784
        prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4785
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4786
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4787
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4788
        prefix(REX_X);
10268
3b789f46f950 7079626: x64 emits unnecessary REX prefix
twisti
parents: 10267
diff changeset
  4789
      } else if (byteinst && reg->encoding() >= 4 ) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4790
        prefix(REX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4791
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4792
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4793
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4794
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4795
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4796
        prefix(REX_RXB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4797
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4798
        prefix(REX_RB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4799
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4800
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4801
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4802
        prefix(REX_RX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4803
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4804
        prefix(REX_R);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4805
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4806
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4807
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4808
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4809
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4810
void Assembler::prefixq(Address adr, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4811
  if (src->encoding() < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4812
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4813
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4814
        prefix(REX_WXB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4815
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4816
        prefix(REX_WB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4817
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4818
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4819
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4820
        prefix(REX_WX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4821
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4822
        prefix(REX_W);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4823
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4824
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4825
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4826
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4827
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4828
        prefix(REX_WRXB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4829
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4830
        prefix(REX_WRB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4831
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4832
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4833
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4834
        prefix(REX_WRX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4835
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4836
        prefix(REX_WR);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4837
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4838
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4839
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4840
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4841
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4842
void Assembler::prefix(Address adr, XMMRegister reg) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4843
  if (reg->encoding() < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4844
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4845
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4846
        prefix(REX_XB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4847
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4848
        prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4849
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4850
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4851
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4852
        prefix(REX_X);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4853
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4854
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4855
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4856
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4857
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4858
        prefix(REX_RXB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4859
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4860
        prefix(REX_RB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4861
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4862
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4863
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4864
        prefix(REX_RX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4865
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4866
        prefix(REX_R);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4867
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4868
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4869
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4870
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4871
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4872
void Assembler::prefixq(Address adr, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4873
  if (src->encoding() < 8) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4874
    if (adr.base_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4875
      if (adr.index_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4876
        prefix(REX_WXB);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4877
      } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4878
        prefix(REX_WB);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4879
      }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4880
    } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4881
      if (adr.index_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4882
        prefix(REX_WX);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4883
      } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4884
        prefix(REX_W);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4885
      }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4886
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4887
  } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4888
    if (adr.base_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4889
      if (adr.index_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4890
        prefix(REX_WRXB);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4891
      } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4892
        prefix(REX_WRB);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4893
      }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4894
    } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4895
      if (adr.index_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4896
        prefix(REX_WRX);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4897
      } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4898
        prefix(REX_WR);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4899
      }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4900
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4901
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4902
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4903
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4904
void Assembler::adcq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4905
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4906
  emit_arith(0x81, 0xD0, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4907
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4908
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4909
void Assembler::adcq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4910
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4911
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4912
  emit_int8(0x13);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4913
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4914
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4915
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4916
void Assembler::adcq(Register dst, Register src) {
20295
a5dd1b071c32 8025613: clang: remove -Wno-unused-value
twisti
parents: 18507
diff changeset
  4917
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4918
  emit_arith(0x13, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4919
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4920
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4921
void Assembler::addq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4922
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4923
  prefixq(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4924
  emit_arith_operand(0x81, rax, dst,imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4925
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4926
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4927
void Assembler::addq(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4928
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4929
  prefixq(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4930
  emit_int8(0x01);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4931
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4932
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4933
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4934
void Assembler::addq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4935
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4936
  emit_arith(0x81, 0xC0, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4937
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4938
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4939
void Assembler::addq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4940
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4941
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4942
  emit_int8(0x03);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4943
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4944
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4945
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4946
void Assembler::addq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4947
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4948
  emit_arith(0x03, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4949
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4950
26434
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4951
void Assembler::adcxq(Register dst, Register src) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4952
  //assert(VM_Version::supports_adx(), "adx instructions not supported");
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4953
  emit_int8((unsigned char)0x66);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4954
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4955
  emit_int8(0x0F);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4956
  emit_int8(0x38);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4957
  emit_int8((unsigned char)0xF6);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4958
  emit_int8((unsigned char)(0xC0 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4959
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4960
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4961
void Assembler::adoxq(Register dst, Register src) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4962
  //assert(VM_Version::supports_adx(), "adx instructions not supported");
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4963
  emit_int8((unsigned char)0xF3);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4964
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4965
  emit_int8(0x0F);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4966
  emit_int8(0x38);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4967
  emit_int8((unsigned char)0xF6);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4968
  emit_int8((unsigned char)(0xC0 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4969
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  4970
10006
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  4971
void Assembler::andq(Address dst, int32_t imm32) {
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  4972
  InstructionMark im(this);
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  4973
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4974
  emit_int8((unsigned char)0x81);
10006
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  4975
  emit_operand(rsp, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  4976
  emit_int32(imm32);
10006
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  4977
}
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  4978
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4979
void Assembler::andq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4980
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4981
  emit_arith(0x81, 0xE0, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4982
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4983
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4984
void Assembler::andq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4985
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4986
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4987
  emit_int8(0x23);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4988
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4989
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4990
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4991
void Assembler::andq(Register dst, Register src) {
20295
a5dd1b071c32 8025613: clang: remove -Wno-unused-value
twisti
parents: 18507
diff changeset
  4992
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4993
  emit_arith(0x23, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4994
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4995
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4996
void Assembler::andnq(Register dst, Register src1, Register src2) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4997
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4998
  int encode = vex_prefix_0F38_and_encode_q(dst, src1, src2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4999
  emit_int8((unsigned char)0xF2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5000
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5001
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5002
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5003
void Assembler::andnq(Register dst, Register src1, Address src2) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5004
  InstructionMark im(this);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5005
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5006
  vex_prefix_0F38_q(dst, src1, src2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5007
  emit_int8((unsigned char)0xF2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5008
  emit_operand(dst, src2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5009
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5010
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5011
void Assembler::bsfq(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5012
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5013
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5014
  emit_int8((unsigned char)0xBC);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5015
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5016
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5017
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5018
void Assembler::bsrq(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5019
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5020
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5021
  emit_int8((unsigned char)0xBD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5022
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5023
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5024
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5025
void Assembler::bswapq(Register reg) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5026
  int encode = prefixq_and_encode(reg->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5027
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5028
  emit_int8((unsigned char)(0xC8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5029
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5030
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5031
void Assembler::blsiq(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5032
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5033
  int encode = vex_prefix_0F38_and_encode_q(rbx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5034
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5035
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5036
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5037
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5038
void Assembler::blsiq(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5039
  InstructionMark im(this);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5040
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5041
  vex_prefix_0F38_q(rbx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5042
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5043
  emit_operand(rbx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5044
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5045
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5046
void Assembler::blsmskq(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5047
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5048
  int encode = vex_prefix_0F38_and_encode_q(rdx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5049
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5050
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5051
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5052
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5053
void Assembler::blsmskq(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5054
  InstructionMark im(this);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5055
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5056
  vex_prefix_0F38_q(rdx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5057
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5058
  emit_operand(rdx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5059
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5060
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5061
void Assembler::blsrq(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5062
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5063
  int encode = vex_prefix_0F38_and_encode_q(rcx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5064
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5065
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5066
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5067
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5068
void Assembler::blsrq(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5069
  InstructionMark im(this);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5070
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5071
  vex_prefix_0F38_q(rcx, dst, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5072
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5073
  emit_operand(rcx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5074
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  5075
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5076
void Assembler::cdqq() {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5077
  prefix(REX_W);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5078
  emit_int8((unsigned char)0x99);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5079
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5080
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5081
void Assembler::clflush(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5082
  prefix(adr);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5083
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5084
  emit_int8((unsigned char)0xAE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5085
  emit_operand(rdi, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5086
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5087
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5088
void Assembler::cmovq(Condition cc, Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5089
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5090
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5091
  emit_int8(0x40 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5092
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5093
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5094
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5095
void Assembler::cmovq(Condition cc, Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5096
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5097
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5098
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5099
  emit_int8(0x40 | cc);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5100
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5101
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5102
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5103
void Assembler::cmpq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5104
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5105
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5106
  emit_int8((unsigned char)0x81);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5107
  emit_operand(rdi, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  5108
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5109
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5110
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5111
void Assembler::cmpq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5112
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5113
  emit_arith(0x81, 0xF8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5114
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5115
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5116
void Assembler::cmpq(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5117
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5118
  prefixq(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5119
  emit_int8(0x3B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5120
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5121
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5122
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5123
void Assembler::cmpq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5124
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5125
  emit_arith(0x3B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5126
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5127
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5128
void Assembler::cmpq(Register dst, Address  src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5129
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5130
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5131
  emit_int8(0x3B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5132
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5133
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5134
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5135
void Assembler::cmpxchgq(Register reg, Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5136
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5137
  prefixq(adr, reg);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5138
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5139
  emit_int8((unsigned char)0xB1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5140
  emit_operand(reg, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5141
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5142
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5143
void Assembler::cvtsi2sdq(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5144
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5145
  int encode = simd_prefix_and_encode_q(dst, dst, src, VEX_SIMD_F2);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5146
  emit_int8(0x2A);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5147
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5148
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5149
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5150
void Assembler::cvtsi2sdq(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5151
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5152
  InstructionMark im(this);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5153
  simd_prefix_q(dst, dst, src, VEX_SIMD_F2);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5154
  emit_int8(0x2A);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5155
  emit_operand(dst, src);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5156
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5157
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5158
void Assembler::cvtsi2ssq(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5159
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5160
  int encode = simd_prefix_and_encode_q(dst, dst, src, VEX_SIMD_F3);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5161
  emit_int8(0x2A);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5162
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5163
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5164
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5165
void Assembler::cvtsi2ssq(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5166
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5167
  InstructionMark im(this);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5168
  simd_prefix_q(dst, dst, src, VEX_SIMD_F3);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5169
  emit_int8(0x2A);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5170
  emit_operand(dst, src);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5171
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5172
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5173
void Assembler::cvttsd2siq(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5174
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5175
  int encode = simd_prefix_and_encode_q(dst, src, VEX_SIMD_F2);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5176
  emit_int8(0x2C);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5177
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5178
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5179
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5180
void Assembler::cvttss2siq(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5181
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5182
  int encode = simd_prefix_and_encode_q(dst, src, VEX_SIMD_F3);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5183
  emit_int8(0x2C);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5184
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5185
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5186
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5187
void Assembler::decl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5188
  // Don't use it directly. Use MacroAssembler::decrementl() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5189
  // Use two-byte form (one-byte form is a REX prefix in 64-bit mode)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5190
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5191
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5192
  emit_int8((unsigned char)(0xC8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5193
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5194
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5195
void Assembler::decq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5196
  // Don't use it directly. Use MacroAssembler::decrementq() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5197
  // Use two-byte form (one-byte from is a REX prefix in 64-bit mode)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5198
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5199
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5200
  emit_int8(0xC8 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5201
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5202
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5203
void Assembler::decq(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5204
  // Don't use it directly. Use MacroAssembler::decrementq() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5205
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5206
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5207
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5208
  emit_operand(rcx, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5209
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5210
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5211
void Assembler::fxrstor(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5212
  prefixq(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5213
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5214
  emit_int8((unsigned char)0xAE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5215
  emit_operand(as_Register(1), src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5216
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5217
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5218
void Assembler::fxsave(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5219
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5220
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5221
  emit_int8((unsigned char)0xAE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5222
  emit_operand(as_Register(0), dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5223
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5224
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5225
void Assembler::idivq(Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5226
  int encode = prefixq_and_encode(src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5227
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5228
  emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5229
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5230
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5231
void Assembler::imulq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5232
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5233
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5234
  emit_int8((unsigned char)0xAF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5235
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5236
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5237
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5238
void Assembler::imulq(Register dst, Register src, int value) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5239
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5240
  if (is8bit(value)) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5241
    emit_int8(0x6B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5242
    emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5243
    emit_int8(value & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5244
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5245
    emit_int8(0x69);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5246
    emit_int8((unsigned char)(0xC0 | encode));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  5247
    emit_int32(value);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5248
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5249
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5250
21105
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  5251
void Assembler::imulq(Register dst, Address src) {
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  5252
  InstructionMark im(this);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  5253
  prefixq(src, dst);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  5254
  emit_int8(0x0F);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  5255
  emit_int8((unsigned char) 0xAF);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  5256
  emit_operand(dst, src);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  5257
}
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  5258
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5259
void Assembler::incl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5260
  // Don't use it directly. Use MacroAssembler::incrementl() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5261
  // Use two-byte form (one-byte from is a REX prefix in 64-bit mode)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5262
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5263
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5264
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5265
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5266
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5267
void Assembler::incq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5268
  // Don't use it directly. Use MacroAssembler::incrementq() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5269
  // Use two-byte form (one-byte from is a REX prefix in 64-bit mode)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5270
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5271
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5272
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5273
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5274
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5275
void Assembler::incq(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5276
  // Don't use it directly. Use MacroAssembler::incrementq() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5277
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5278
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5279
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5280
  emit_operand(rax, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5281
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5282
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5283
void Assembler::lea(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5284
  leaq(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5285
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5286
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5287
void Assembler::leaq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5288
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5289
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5290
  emit_int8((unsigned char)0x8D);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5291
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5292
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5293
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5294
void Assembler::mov64(Register dst, int64_t imm64) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5295
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5296
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5297
  emit_int8((unsigned char)(0xB8 | encode));
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  5298
  emit_int64(imm64);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5299
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5300
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5301
void Assembler::mov_literal64(Register dst, intptr_t imm64, RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5302
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5303
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5304
  emit_int8(0xB8 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5305
  emit_data64(imm64, rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5306
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5307
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5308
void Assembler::mov_narrow_oop(Register dst, int32_t imm32, RelocationHolder const& rspec) {
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5309
  InstructionMark im(this);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5310
  int encode = prefix_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5311
  emit_int8((unsigned char)(0xB8 | encode));
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5312
  emit_data((int)imm32, rspec, narrow_oop_operand);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5313
}
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5314
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5315
void Assembler::mov_narrow_oop(Address dst, int32_t imm32,  RelocationHolder const& rspec) {
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5316
  InstructionMark im(this);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5317
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5318
  emit_int8((unsigned char)0xC7);
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5319
  emit_operand(rax, dst, 4);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5320
  emit_data((int)imm32, rspec, narrow_oop_operand);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5321
}
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5322
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5323
void Assembler::cmp_narrow_oop(Register src1, int32_t imm32, RelocationHolder const& rspec) {
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5324
  InstructionMark im(this);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5325
  int encode = prefix_and_encode(src1->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5326
  emit_int8((unsigned char)0x81);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5327
  emit_int8((unsigned char)(0xF8 | encode));
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5328
  emit_data((int)imm32, rspec, narrow_oop_operand);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5329
}
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5330
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5331
void Assembler::cmp_narrow_oop(Address src1, int32_t imm32, RelocationHolder const& rspec) {
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5332
  InstructionMark im(this);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5333
  prefix(src1);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5334
  emit_int8((unsigned char)0x81);
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5335
  emit_operand(rax, src1, 4);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5336
  emit_data((int)imm32, rspec, narrow_oop_operand);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5337
}
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  5338
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5339
void Assembler::lzcntq(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5340
  assert(VM_Version::supports_lzcnt(), "encoding is treated as BSR");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5341
  emit_int8((unsigned char)0xF3);
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5342
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5343
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5344
  emit_int8((unsigned char)0xBD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5345
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5346
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  5347
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5348
void Assembler::movdq(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5349
  // table D-1 says MMX/SSE2
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5350
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5351
  int encode = simd_prefix_and_encode_q(dst, src, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5352
  emit_int8(0x6E);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5353
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5354
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5355
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5356
void Assembler::movdq(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5357
  // table D-1 says MMX/SSE2
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5358
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5359
  // swap src/dst to get correct prefix
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  5360
  int encode = simd_prefix_and_encode_q(src, dst, VEX_SIMD_66);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5361
  emit_int8(0x7E);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5362
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5363
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5364
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5365
void Assembler::movq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5366
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5367
  emit_int8((unsigned char)0x8B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5368
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5369
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5370
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5371
void Assembler::movq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5372
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5373
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5374
  emit_int8((unsigned char)0x8B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5375
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5376
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5377
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5378
void Assembler::movq(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5379
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5380
  prefixq(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5381
  emit_int8((unsigned char)0x89);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5382
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5383
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5384
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5385
void Assembler::movsbq(Register dst, Address src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5386
  InstructionMark im(this);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5387
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5388
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5389
  emit_int8((unsigned char)0xBE);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5390
  emit_operand(dst, src);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5391
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5392
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5393
void Assembler::movsbq(Register dst, Register src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5394
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5395
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5396
  emit_int8((unsigned char)0xBE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5397
  emit_int8((unsigned char)(0xC0 | encode));
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5398
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5399
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5400
void Assembler::movslq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5401
  // dbx shows movslq(rcx, 3) as movq     $0x0000000049000000,(%rbx)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5402
  // and movslq(r8, 3); as movl     $0x0000000048000000,(%rbx)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5403
  // as a result we shouldn't use until tested at runtime...
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5404
  ShouldNotReachHere();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5405
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5406
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5407
  emit_int8((unsigned char)(0xC7 | encode));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  5408
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5409
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5410
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5411
void Assembler::movslq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5412
  assert(is_simm32(imm32), "lost bits");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5413
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5414
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5415
  emit_int8((unsigned char)0xC7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5416
  emit_operand(rax, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  5417
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5418
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5419
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5420
void Assembler::movslq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5421
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5422
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5423
  emit_int8(0x63);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5424
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5425
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5426
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5427
void Assembler::movslq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5428
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5429
  emit_int8(0x63);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5430
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5431
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5432
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5433
void Assembler::movswq(Register dst, Address src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5434
  InstructionMark im(this);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5435
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5436
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5437
  emit_int8((unsigned char)0xBF);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5438
  emit_operand(dst, src);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5439
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5440
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5441
void Assembler::movswq(Register dst, Register src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5442
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5443
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5444
  emit_int8((unsigned char)0xBF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5445
  emit_int8((unsigned char)(0xC0 | encode));
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5446
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5447
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5448
void Assembler::movzbq(Register dst, Address src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5449
  InstructionMark im(this);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5450
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5451
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5452
  emit_int8((unsigned char)0xB6);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5453
  emit_operand(dst, src);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5454
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5455
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5456
void Assembler::movzbq(Register dst, Register src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5457
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5458
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5459
  emit_int8((unsigned char)0xB6);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5460
  emit_int8(0xC0 | encode);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5461
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5462
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5463
void Assembler::movzwq(Register dst, Address src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5464
  InstructionMark im(this);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5465
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5466
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5467
  emit_int8((unsigned char)0xB7);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5468
  emit_operand(dst, src);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5469
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5470
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5471
void Assembler::movzwq(Register dst, Register src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5472
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5473
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5474
  emit_int8((unsigned char)0xB7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5475
  emit_int8((unsigned char)(0xC0 | encode));
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5476
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  5477
26434
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5478
void Assembler::mulq(Address src) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5479
  InstructionMark im(this);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5480
  prefixq(src);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5481
  emit_int8((unsigned char)0xF7);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5482
  emit_operand(rsp, src);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5483
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5484
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5485
void Assembler::mulq(Register src) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5486
  int encode = prefixq_and_encode(src->encoding());
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5487
  emit_int8((unsigned char)0xF7);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5488
  emit_int8((unsigned char)(0xE0 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5489
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5490
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5491
void Assembler::mulxq(Register dst1, Register dst2, Register src) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5492
  assert(VM_Version::supports_bmi2(), "bit manipulation instructions not supported");
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5493
  int encode = vex_prefix_and_encode(dst1->encoding(), dst2->encoding(), src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F_38, true, false);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5494
  emit_int8((unsigned char)0xF6);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5495
  emit_int8((unsigned char)(0xC0 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5496
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5497
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5498
void Assembler::negq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5499
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5500
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5501
  emit_int8((unsigned char)(0xD8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5502
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5503
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5504
void Assembler::notq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5505
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5506
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5507
  emit_int8((unsigned char)(0xD0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5508
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5509
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5510
void Assembler::orq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5511
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5512
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5513
  emit_int8((unsigned char)0x81);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5514
  emit_operand(rcx, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  5515
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5516
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5517
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5518
void Assembler::orq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5519
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5520
  emit_arith(0x81, 0xC8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5521
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5522
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5523
void Assembler::orq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5524
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5525
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5526
  emit_int8(0x0B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5527
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5528
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5529
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5530
void Assembler::orq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5531
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5532
  emit_arith(0x0B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5533
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5534
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5535
void Assembler::popa() { // 64bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5536
  movq(r15, Address(rsp, 0));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5537
  movq(r14, Address(rsp, wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5538
  movq(r13, Address(rsp, 2 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5539
  movq(r12, Address(rsp, 3 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5540
  movq(r11, Address(rsp, 4 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5541
  movq(r10, Address(rsp, 5 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5542
  movq(r9,  Address(rsp, 6 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5543
  movq(r8,  Address(rsp, 7 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5544
  movq(rdi, Address(rsp, 8 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5545
  movq(rsi, Address(rsp, 9 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5546
  movq(rbp, Address(rsp, 10 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5547
  // skip rsp
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5548
  movq(rbx, Address(rsp, 12 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5549
  movq(rdx, Address(rsp, 13 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5550
  movq(rcx, Address(rsp, 14 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5551
  movq(rax, Address(rsp, 15 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5552
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5553
  addq(rsp, 16 * wordSize);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5554
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5555
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5556
void Assembler::popcntq(Register dst, Address src) {
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5557
  assert(VM_Version::supports_popcnt(), "must support");
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5558
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5559
  emit_int8((unsigned char)0xF3);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5560
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5561
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5562
  emit_int8((unsigned char)0xB8);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5563
  emit_operand(dst, src);
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5564
}
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5565
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5566
void Assembler::popcntq(Register dst, Register src) {
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5567
  assert(VM_Version::supports_popcnt(), "must support");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5568
  emit_int8((unsigned char)0xF3);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5569
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5570
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5571
  emit_int8((unsigned char)0xB8);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5572
  emit_int8((unsigned char)(0xC0 | encode));
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5573
}
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  5574
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5575
void Assembler::popq(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5576
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5577
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5578
  emit_int8((unsigned char)0x8F);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5579
  emit_operand(rax, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5580
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5581
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5582
void Assembler::pusha() { // 64bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5583
  // we have to store original rsp.  ABI says that 128 bytes
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5584
  // below rsp are local scratch.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5585
  movq(Address(rsp, -5 * wordSize), rsp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5586
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5587
  subq(rsp, 16 * wordSize);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5588
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5589
  movq(Address(rsp, 15 * wordSize), rax);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5590
  movq(Address(rsp, 14 * wordSize), rcx);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5591
  movq(Address(rsp, 13 * wordSize), rdx);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5592
  movq(Address(rsp, 12 * wordSize), rbx);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5593
  // skip rsp
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5594
  movq(Address(rsp, 10 * wordSize), rbp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5595
  movq(Address(rsp, 9 * wordSize), rsi);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5596
  movq(Address(rsp, 8 * wordSize), rdi);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5597
  movq(Address(rsp, 7 * wordSize), r8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5598
  movq(Address(rsp, 6 * wordSize), r9);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5599
  movq(Address(rsp, 5 * wordSize), r10);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5600
  movq(Address(rsp, 4 * wordSize), r11);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5601
  movq(Address(rsp, 3 * wordSize), r12);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5602
  movq(Address(rsp, 2 * wordSize), r13);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5603
  movq(Address(rsp, wordSize), r14);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5604
  movq(Address(rsp, 0), r15);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5605
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5606
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5607
void Assembler::pushq(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5608
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5609
  prefixq(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5610
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5611
  emit_operand(rsi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5612
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5613
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5614
void Assembler::rclq(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5615
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5616
  int encode = prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5617
  if (imm8 == 1) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5618
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5619
    emit_int8((unsigned char)(0xD0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5620
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5621
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5622
    emit_int8((unsigned char)(0xD0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5623
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5624
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5625
}
26434
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5626
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5627
void Assembler::rorq(Register dst, int imm8) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5628
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5629
  int encode = prefixq_and_encode(dst->encoding());
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5630
  if (imm8 == 1) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5631
    emit_int8((unsigned char)0xD1);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5632
    emit_int8((unsigned char)(0xC8 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5633
  } else {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5634
    emit_int8((unsigned char)0xC1);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5635
    emit_int8((unsigned char)(0xc8 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5636
    emit_int8(imm8);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5637
  }
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5638
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5639
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5640
void Assembler::rorxq(Register dst, Register src, int imm8) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5641
  assert(VM_Version::supports_bmi2(), "bit manipulation instructions not supported");
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5642
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F_3A, true, false);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5643
  emit_int8((unsigned char)0xF0);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5644
  emit_int8((unsigned char)(0xC0 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5645
  emit_int8(imm8);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5646
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  5647
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5648
void Assembler::sarq(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5649
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5650
  int encode = prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5651
  if (imm8 == 1) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5652
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5653
    emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5654
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5655
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5656
    emit_int8((unsigned char)(0xF8 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5657
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5658
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5659
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5660
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5661
void Assembler::sarq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5662
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5663
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5664
  emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5665
}
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  5666
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5667
void Assembler::sbbq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5668
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5669
  prefixq(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5670
  emit_arith_operand(0x81, rbx, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5671
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5672
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5673
void Assembler::sbbq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5674
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5675
  emit_arith(0x81, 0xD8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5676
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5677
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5678
void Assembler::sbbq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5679
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5680
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5681
  emit_int8(0x1B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5682
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5683
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5684
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5685
void Assembler::sbbq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5686
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5687
  emit_arith(0x1B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5688
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5689
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5690
void Assembler::shlq(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5691
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5692
  int encode = prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5693
  if (imm8 == 1) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5694
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5695
    emit_int8((unsigned char)(0xE0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5696
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5697
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5698
    emit_int8((unsigned char)(0xE0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5699
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5700
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5701
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5702
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5703
void Assembler::shlq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5704
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5705
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5706
  emit_int8((unsigned char)(0xE0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5707
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5708
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5709
void Assembler::shrq(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5710
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5711
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5712
  emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5713
  emit_int8((unsigned char)(0xE8 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5714
  emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5715
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5716
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5717
void Assembler::shrq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5718
  int encode = prefixq_and_encode(dst->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5719
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5720
  emit_int8(0xE8 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5721
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5722
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5723
void Assembler::subq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5724
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5725
  prefixq(dst);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  5726
  emit_arith_operand(0x81, rbp, dst, imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5727
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5728
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5729
void Assembler::subq(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5730
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5731
  prefixq(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5732
  emit_int8(0x29);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5733
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5734
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5735
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  5736
void Assembler::subq(Register dst, int32_t imm32) {
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  5737
  (void) prefixq_and_encode(dst->encoding());
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  5738
  emit_arith(0x81, 0xE8, dst, imm32);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  5739
}
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  5740
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  5741
// Force generation of a 4 byte immediate value even if it fits into 8bit
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  5742
void Assembler::subq_imm32(Register dst, int32_t imm32) {
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  5743
  (void) prefixq_and_encode(dst->encoding());
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  5744
  emit_arith_imm32(0x81, 0xE8, dst, imm32);
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  5745
}
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  5746
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5747
void Assembler::subq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5748
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5749
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5750
  emit_int8(0x2B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5751
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5752
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5753
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5754
void Assembler::subq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5755
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5756
  emit_arith(0x2B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5757
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5758
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5759
void Assembler::testq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5760
  // not using emit_arith because test
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5761
  // doesn't support sign-extension of
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5762
  // 8bit operands
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5763
  int encode = dst->encoding();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5764
  if (encode == 0) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5765
    prefix(REX_W);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5766
    emit_int8((unsigned char)0xA9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5767
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5768
    encode = prefixq_and_encode(encode);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5769
    emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5770
    emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5771
  }
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  5772
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5773
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5774
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5775
void Assembler::testq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5776
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5777
  emit_arith(0x85, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5778
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5779
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5780
void Assembler::xaddq(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5781
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5782
  prefixq(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5783
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5784
  emit_int8((unsigned char)0xC1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5785
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5786
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5787
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5788
void Assembler::xchgq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5789
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5790
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5791
  emit_int8((unsigned char)0x87);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5792
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5793
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5794
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5795
void Assembler::xchgq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5796
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5797
  emit_int8((unsigned char)0x87);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5798
  emit_int8((unsigned char)(0xc0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5799
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5800
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5801
void Assembler::xorq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5802
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5803
  emit_arith(0x33, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5804
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5805
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5806
void Assembler::xorq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5807
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5808
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5809
  emit_int8(0x33);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5810
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5811
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5812
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  5813
#endif // !LP64