hotspot/src/cpu/x86/vm/assembler_x86.cpp
author kvn
Mon, 28 Dec 2015 23:11:01 -0800
changeset 35154 a9b3c1984a01
parent 35146 9ebfec283f56
child 35540 e001ad24dcdb
permissions -rw-r--r--
8143925: Enhancing CounterMode.crypt() for AES Summary: Add intrinsic for CounterMode.crypt() to leverage the parallel nature of AES in Counter(CTR) Mode. Reviewed-by: kvn, ascarpino Contributed-by: kishor.kharbas@intel.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30211
diff changeset
     2
 * Copyright (c) 1997, 2015, 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"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30211
diff changeset
    28
#include "gc/shared/cardTableModRefBS.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30211
diff changeset
    29
#include "gc/shared/collectedHeap.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7121
diff changeset
    30
#include "interpreter/interpreter.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
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30211
diff changeset
    41
#include "gc/g1/g1CollectedHeap.inline.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30211
diff changeset
    42
#include "gc/g1/g1SATBCardTableModRefBS.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30211
diff changeset
    43
#include "gc/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
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    57
// A 2-D table for managing compressed displacement(disp8) on EVEX enabled platforms.
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    58
unsigned char tuple_table[Assembler::EVEX_ETUP + 1][Assembler::AVX_512bit + 1] = {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    59
  // -----------------Table 4.5 -------------------- //
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    60
  16, 32, 64,  // EVEX_FV(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    61
  4,  4,  4,   // EVEX_FV(1) - with Evex.b
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    62
  16, 32, 64,  // EVEX_FV(2) - with Evex.w
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    63
  8,  8,  8,   // EVEX_FV(3) - with Evex.w and Evex.b
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    64
  8,  16, 32,  // EVEX_HV(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    65
  4,  4,  4,   // EVEX_HV(1) - with Evex.b
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    66
  // -----------------Table 4.6 -------------------- //
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    67
  16, 32, 64,  // EVEX_FVM(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    68
  1,  1,  1,   // EVEX_T1S(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    69
  2,  2,  2,   // EVEX_T1S(1)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    70
  4,  4,  4,   // EVEX_T1S(2)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    71
  8,  8,  8,   // EVEX_T1S(3)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    72
  4,  4,  4,   // EVEX_T1F(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    73
  8,  8,  8,   // EVEX_T1F(1)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    74
  8,  8,  8,   // EVEX_T2(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    75
  0,  16, 16,  // EVEX_T2(1)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    76
  0,  16, 16,  // EVEX_T4(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    77
  0,  0,  32,  // EVEX_T4(1)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    78
  0,  0,  32,  // EVEX_T8(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    79
  8,  16, 32,  // EVEX_HVM(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    80
  4,  8,  16,  // EVEX_QVM(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    81
  2,  4,  8,   // EVEX_OVM(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    82
  16, 16, 16,  // EVEX_M128(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    83
  8,  32, 64,  // EVEX_DUP(0)
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    84
  0,  0,  0    // EVEX_NTUP
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    85
};
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
    86
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
AddressLiteral::AddressLiteral(address target, relocInfo::relocType rtype) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  _is_lval = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  _target = target;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  switch (rtype) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  case relocInfo::oop_type:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13485
diff changeset
    92
  case relocInfo::metadata_type:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    // Oops are a special case. Normally they would be their own section
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    // but in cases like icBuffer they are literals in the code stream that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    // we don't have a section for. We use none so that we get a literal address
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    // which is always patchable.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  case relocInfo::external_word_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    _rspec = external_word_Relocation::spec(target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  case relocInfo::internal_word_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    _rspec = internal_word_Relocation::spec(target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  case relocInfo::opt_virtual_call_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    _rspec = opt_virtual_call_Relocation::spec();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  case relocInfo::static_call_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    _rspec = static_call_Relocation::spec();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  case relocInfo::runtime_call_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    _rspec = runtime_call_Relocation::spec();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  case relocInfo::poll_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  case relocInfo::poll_return_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    _rspec = Relocation::spec_simple(rtype);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  case relocInfo::none:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
// Implementation of Address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   127
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   128
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
Address Address::make_array(ArrayAddress adr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  // Not implementable on 64bit machines
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  // Should have been handled higher up the call chain.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  ShouldNotReachHere();
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   133
  return Address();
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   136
// exceedingly dangerous constructor
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   137
Address::Address(int disp, address loc, relocInfo::relocType rtype) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   138
  _base  = noreg;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   139
  _index = noreg;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   140
  _scale = no_scale;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   141
  _disp  = disp;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   142
  switch (rtype) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   143
    case relocInfo::external_word_type:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   144
      _rspec = external_word_Relocation::spec(loc);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   145
      break;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   146
    case relocInfo::internal_word_type:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   147
      _rspec = internal_word_Relocation::spec(loc);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   148
      break;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   149
    case relocInfo::runtime_call_type:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   150
      // HMM
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   151
      _rspec = runtime_call_Relocation::spec();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   152
      break;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   153
    case relocInfo::poll_type:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   154
    case relocInfo::poll_return_type:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   155
      _rspec = Relocation::spec_simple(rtype);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   156
      break;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   157
    case relocInfo::none:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   158
      break;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   159
    default:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   160
      ShouldNotReachHere();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   161
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   162
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   163
#else // LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   164
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   165
Address Address::make_array(ArrayAddress adr) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  AddressLiteral base = adr.base();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  Address index = adr.index();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  assert(index._disp == 0, "must not have disp"); // maybe it can?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  Address array(index._base, index._index, index._scale, (intptr_t) base.target());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  array._rspec = base._rspec;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  return array;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   172
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
// exceedingly dangerous constructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
Address::Address(address loc, RelocationHolder spec) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  _base  = noreg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  _index = noreg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  _scale = no_scale;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  _disp  = (intptr_t) loc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  _rspec = spec;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   182
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
#endif // _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   185
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   186
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
// Convert the raw encoding form into the form expected by the constructor for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
// Address.  An index of 4 (rsp) corresponds to having no index, so convert
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
// that to noreg for the Address constructor.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13485
diff changeset
   190
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
   191
  RelocationHolder rspec;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13485
diff changeset
   192
  if (disp_reloc != relocInfo::none) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13485
diff changeset
   193
    rspec = Relocation::spec_simple(disp_reloc);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
   194
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  bool valid_index = index != rsp->encoding();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  if (valid_index) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    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
   198
    madr._rspec = rspec;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
    return madr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    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
   202
    madr._rspec = rspec;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
    return madr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
// Implementation of Assembler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
int AbstractAssembler::code_fill_byte() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  return (u_char)'\xF4'; // hlt
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
// make this go away someday
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
void Assembler::emit_data(jint data, relocInfo::relocType rtype, int format) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  if (rtype == relocInfo::none)
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   216
    emit_int32(data);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   217
  else
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   218
    emit_data(data, Relocation::spec_simple(rtype), format);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
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
   222
  assert(imm_operand == 0, "default format must be immediate in this file");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  assert(inst_mark() != NULL, "must be inside InstructionMark");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  if (rspec.type() !=  relocInfo::none) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    #ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
      check_relocation(rspec, format);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    #endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    // Do not use AbstractAssembler::relocate, which is not intended for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    // embedded words.  Instead, relocate to the enclosing instruction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    // hack. call32 is too wide for mask so use disp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    if (format == call32_operand)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
      code_section()->relocate(inst_mark(), rspec, disp32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
    else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
      code_section()->relocate(inst_mark(), rspec, format);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  }
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   237
  emit_int32(data);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   240
static int encode(Register r) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   241
  int enc = r->encoding();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   242
  if (enc >= 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   243
    enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   244
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   245
  return enc;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   246
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   247
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
void Assembler::emit_arith_b(int op1, int op2, Register dst, int imm8) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  assert(dst->has_byte_register(), "must have byte register");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  assert(isByte(op1) && isByte(op2), "wrong opcode");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  assert(isByte(imm8), "not a byte");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  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
   253
  emit_int8(op1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   254
  emit_int8(op2 | encode(dst));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   255
  emit_int8(imm8);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   259
void Assembler::emit_arith(int op1, int op2, Register dst, int32_t imm32) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  assert(isByte(op1) && isByte(op2), "wrong opcode");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  assert((op1 & 0x01) == 1, "should be 32bit operation");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  assert((op1 & 0x02) == 0, "sign-extension bit should not be set");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  if (is8bit(imm32)) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   264
    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
   265
    emit_int8(op2 | encode(dst));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   266
    emit_int8(imm32 & 0xFF);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   268
    emit_int8(op1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   269
    emit_int8(op2 | encode(dst));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   270
    emit_int32(imm32);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   274
// 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
   275
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
   276
  assert(isByte(op1) && isByte(op2), "wrong opcode");
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   277
  assert((op1 & 0x01) == 1, "should be 32bit operation");
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   278
  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
   279
  emit_int8(op1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   280
  emit_int8(op2 | encode(dst));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   281
  emit_int32(imm32);
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   282
}
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
   283
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
// immediate-to-memory forms
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   285
void Assembler::emit_arith_operand(int op1, Register rm, Address adr, int32_t imm32) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  assert((op1 & 0x01) == 1, "should be 32bit operation");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  assert((op1 & 0x02) == 0, "sign-extension bit should not be set");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  if (is8bit(imm32)) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   289
    emit_int8(op1 | 0x02); // set sign bit
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   290
    emit_operand(rm, adr, 1);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   291
    emit_int8(imm32 & 0xFF);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   293
    emit_int8(op1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   294
    emit_operand(rm, adr, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
   295
    emit_int32(imm32);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
void Assembler::emit_arith(int op1, int op2, Register dst, Register src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  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
   302
  emit_int8(op1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   303
  emit_int8(op2 | encode(dst) << 3 | encode(src));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   304
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   305
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   306
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   307
bool Assembler::query_compressed_disp_byte(int disp, bool is_evex_inst, int vector_len,
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   308
                                           int cur_tuple_type, int in_size_in_bits, int cur_encoding) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   309
  int mod_idx = 0;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   310
  // We will test if the displacement fits the compressed format and if so
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   311
  // apply the compression to the displacment iff the result is8bit.
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   312
  if (VM_Version::supports_evex() && is_evex_inst) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   313
    switch (cur_tuple_type) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   314
    case EVEX_FV:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   315
      if ((cur_encoding & VEX_W) == VEX_W) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   316
        mod_idx = ((cur_encoding & EVEX_Rb) == EVEX_Rb) ? 3 : 2;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   317
      } else {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   318
        mod_idx = ((cur_encoding & EVEX_Rb) == EVEX_Rb) ? 1 : 0;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   319
      }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   320
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   321
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   322
    case EVEX_HV:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   323
      mod_idx = ((cur_encoding & EVEX_Rb) == EVEX_Rb) ? 1 : 0;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   324
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   325
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   326
    case EVEX_FVM:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   327
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   328
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   329
    case EVEX_T1S:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   330
      switch (in_size_in_bits) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   331
      case EVEX_8bit:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   332
        break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   333
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   334
      case EVEX_16bit:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   335
        mod_idx = 1;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   336
        break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   337
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   338
      case EVEX_32bit:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   339
        mod_idx = 2;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   340
        break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   341
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   342
      case EVEX_64bit:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   343
        mod_idx = 3;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   344
        break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   345
      }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   346
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   347
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   348
    case EVEX_T1F:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   349
    case EVEX_T2:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   350
    case EVEX_T4:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   351
      mod_idx = (in_size_in_bits == EVEX_64bit) ? 1 : 0;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   352
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   353
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   354
    case EVEX_T8:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   355
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   356
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   357
    case EVEX_HVM:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   358
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   359
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   360
    case EVEX_QVM:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   361
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   362
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   363
    case EVEX_OVM:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   364
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   365
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   366
    case EVEX_M128:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   367
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   368
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   369
    case EVEX_DUP:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   370
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   371
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   372
    default:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   373
      assert(0, "no valid evex tuple_table entry");
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   374
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   375
    }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   376
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   377
    if (vector_len >= AVX_128bit && vector_len <= AVX_512bit) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   378
      int disp_factor = tuple_table[cur_tuple_type + mod_idx][vector_len];
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   379
      if ((disp % disp_factor) == 0) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   380
        int new_disp = disp / disp_factor;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   381
        if ((-0x80 <= new_disp && new_disp < 0x80)) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   382
          disp = new_disp;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   383
        }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   384
      } else {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   385
        return false;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   386
      }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   387
    }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   388
  }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   389
  return (-0x80 <= disp && disp < 0x80);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   390
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   391
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   392
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   393
bool Assembler::emit_compressed_disp_byte(int &disp) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   394
  int mod_idx = 0;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   395
  // We will test if the displacement fits the compressed format and if so
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   396
  // apply the compression to the displacment iff the result is8bit.
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   397
  if (VM_Version::supports_evex() && (_attributes != NULL) && _attributes->is_evex_instruction()) {
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   398
    int evex_encoding = _attributes->get_evex_encoding();
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   399
    int tuple_type = _attributes->get_tuple_type();
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   400
    switch (tuple_type) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   401
    case EVEX_FV:
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   402
      if ((evex_encoding & VEX_W) == VEX_W) {
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   403
        mod_idx = ((evex_encoding & EVEX_Rb) == EVEX_Rb) ? 3 : 2;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   404
      } else {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   405
        mod_idx = ((evex_encoding & EVEX_Rb) == EVEX_Rb) ? 1 : 0;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   406
      }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   407
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   408
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   409
    case EVEX_HV:
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   410
      mod_idx = ((evex_encoding & EVEX_Rb) == EVEX_Rb) ? 1 : 0;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   411
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   412
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   413
    case EVEX_FVM:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   414
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   415
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   416
    case EVEX_T1S:
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   417
      switch (_attributes->get_input_size()) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   418
      case EVEX_8bit:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   419
        break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   420
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   421
      case EVEX_16bit:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   422
        mod_idx = 1;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   423
        break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   424
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   425
      case EVEX_32bit:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   426
        mod_idx = 2;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   427
        break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   428
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   429
      case EVEX_64bit:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   430
        mod_idx = 3;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   431
        break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   432
      }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   433
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   434
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   435
    case EVEX_T1F:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   436
    case EVEX_T2:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   437
    case EVEX_T4:
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   438
      mod_idx = (_attributes->get_input_size() == EVEX_64bit) ? 1 : 0;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   439
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   440
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   441
    case EVEX_T8:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   442
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   443
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   444
    case EVEX_HVM:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   445
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   446
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   447
    case EVEX_QVM:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   448
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   449
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   450
    case EVEX_OVM:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   451
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   452
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   453
    case EVEX_M128:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   454
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   455
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   456
    case EVEX_DUP:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   457
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   458
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   459
    default:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   460
      assert(0, "no valid evex tuple_table entry");
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   461
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   462
    }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   463
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   464
    int vector_len = _attributes->get_vector_len();
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   465
    if (vector_len >= AVX_128bit && vector_len <= AVX_512bit) {
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   466
      int disp_factor = tuple_table[tuple_type + mod_idx][vector_len];
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   467
      if ((disp % disp_factor) == 0) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   468
        int new_disp = disp / disp_factor;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   469
        if (is8bit(new_disp)) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   470
          disp = new_disp;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   471
        }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   472
      } else {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   473
        return false;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   474
      }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   475
    }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   476
  }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   477
  return is8bit(disp);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   478
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   479
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   480
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   481
void Assembler::emit_operand(Register reg, Register base, Register index,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   482
                             Address::ScaleFactor scale, int disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   483
                             RelocationHolder const& rspec,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   484
                             int rip_relative_correction) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
  relocInfo::relocType rtype = (relocInfo::relocType) rspec.type();
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   486
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   487
  // 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
   488
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   489
  int regenc = encode(reg) << 3;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   490
  int indexenc = index->is_valid() ? encode(index) << 3 : 0;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   491
  int baseenc = base->is_valid() ? encode(base) : 0;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   492
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
  if (base->is_valid()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
    if (index->is_valid()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
      assert(scale != Address::no_scale, "inconsistent address");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
      // [base + index*scale + disp]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   497
      if (disp == 0 && rtype == relocInfo::none  &&
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   498
          base != rbp LP64_ONLY(&& base != r13)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
        // [base + index*scale]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
        // [00 reg 100][ss index base]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
        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
   502
        emit_int8(0x04 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   503
        emit_int8(scale << 6 | indexenc | baseenc);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   504
      } else if (emit_compressed_disp_byte(disp) && rtype == relocInfo::none) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
        // [base + index*scale + imm8]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
        // [01 reg 100][ss index base] imm8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
        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
   508
        emit_int8(0x44 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   509
        emit_int8(scale << 6 | indexenc | baseenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   510
        emit_int8(disp & 0xFF);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
      } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   512
        // [base + index*scale + disp32]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   513
        // [10 reg 100][ss index base] disp32
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
        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
   515
        emit_int8(0x84 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   516
        emit_int8(scale << 6 | indexenc | baseenc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
        emit_data(disp, rspec, disp32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
      }
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   519
    } else if (base == rsp LP64_ONLY(|| base == r12)) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   520
      // [rsp + disp]
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
      if (disp == 0 && rtype == relocInfo::none) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   522
        // [rsp]
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
        // [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
   524
        emit_int8(0x04 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   525
        emit_int8(0x24);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   526
      } else if (emit_compressed_disp_byte(disp) && rtype == relocInfo::none) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   527
        // [rsp + imm8]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   528
        // [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
   529
        emit_int8(0x44 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   530
        emit_int8(0x24);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   531
        emit_int8(disp & 0xFF);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
      } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   533
        // [rsp + imm32]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   534
        // [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
   535
        emit_int8(0x84 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   536
        emit_int8(0x24);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
        emit_data(disp, rspec, disp32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
      // [base + disp]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   541
      assert(base != rsp LP64_ONLY(&& base != r12), "illegal addressing mode");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   542
      if (disp == 0 && rtype == relocInfo::none &&
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   543
          base != rbp LP64_ONLY(&& base != r13)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
        // [base]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
        // [00 reg base]
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   546
        emit_int8(0x00 | regenc | baseenc);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   547
      } else if (emit_compressed_disp_byte(disp) && rtype == relocInfo::none) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   548
        // [base + disp8]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   549
        // [01 reg base] disp8
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   550
        emit_int8(0x40 | regenc | baseenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   551
        emit_int8(disp & 0xFF);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
      } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   553
        // [base + disp32]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   554
        // [10 reg base] disp32
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   555
        emit_int8(0x80 | regenc | baseenc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
        emit_data(disp, rspec, disp32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
    if (index->is_valid()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
      assert(scale != Address::no_scale, "inconsistent address");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
      // [index*scale + disp]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   563
      // [00 reg 100][ss index 101] disp32
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
      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
   565
      emit_int8(0x04 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   566
      emit_int8(scale << 6 | indexenc | 0x05);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
      emit_data(disp, rspec, disp32_operand);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   568
    } else if (rtype != relocInfo::none ) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   569
      // [disp] (64bit) RIP-RELATIVE (32bit) abs
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   570
      // [00 000 101] disp32
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   571
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   572
      emit_int8(0x05 | regenc);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   573
      // Note that the RIP-rel. correction applies to the generated
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   574
      // disp field, but _not_ to the target address in the rspec.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   575
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   576
      // disp was created by converting the target address minus the pc
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   577
      // at the start of the instruction. That needs more correction here.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   578
      // intptr_t disp = target - next_ip;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   579
      assert(inst_mark() != NULL, "must be inside InstructionMark");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   580
      address next_ip = pc() + sizeof(int32_t) + rip_relative_correction;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   581
      int64_t adjusted = disp;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   582
      // Do rip-rel adjustment for 64bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   583
      LP64_ONLY(adjusted -=  (next_ip - inst_mark()));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   584
      assert(is_simm32(adjusted),
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   585
             "must be 32bit offset (RIP relative address)");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   586
      emit_data((int32_t) adjusted, rspec, disp32_operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   587
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
    } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   589
      // 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
   590
      // [disp] ABSOLUTE
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   591
      // [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
   592
      emit_int8(0x04 | regenc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
   593
      emit_int8(0x25);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
      emit_data(disp, rspec, disp32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   599
void Assembler::emit_operand(XMMRegister reg, Register base, Register index,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   600
                             Address::ScaleFactor scale, int disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   601
                             RelocationHolder const& rspec) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   602
  if (UseAVX > 2) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   603
    int xreg_enc = reg->encoding();
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   604
    if (xreg_enc > 15) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   605
      XMMRegister new_reg = as_XMMRegister(xreg_enc & 0xf);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   606
      emit_operand((Register)new_reg, base, index, scale, disp, rspec);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   607
      return;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   608
    }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   609
  }
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   610
  emit_operand((Register)reg, base, index, scale, disp, rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   611
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   612
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
// Secret local extension to Assembler::WhichOperand:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
#define end_pc_operand (_WhichOperand_limit)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
address Assembler::locate_operand(address inst, WhichOperand which) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
  // Decode the given instruction, and return the address of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
  // an embedded 32-bit operand word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
  // If "which" is disp32_operand, selects the displacement portion
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
  // of an effective address specifier.
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   622
  // If "which" is imm64_operand, selects the trailing immediate constant.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
  // If "which" is call32_operand, selects the displacement of a call or jump.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
  // 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
   625
  // and that it is 32/64 bits wide.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
  // If "which" is end_pc_operand, find the end of the instruction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
  address ip = inst;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   630
  bool is_64bit = false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   631
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   632
  debug_only(bool has_disp32 = false);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   633
  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
   634
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   635
  again_after_prefix:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
  switch (0xFF & *ip++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
  // 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
   639
#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
   640
#define REP8(x) (x)+0: case (x)+1: case (x)+2: case (x)+3: \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
             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
   642
#define REP16(x) REP8((x)+0): \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
              case REP8((x)+8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
  case CS_segment:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
  case SS_segment:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
  case DS_segment:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
  case ES_segment:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
  case FS_segment:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
  case GS_segment:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   651
    // Seems dubious
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   652
    LP64_ONLY(assert(false, "shouldn't have that prefix"));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
    assert(ip == inst+1, "only one prefix allowed");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
    goto again_after_prefix;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   656
  case 0x67:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   657
  case REX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   658
  case REX_B:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   659
  case REX_X:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   660
  case REX_XB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   661
  case REX_R:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   662
  case REX_RB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   663
  case REX_RX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   664
  case REX_RXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   665
    NOT_LP64(assert(false, "64bit prefixes"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   666
    goto again_after_prefix;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   667
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   668
  case REX_W:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   669
  case REX_WB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   670
  case REX_WX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   671
  case REX_WXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   672
  case REX_WR:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   673
  case REX_WRB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   674
  case REX_WRX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   675
  case REX_WRXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   676
    NOT_LP64(assert(false, "64bit prefixes"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   677
    is_64bit = true;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   678
    goto again_after_prefix;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   679
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   680
  case 0xFF: // pushq a; decl a; incl a; call a; jmp a
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   681
  case 0x88: // movb a, r
489c9b5090e2 Initial load
duke
parents:
diff changeset
   682
  case 0x89: // movl a, r
489c9b5090e2 Initial load
duke
parents:
diff changeset
   683
  case 0x8A: // movb r, a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   684
  case 0x8B: // movl r, a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
  case 0x8F: // popl a
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   686
    debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   687
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   689
  case 0x68: // pushq #32
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   690
    if (which == end_pc_operand) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   691
      return ip + 4;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   692
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   693
    assert(which == imm_operand && !is_64bit, "pushl has no disp32 or 64bit immediate");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   694
    return ip;                  // not produced by emit_operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
  case 0x66: // movw ... (size prefix)
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   697
    again_after_size_prefix2:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   698
    switch (0xFF & *ip++) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   699
    case REX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   700
    case REX_B:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   701
    case REX_X:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   702
    case REX_XB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   703
    case REX_R:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   704
    case REX_RB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   705
    case REX_RX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   706
    case REX_RXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   707
    case REX_W:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   708
    case REX_WB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   709
    case REX_WX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   710
    case REX_WXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   711
    case REX_WR:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   712
    case REX_WRB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   713
    case REX_WRX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   714
    case REX_WRXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   715
      NOT_LP64(assert(false, "64bit prefix found"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   716
      goto again_after_size_prefix2;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
    case 0x8B: // movw r, a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
    case 0x89: // movw a, r
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   719
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
    case 0xC7: // movw a, #16
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   722
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
      tail_size = 2;  // the imm16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
    case 0x0F: // several SSE/SSE2 variants
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
      ip--;    // reparse the 0x0F
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
      goto again_after_prefix;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
      ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   730
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   733
  case REP8(0xB8): // movl/q r, #32/#64(oop?)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   734
    if (which == end_pc_operand)  return ip + (is_64bit ? 8 : 4);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   735
    // these asserts are somewhat nonsensical
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   736
#ifndef _LP64
12268
f7897aacb9ce 7157141: crash in 64 bit with corrupted oops
never
parents: 11791
diff changeset
   737
    assert(which == imm_operand || which == disp32_operand,
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 32727
diff changeset
   738
           "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
   739
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   740
    assert((which == call32_operand || which == imm_operand) && is_64bit ||
12268
f7897aacb9ce 7157141: crash in 64 bit with corrupted oops
never
parents: 11791
diff changeset
   741
           which == narrow_oop_operand && !is_64bit,
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 32727
diff changeset
   742
           "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
   743
#endif // _LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
    return ip;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
  case 0x69: // imul r, a, #32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
  case 0xC7: // movl a, #32(oop?)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
    tail_size = 4;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   749
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
  case 0x0F: // movx..., etc.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
    switch (0xFF & *ip++) {
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   754
    case 0x3A: // pcmpestri
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   755
      tail_size = 1;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   756
    case 0x38: // ptest, pmovzxbw
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   757
      ip++; // skip opcode
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   758
      debug_only(has_disp32 = true); // has both kinds of operands!
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   759
      break;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   760
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   761
    case 0x70: // pshufd r, r/a, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   762
      debug_only(has_disp32 = true); // has both kinds of operands!
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   763
    case 0x73: // psrldq r, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   764
      tail_size = 1;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   765
      break;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   766
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
    case 0x12: // movlps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   768
    case 0x28: // movaps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   769
    case 0x2E: // ucomiss
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
    case 0x2F: // comiss
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
    case 0x54: // andps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
    case 0x55: // andnps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
    case 0x56: // orps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
    case 0x57: // xorps
35146
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
   775
    case 0x58: // addpd
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
   776
    case 0x59: // mulpd
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   777
    case 0x6E: // movd
489c9b5090e2 Initial load
duke
parents:
diff changeset
   778
    case 0x7E: // movd
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   779
    case 0xAE: // ldmxcsr, stmxcsr, fxrstor, fxsave, clflush
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   780
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   781
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   782
489c9b5090e2 Initial load
duke
parents:
diff changeset
   783
    case 0xAD: // shrd r, a, %cl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   784
    case 0xAF: // imul r, a
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   785
    case 0xBE: // movsbl r, a (movsxb)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   786
    case 0xBF: // movswl r, a (movsxw)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   787
    case 0xB6: // movzbl r, a (movzxb)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   788
    case 0xB7: // movzwl r, a (movzxw)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
    case REP16(0x40): // cmovl cc, r, a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
    case 0xB0: // cmpxchgb
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
    case 0xB1: // cmpxchg
489c9b5090e2 Initial load
duke
parents:
diff changeset
   792
    case 0xC1: // xaddl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
    case 0xC7: // cmpxchg8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
    case REP16(0x90): // setcc a
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   795
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
      // fall out of the switch to decode the address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
      break;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   798
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   799
    case 0xC4: // pinsrw r, a, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   800
      debug_only(has_disp32 = true);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   801
    case 0xC5: // pextrw r, r, #8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   802
      tail_size = 1;  // the imm8
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   803
      break;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   804
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   805
    case 0xAC: // shrd r, a, #8
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   806
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
      tail_size = 1;  // the imm8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
      break;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   809
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   810
    case REP16(0x80): // jcc rdisp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
      if (which == end_pc_operand)  return ip + 4;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   812
      assert(which == call32_operand, "jcc has no disp32 or imm");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   813
      return ip;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   814
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   815
      ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   816
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   817
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   818
489c9b5090e2 Initial load
duke
parents:
diff changeset
   819
  case 0x81: // addl a, #32; addl r, #32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   820
    // also: orl, adcl, sbbl, andl, subl, xorl, cmpl
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   821
    // on 32bit in the case of cmpl, the imm might be an oop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   822
    tail_size = 4;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   823
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
489c9b5090e2 Initial load
duke
parents:
diff changeset
   826
  case 0x83: // addl a, #8; addl r, #8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   827
    // also: orl, adcl, sbbl, andl, subl, xorl, cmpl
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   828
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   829
    tail_size = 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
  case 0x9B:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   833
    switch (0xFF & *ip++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   834
    case 0xD9: // fnstcw a
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   835
      debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   836
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   837
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   838
      ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   839
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   840
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   841
489c9b5090e2 Initial load
duke
parents:
diff changeset
   842
  case REP4(0x00): // addb a, r; addl a, r; addb r, a; addl r, a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   843
  case REP4(0x10): // adc...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   844
  case REP4(0x20): // and...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   845
  case REP4(0x30): // xor...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   846
  case REP4(0x08): // or...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   847
  case REP4(0x18): // sbb...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   848
  case REP4(0x28): // sub...
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   849
  case 0xF7: // mull a
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   850
  case 0x8D: // lea r, a
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   851
  case 0x87: // xchg r, a
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   852
  case REP4(0x38): // cmp...
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   853
  case 0x85: // test r, a
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   854
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   855
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   856
489c9b5090e2 Initial load
duke
parents:
diff changeset
   857
  case 0xC1: // sal a, #8; sar a, #8; shl a, #8; shr a, #8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   858
  case 0xC6: // movb a, #8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   859
  case 0x80: // cmpb a, #8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   860
  case 0x6B: // imul r, a, #8
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   861
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   862
    tail_size = 1; // the imm8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   863
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   864
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   865
  case 0xC4: // VEX_3bytes
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   866
  case 0xC5: // VEX_2bytes
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   867
    assert((UseAVX > 0), "shouldn't have VEX prefix");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   868
    assert(ip == inst+1, "no prefixes allowed");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   869
    // 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
   870
    // but they have prefix 0x0F and processed when 0x0F processed above.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   871
    //
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   872
    // 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
   873
    // instructions (these instructions are not supported in 64-bit mode).
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   874
    // 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
   875
    // 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
   876
    // those VEX bits REX and vvvv bits are inverted.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   877
    //
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   878
    // Fortunately C2 doesn't generate these instructions so we don't need
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   879
    // to check for them in product version.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   880
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   881
    // Check second byte
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   882
    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
   883
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   884
    int vex_opcode;
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   885
    // First byte
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   886
    if ((0xFF & *inst) == VEX_3bytes) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   887
      vex_opcode = VEX_OPCODE_MASK & *ip;
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   888
      ip++; // third byte
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   889
      is_64bit = ((VEX_W & *ip) == VEX_W);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   890
    } else {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   891
      vex_opcode = VEX_OPCODE_0F;
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   892
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   893
    ip++; // opcode
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   894
    // To find the end of instruction (which == end_pc_operand).
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   895
    switch (vex_opcode) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   896
      case VEX_OPCODE_0F:
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   897
        switch (0xFF & *ip) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   898
        case 0x70: // pshufd r, r/a, #8
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   899
        case 0x71: // ps[rl|ra|ll]w r, #8
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   900
        case 0x72: // ps[rl|ra|ll]d r, #8
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   901
        case 0x73: // ps[rl|ra|ll]q r, #8
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   902
        case 0xC2: // cmp[ps|pd|ss|sd] r, r, r/a, #8
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   903
        case 0xC4: // pinsrw r, r, r/a, #8
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   904
        case 0xC5: // pextrw r/a, r, #8
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   905
        case 0xC6: // shufp[s|d] r, r, r/a, #8
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   906
          tail_size = 1;  // the imm8
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   907
          break;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   908
        }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   909
        break;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   910
      case VEX_OPCODE_0F_3A:
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   911
        tail_size = 1;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
   912
        break;
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   913
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   914
    ip++; // skip opcode
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   915
    debug_only(has_disp32 = true); // has both kinds of operands!
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   916
    break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   917
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   918
  case 0x62: // EVEX_4bytes
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   919
    assert((UseAVX > 0), "shouldn't have EVEX prefix");
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   920
    assert(ip == inst+1, "no prefixes allowed");
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   921
    // no EVEX collisions, all instructions that have 0x62 opcodes
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   922
    // have EVEX versions and are subopcodes of 0x66
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   923
    ip++; // skip P0 and exmaine W in P1
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   924
    is_64bit = ((VEX_W & *ip) == VEX_W);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   925
    ip++; // move to P2
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   926
    ip++; // skip P2, move to opcode
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   927
    // To find the end of instruction (which == end_pc_operand).
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   928
    switch (0xFF & *ip) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   929
    case 0x61: // pcmpestri r, r/a, #8
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   930
    case 0x70: // pshufd r, r/a, #8
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   931
    case 0x73: // psrldq r, #8
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   932
      tail_size = 1;  // the imm8
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   933
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   934
    default:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   935
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   936
    }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   937
    ip++; // skip opcode
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   938
    debug_only(has_disp32 = true); // has both kinds of operands!
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   939
    break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
   940
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   941
  case 0xD1: // sal a, 1; sar a, 1; shl a, 1; shr a, 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   942
  case 0xD3: // sal a, %cl; sar a, %cl; shl a, %cl; shr a, %cl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   943
  case 0xD9: // fld_s a; fst_s a; fstp_s a; fldcw a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   944
  case 0xDD: // fld_d a; fst_d a; fstp_d a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   945
  case 0xDB: // fild_s a; fistp_s a; fld_x a; fstp_x a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   946
  case 0xDF: // fild_d a; fistp_d a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   947
  case 0xD8: // fadd_s a; fsubr_s a; fmul_s a; fdivr_s a; fcomp_s a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   948
  case 0xDC: // fadd_d a; fsubr_d a; fmul_d a; fdivr_d a; fcomp_d a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   949
  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
   950
    debug_only(has_disp32 = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   951
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   952
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   953
  case 0xE8: // call rdisp32
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   954
  case 0xE9: // jmp  rdisp32
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   955
    if (which == end_pc_operand)  return ip + 4;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   956
    assert(which == call32_operand, "call has no disp32 or imm");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   957
    return ip;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
   958
1500
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 1437
diff changeset
   959
  case 0xF0:                    // Lock
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 1437
diff changeset
   960
    assert(os::is_MP(), "only on MP");
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 1437
diff changeset
   961
    goto again_after_prefix;
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 1437
diff changeset
   962
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   963
  case 0xF3:                    // For SSE
489c9b5090e2 Initial load
duke
parents:
diff changeset
   964
  case 0xF2:                    // For SSE2
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   965
    switch (0xFF & *ip++) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   966
    case REX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   967
    case REX_B:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   968
    case REX_X:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   969
    case REX_XB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   970
    case REX_R:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   971
    case REX_RB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   972
    case REX_RX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   973
    case REX_RXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   974
    case REX_W:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   975
    case REX_WB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   976
    case REX_WX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   977
    case REX_WXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   978
    case REX_WR:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   979
    case REX_WRB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   980
    case REX_WRX:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   981
    case REX_WRXB:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   982
      NOT_LP64(assert(false, "found 64bit prefix"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   983
      ip++;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   984
    default:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   985
      ip++;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   986
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   987
    debug_only(has_disp32 = true); // has both kinds of operands!
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   988
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   989
489c9b5090e2 Initial load
duke
parents:
diff changeset
   990
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   991
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   992
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   993
#undef REP8
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   994
#undef REP16
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   995
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   996
489c9b5090e2 Initial load
duke
parents:
diff changeset
   997
  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
   998
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   999
  assert(which != imm_operand, "instruction is not a movq reg, imm64");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1000
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1001
  // assert(which != imm_operand || has_imm32, "instruction has no imm32 field");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1002
  assert(which != imm_operand || has_disp32, "instruction has no imm32 field");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1003
#endif // LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1004
  assert(which != disp32_operand || has_disp32, "instruction has no disp32 field");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1005
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1006
  // parse the output of emit_operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1007
  int op2 = 0xFF & *ip++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1008
  int base = op2 & 0x07;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1009
  int op3 = -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1010
  const int b100 = 4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1011
  const int b101 = 5;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1012
  if (base == b100 && (op2 >> 6) != 3) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1013
    op3 = 0xFF & *ip++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1014
    base = op3 & 0x07;   // refetch the base
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1015
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1016
  // now ip points at the disp (if any)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1017
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1018
  switch (op2 >> 6) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1019
  case 0:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1020
    // [00 reg  100][ss index base]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1021
    // [00 reg  100][00   100  esp]
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1022
    // [00 reg base]
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1023
    // [00 reg  100][ss index  101][disp32]
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1024
    // [00 reg  101]               [disp32]
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1025
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1026
    if (base == b101) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1027
      if (which == disp32_operand)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1028
        return ip;              // caller wants the disp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1029
      ip += 4;                  // skip the disp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1030
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1031
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1032
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1033
  case 1:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1034
    // [01 reg  100][ss index base][disp8]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1035
    // [01 reg  100][00   100  esp][disp8]
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1036
    // [01 reg base]               [disp8]
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1037
    ip += 1;                    // skip the disp8
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1038
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1039
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1040
  case 2:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1041
    // [10 reg  100][ss index base][disp32]
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1042
    // [10 reg  100][00   100  esp][disp32]
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1043
    // [10 reg base]               [disp32]
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1044
    if (which == disp32_operand)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1045
      return ip;                // caller wants the disp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1046
    ip += 4;                    // skip the disp32
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1047
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1048
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1049
  case 3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1050
    // [11 reg base]  (not a memory addressing mode)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1051
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1052
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1053
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1054
  if (which == end_pc_operand) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1055
    return ip + tail_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1056
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1057
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1058
#ifdef _LP64
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  1059
  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
  1060
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1061
  assert(which == imm_operand, "instruction has only an imm field");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1062
#endif // LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1063
  return ip;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1064
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1065
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1066
address Assembler::locate_next_instruction(address inst) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1067
  // Secretly share code with locate_operand:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1068
  return locate_operand(inst, end_pc_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1069
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1070
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1071
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1072
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1073
void Assembler::check_relocation(RelocationHolder const& rspec, int format) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1074
  address inst = inst_mark();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1075
  assert(inst != NULL && inst < pc(), "must point to beginning of instruction");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1076
  address opnd;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1077
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1078
  Relocation* r = rspec.reloc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1079
  if (r->type() == relocInfo::none) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1080
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1081
  } else if (r->is_call() || format == call32_operand) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1082
    // assert(format == imm32_operand, "cannot specify a nonzero format");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1083
    opnd = locate_operand(inst, call32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1084
  } else if (r->is_data()) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1085
    assert(format == imm_operand || format == disp32_operand
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1086
           LP64_ONLY(|| format == narrow_oop_operand), "format ok");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1087
    opnd = locate_operand(inst, (WhichOperand)format);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1088
  } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1089
    assert(format == imm_operand, "cannot specify a format");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1090
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1091
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1092
  assert(opnd == pc(), "must put operand where relocs can find it");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1093
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1094
#endif // ASSERT
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1095
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1096
void Assembler::emit_operand32(Register reg, Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1097
  assert(reg->encoding() < 8, "no extended registers");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1098
  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
  1099
  emit_operand(reg, adr._base, adr._index, adr._scale, adr._disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1100
               adr._rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1101
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1102
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1103
void Assembler::emit_operand(Register reg, Address adr,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1104
                             int rip_relative_correction) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1105
  emit_operand(reg, adr._base, adr._index, adr._scale, adr._disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1106
               adr._rspec,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1107
               rip_relative_correction);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1108
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1109
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1110
void Assembler::emit_operand(XMMRegister reg, Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1111
  emit_operand(reg, adr._base, adr._index, adr._scale, adr._disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1112
               adr._rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1113
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1114
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1115
// MMX operations
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1116
void Assembler::emit_operand(MMXRegister reg, Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1117
  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
  1118
  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
  1119
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1120
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1121
// work around gcc (3.2.1-7a) bug
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1122
void Assembler::emit_operand(Address adr, MMXRegister reg) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1123
  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
  1124
  emit_operand((Register)reg, adr._base, adr._index, adr._scale, adr._disp, adr._rspec);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1125
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1126
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1127
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1128
void Assembler::emit_farith(int b1, int b2, int i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1129
  assert(isByte(b1) && isByte(b2), "wrong opcode");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1130
  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
  1131
  emit_int8(b1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1132
  emit_int8(b2 + i);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1133
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1134
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1135
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  1136
// 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
  1137
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  1138
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
  1139
  InstructionMark im(this);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  1140
  prefix(dst);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  1141
  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
  1142
}
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  1143
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  1144
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
  1145
  InstructionMark im(this);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  1146
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1147
  emit_int8(0x11);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  1148
  emit_operand(src, dst);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  1149
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1150
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1151
void Assembler::adcl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1152
  prefix(dst);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1153
  emit_arith(0x81, 0xD0, dst, imm32);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1154
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1155
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1156
void Assembler::adcl(Register dst, Address src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1157
  InstructionMark im(this);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1158
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1159
  emit_int8(0x13);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1160
  emit_operand(dst, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1161
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1162
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1163
void Assembler::adcl(Register dst, Register src) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1164
  (void) prefix_and_encode(dst->encoding(), src->encoding());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1165
  emit_arith(0x13, 0xC0, dst, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1166
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1167
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1168
void Assembler::addl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1169
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1170
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1171
  emit_arith_operand(0x81, rax, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1172
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1173
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1174
void Assembler::addl(Address dst, Register src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1175
  InstructionMark im(this);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1176
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1177
  emit_int8(0x01);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1178
  emit_operand(src, dst);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1179
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1180
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1181
void Assembler::addl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1182
  prefix(dst);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1183
  emit_arith(0x81, 0xC0, dst, imm32);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1184
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1185
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1186
void Assembler::addl(Register dst, Address src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1187
  InstructionMark im(this);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1188
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1189
  emit_int8(0x03);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1190
  emit_operand(dst, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1191
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1192
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1193
void Assembler::addl(Register dst, Register src) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1194
  (void) prefix_and_encode(dst->encoding(), src->encoding());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1195
  emit_arith(0x03, 0xC0, dst, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1196
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1197
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1198
void Assembler::addr_nop_4() {
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  1199
  assert(UseAddressNop, "no CPU support");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1200
  // 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
  1201
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1202
  emit_int8(0x1F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1203
  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
  1204
  emit_int8(0);    // 8-bits offset (1 byte)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1205
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1206
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1207
void Assembler::addr_nop_5() {
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  1208
  assert(UseAddressNop, "no CPU support");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1209
  // 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
  1210
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1211
  emit_int8(0x1F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1212
  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
  1213
  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
  1214
  emit_int8(0);    // 8-bits offset (1 byte)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1215
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1216
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1217
void Assembler::addr_nop_7() {
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  1218
  assert(UseAddressNop, "no CPU support");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1219
  // 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
  1220
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1221
  emit_int8(0x1F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1222
  emit_int8((unsigned char)0x80);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1223
                   // emit_rm(cbuf, 0x2, EAX_enc, EAX_enc);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1224
  emit_int32(0);   // 32-bits offset (4 bytes)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1225
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1226
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1227
void Assembler::addr_nop_8() {
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  1228
  assert(UseAddressNop, "no CPU support");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1229
  // 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
  1230
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1231
  emit_int8(0x1F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1232
  emit_int8((unsigned char)0x84);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1233
                   // 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
  1234
  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
  1235
  emit_int32(0);   // 32-bits offset (4 bytes)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1236
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1237
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1238
void Assembler::addsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1239
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1240
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1241
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1242
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1243
  emit_int8((unsigned char)(0xC0 | encode));
1066
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::addsd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1247
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1248
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1249
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1250
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1251
  simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1252
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1253
  emit_operand(dst, src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1254
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1255
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1256
void Assembler::addss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1257
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1258
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1259
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1260
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1261
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1262
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1263
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1264
void Assembler::addss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1265
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1266
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1267
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1268
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1269
  simd_prefix(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1270
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1271
  emit_operand(dst, src);
1066
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
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1274
void Assembler::aesdec(XMMRegister dst, Address src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1275
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1276
  InstructionMark im(this);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1277
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1278
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1279
  emit_int8((unsigned char)0xDE);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1280
  emit_operand(dst, src);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1281
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1282
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1283
void Assembler::aesdec(XMMRegister dst, XMMRegister src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1284
  assert(VM_Version::supports_aes(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1285
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1286
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1287
  emit_int8((unsigned char)0xDE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1288
  emit_int8(0xC0 | encode);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1289
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1290
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1291
void Assembler::aesdeclast(XMMRegister dst, Address src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1292
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1293
  InstructionMark im(this);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1294
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1295
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1296
  emit_int8((unsigned char)0xDF);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1297
  emit_operand(dst, src);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1298
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1299
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1300
void Assembler::aesdeclast(XMMRegister dst, XMMRegister src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1301
  assert(VM_Version::supports_aes(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1302
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1303
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1304
  emit_int8((unsigned char)0xDF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1305
  emit_int8((unsigned char)(0xC0 | encode));
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1306
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1307
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1308
void Assembler::aesenc(XMMRegister dst, Address src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1309
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1310
  InstructionMark im(this);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1311
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1312
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1313
  emit_int8((unsigned char)0xDC);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1314
  emit_operand(dst, src);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1315
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1316
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1317
void Assembler::aesenc(XMMRegister dst, XMMRegister src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1318
  assert(VM_Version::supports_aes(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1319
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1320
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1321
  emit_int8((unsigned char)0xDC);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1322
  emit_int8(0xC0 | encode);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1323
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1324
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1325
void Assembler::aesenclast(XMMRegister dst, Address src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1326
  assert(VM_Version::supports_aes(), "");
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1327
  InstructionMark im(this);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1328
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1329
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1330
  emit_int8((unsigned char)0xDD);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1331
  emit_operand(dst, src);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1332
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1333
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1334
void Assembler::aesenclast(XMMRegister dst, XMMRegister src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1335
  assert(VM_Version::supports_aes(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1336
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1337
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1338
  emit_int8((unsigned char)0xDD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1339
  emit_int8((unsigned char)(0xC0 | encode));
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1340
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  1341
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1342
void Assembler::andl(Address dst, int32_t imm32) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1343
  InstructionMark im(this);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1344
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1345
  emit_int8((unsigned char)0x81);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1346
  emit_operand(rsp, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1347
  emit_int32(imm32);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1348
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1349
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1350
void Assembler::andl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1351
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1352
  emit_arith(0x81, 0xE0, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1353
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1354
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1355
void Assembler::andl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1356
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1357
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1358
  emit_int8(0x23);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1359
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1360
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1361
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1362
void Assembler::andl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1363
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1364
  emit_arith(0x23, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1365
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1366
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1367
void Assembler::andnl(Register dst, Register src1, Register src2) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1368
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1369
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1370
  int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1371
  emit_int8((unsigned char)0xF2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1372
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1373
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1374
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1375
void Assembler::andnl(Register dst, Register src1, Address src2) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1376
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1377
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1378
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1379
  vex_prefix(src2, src1->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1380
  emit_int8((unsigned char)0xF2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1381
  emit_operand(dst, src2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1382
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1383
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1384
void Assembler::bsfl(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1385
  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
  1386
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1387
  emit_int8((unsigned char)0xBC);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1388
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1389
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1390
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1391
void Assembler::bsrl(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1392
  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
  1393
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1394
  emit_int8((unsigned char)0xBD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1395
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1396
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  1397
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1398
void Assembler::bswapl(Register reg) { // bswap
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1399
  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
  1400
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1401
  emit_int8((unsigned char)(0xC8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1402
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1403
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1404
void Assembler::blsil(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1405
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1406
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1407
  int encode = vex_prefix_and_encode(rbx->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1408
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1409
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1410
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1411
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1412
void Assembler::blsil(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1413
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1414
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1415
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1416
  vex_prefix(src, dst->encoding(), rbx->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1417
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1418
  emit_operand(rbx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1419
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1420
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1421
void Assembler::blsmskl(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1422
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1423
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1424
  int encode = vex_prefix_and_encode(rdx->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1425
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1426
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1427
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1428
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1429
void Assembler::blsmskl(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1430
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1431
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1432
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1433
  vex_prefix(src, dst->encoding(), rdx->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1434
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1435
  emit_operand(rdx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1436
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1437
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1438
void Assembler::blsrl(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1439
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1440
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1441
  int encode = vex_prefix_and_encode(rcx->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1442
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1443
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1444
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1445
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1446
void Assembler::blsrl(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1447
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1448
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1449
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1450
  vex_prefix(src, dst->encoding(), rcx->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1451
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1452
  emit_operand(rcx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1453
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  1454
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1455
void Assembler::call(Label& L, relocInfo::relocType rtype) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1456
  // suspect disp32 is always good
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1457
  int operand = LP64_ONLY(disp32_operand) NOT_LP64(imm_operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1458
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1459
  if (L.is_bound()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1460
    const int long_size = 5;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1461
    int offs = (int)( target(L) - pc() );
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1462
    assert(offs <= 0, "assembler error");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1463
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1464
    // 1110 1000 #32-bit disp
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1465
    emit_int8((unsigned char)0xE8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1466
    emit_data(offs - long_size, rtype, operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1467
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1468
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1469
    // 1110 1000 #32-bit disp
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1470
    L.add_patch_at(code(), locator());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1471
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1472
    emit_int8((unsigned char)0xE8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1473
    emit_data(int(0), rtype, operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1474
  }
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
void Assembler::call(Register dst) {
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1478
  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
  1479
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1480
  emit_int8((unsigned char)(0xD0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1481
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1482
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1483
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1484
void Assembler::call(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1485
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1486
  prefix(adr);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1487
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1488
  emit_operand(rdx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1489
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1490
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1491
void Assembler::call_literal(address entry, RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1492
  assert(entry != NULL, "call most probably wrong");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1493
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1494
  emit_int8((unsigned char)0xE8);
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1495
  intptr_t disp = entry - (pc() + sizeof(int32_t));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1496
  assert(is_simm32(disp), "must be 32bit offset (call2)");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1497
  // Technically, should use call32_operand, but this format is
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1498
  // implied by the fact that we're emitting a call instruction.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1499
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1500
  int operand = LP64_ONLY(disp32_operand) NOT_LP64(call32_operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1501
  emit_data((int) disp, rspec, operand);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1502
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1503
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1504
void Assembler::cdql() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1505
  emit_int8((unsigned char)0x99);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1506
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1507
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1508
void Assembler::cld() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1509
  emit_int8((unsigned char)0xFC);
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1510
}
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1511
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1512
void Assembler::cmovl(Condition cc, Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1513
  NOT_LP64(guarantee(VM_Version::supports_cmov(), "illegal instruction"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1514
  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
  1515
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1516
  emit_int8(0x40 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1517
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1518
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1519
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1520
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1521
void Assembler::cmovl(Condition cc, Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1522
  NOT_LP64(guarantee(VM_Version::supports_cmov(), "illegal instruction"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1523
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1524
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1525
  emit_int8(0x40 | cc);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1526
  emit_operand(dst, src);
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::cmpb(Address dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1530
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1531
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1532
  emit_int8((unsigned char)0x80);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1533
  emit_operand(rdi, dst, 1);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1534
  emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1535
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1536
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1537
void Assembler::cmpl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1538
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1539
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1540
  emit_int8((unsigned char)0x81);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1541
  emit_operand(rdi, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1542
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1543
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1544
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1545
void Assembler::cmpl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1546
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1547
  emit_arith(0x81, 0xF8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1548
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1549
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1550
void Assembler::cmpl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1551
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1552
  emit_arith(0x3B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1553
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1554
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1555
void Assembler::cmpl(Register dst, Address  src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1556
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1557
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1558
  emit_int8((unsigned char)0x3B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1559
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1560
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1561
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1562
void Assembler::cmpw(Address dst, int imm16) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1563
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1564
  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
  1565
  emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1566
  emit_int8((unsigned char)0x81);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1567
  emit_operand(rdi, dst, 2);
14831
84828ee2a91c 8004536: replace AbstractAssembler emit_word with emit_int16
twisti
parents: 14626
diff changeset
  1568
  emit_int16(imm16);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1569
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1570
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1571
// 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
  1572
// 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
  1573
// 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
  1574
void Assembler::cmpxchgl(Register reg, Address adr) { // cmpxchg
13955
f386817ce2d2 6884973: java -XX:Atomics=2 crashes
coleenp
parents: 13952
diff changeset
  1575
  InstructionMark im(this);
f386817ce2d2 6884973: java -XX:Atomics=2 crashes
coleenp
parents: 13952
diff changeset
  1576
  prefix(adr, reg);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1577
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1578
  emit_int8((unsigned char)0xB1);
13955
f386817ce2d2 6884973: java -XX:Atomics=2 crashes
coleenp
parents: 13952
diff changeset
  1579
  emit_operand(reg, adr);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1580
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1581
27691
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1582
// 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
  1583
// 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
  1584
// 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
  1585
void Assembler::cmpxchgb(Register reg, Address adr) { // cmpxchg
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1586
  InstructionMark im(this);
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1587
  prefix(adr, reg, true);
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1588
  emit_int8(0x0F);
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1589
  emit_int8((unsigned char)0xB0);
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1590
  emit_operand(reg, adr);
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1591
}
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 26434
diff changeset
  1592
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1593
void Assembler::comisd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1594
  // NOTE: dbx seems to decode this as comiss even though the
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1595
  // 0x66 is there. Strangly ucomisd comes out correct
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1596
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1597
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1598
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1599
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1600
  simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1601
  emit_int8(0x2F);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1602
  emit_operand(dst, src);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1603
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1604
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1605
void Assembler::comisd(XMMRegister dst, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1606
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1607
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1608
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1609
  emit_int8(0x2F);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1610
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1611
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1612
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1613
void Assembler::comiss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1614
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1615
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1616
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1617
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1618
  simd_prefix(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1619
  emit_int8(0x2F);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1620
  emit_operand(dst, src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1621
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1622
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1623
void Assembler::comiss(XMMRegister dst, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1624
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1625
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1626
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1627
  emit_int8(0x2F);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1628
  emit_int8((unsigned char)(0xC0 | encode));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1629
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1630
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1631
void Assembler::cpuid() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1632
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1633
  emit_int8((unsigned char)0xA2);
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1634
}
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  1635
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1636
// Opcode / Instruction                      Op /  En  64 - Bit Mode     Compat / Leg Mode Description                  Implemented
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1637
// F2 0F 38 F0 / r       CRC32 r32, r / m8   RM        Valid             Valid             Accumulate CRC32 on r / m8.  v
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1638
// F2 REX 0F 38 F0 / r   CRC32 r32, r / m8*  RM        Valid             N.E.              Accumulate CRC32 on r / m8.  -
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1639
// F2 REX.W 0F 38 F0 / r CRC32 r64, r / m8   RM        Valid             N.E.              Accumulate CRC32 on r / m8.  -
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1640
//
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1641
// F2 0F 38 F1 / r       CRC32 r32, r / m16  RM        Valid             Valid             Accumulate CRC32 on r / m16. v
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1642
//
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1643
// F2 0F 38 F1 / r       CRC32 r32, r / m32  RM        Valid             Valid             Accumulate CRC32 on r / m32. v
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1644
//
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1645
// F2 REX.W 0F 38 F1 / r CRC32 r64, r / m64  RM        Valid             N.E.              Accumulate CRC32 on r / m64. v
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1646
void Assembler::crc32(Register crc, Register v, int8_t sizeInBytes) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1647
  assert(VM_Version::supports_sse4_2(), "");
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1648
  int8_t w = 0x01;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1649
  Prefix p = Prefix_EMPTY;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1650
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1651
  emit_int8((int8_t)0xF2);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1652
  switch (sizeInBytes) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1653
  case 1:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1654
    w = 0;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1655
    break;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1656
  case 2:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1657
  case 4:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1658
    break;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1659
  LP64_ONLY(case 8:)
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1660
    // This instruction is not valid in 32 bits
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1661
    // Note:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1662
    // http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1663
    //
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1664
    // Page B - 72   Vol. 2C says
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1665
    // qwreg2 to qwreg            1111 0010 : 0100 1R0B : 0000 1111 : 0011 1000 : 1111 0000 : 11 qwreg1 qwreg2
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1666
    // mem64 to qwreg             1111 0010 : 0100 1R0B : 0000 1111 : 0011 1000 : 1111 0000 : mod qwreg r / m
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1667
    //                                                                            F0!!!
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1668
    // while 3 - 208 Vol. 2A
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1669
    // F2 REX.W 0F 38 F1 / r       CRC32 r64, r / m64             RM         Valid      N.E.Accumulate CRC32 on r / m64.
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1670
    //
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1671
    // the 0 on a last bit is reserved for a different flavor of this instruction :
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1672
    // F2 REX.W 0F 38 F0 / r       CRC32 r64, r / m8              RM         Valid      N.E.Accumulate CRC32 on r / m8.
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1673
    p = REX_W;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1674
    break;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1675
  default:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1676
    assert(0, "Unsupported value for a sizeInBytes argument");
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1677
    break;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1678
  }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1679
  LP64_ONLY(prefix(crc, v, p);)
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1680
  emit_int8((int8_t)0x0F);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1681
  emit_int8(0x38);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1682
  emit_int8((int8_t)(0xF0 | w));
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1683
  emit_int8(0xC0 | ((crc->encoding() & 0x7) << 3) | (v->encoding() & 7));
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1684
}
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1685
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1686
void Assembler::crc32(Register crc, Address adr, int8_t sizeInBytes) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1687
  assert(VM_Version::supports_sse4_2(), "");
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1688
  InstructionMark im(this);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1689
  int8_t w = 0x01;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1690
  Prefix p = Prefix_EMPTY;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1691
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1692
  emit_int8((int8_t)0xF2);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1693
  switch (sizeInBytes) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1694
  case 1:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1695
    w = 0;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1696
    break;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1697
  case 2:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1698
  case 4:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1699
    break;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1700
  LP64_ONLY(case 8:)
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1701
    // This instruction is not valid in 32 bits
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1702
    p = REX_W;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1703
    break;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1704
  default:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1705
    assert(0, "Unsupported value for a sizeInBytes argument");
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1706
    break;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1707
  }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1708
  LP64_ONLY(prefix(crc, adr, p);)
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1709
  emit_int8((int8_t)0x0F);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1710
  emit_int8(0x38);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1711
  emit_int8((int8_t)(0xF0 | w));
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1712
  emit_operand(crc, adr);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1713
}
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  1714
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1715
void Assembler::cvtdq2pd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1716
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1717
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1718
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1719
  emit_int8((unsigned char)0xE6);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1720
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1721
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1722
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1723
void Assembler::cvtdq2ps(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1724
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1725
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1726
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1727
  emit_int8(0x5B);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1728
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1729
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1730
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1731
void Assembler::cvtsd2ss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1732
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1733
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1734
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1735
  emit_int8(0x5A);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1736
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1737
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1738
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1739
void Assembler::cvtsd2ss(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1740
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1741
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1742
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1743
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1744
  simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1745
  emit_int8(0x5A);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1746
  emit_operand(dst, src);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1747
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1748
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1749
void Assembler::cvtsi2sdl(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1750
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1751
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1752
  int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1753
  emit_int8(0x2A);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1754
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1755
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1756
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1757
void Assembler::cvtsi2sdl(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1758
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1759
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1760
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1761
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1762
  simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1763
  emit_int8(0x2A);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1764
  emit_operand(dst, src);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1765
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1766
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1767
void Assembler::cvtsi2ssl(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1768
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1769
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1770
  int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1771
  emit_int8(0x2A);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1772
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1773
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1774
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1775
void Assembler::cvtsi2ssl(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1776
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1777
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1778
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1779
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1780
  simd_prefix(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1781
  emit_int8(0x2A);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1782
  emit_operand(dst, src);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1783
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1784
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31410
diff changeset
  1785
void Assembler::cvtsi2ssq(XMMRegister dst, Register src) {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31410
diff changeset
  1786
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1787
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1788
  int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31410
diff changeset
  1789
  emit_int8(0x2A);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31410
diff changeset
  1790
  emit_int8((unsigned char)(0xC0 | encode));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31410
diff changeset
  1791
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31410
diff changeset
  1792
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1793
void Assembler::cvtss2sd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1794
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1795
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1796
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1797
  emit_int8(0x5A);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1798
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1799
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1800
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1801
void Assembler::cvtss2sd(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1802
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1803
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1804
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1805
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1806
  simd_prefix(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1807
  emit_int8(0x5A);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1808
  emit_operand(dst, src);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1809
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1810
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  1811
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1812
void Assembler::cvttsd2sil(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1813
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1814
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1815
  int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1816
  emit_int8(0x2C);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1817
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1818
}
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
void Assembler::cvttss2sil(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1821
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1822
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1823
  int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1824
  emit_int8(0x2C);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1825
  emit_int8((unsigned char)(0xC0 | encode));
1066
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::decl(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1829
  // Don't use it directly. Use MacroAssembler::decrement() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1830
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1831
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1832
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1833
  emit_operand(rcx, dst);
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::divsd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1837
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1838
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1839
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1840
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1841
  simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1842
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1843
  emit_operand(dst, src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1844
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1845
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1846
void Assembler::divsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1847
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1848
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1849
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1850
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1851
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1852
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1853
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1854
void Assembler::divss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1855
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1856
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1857
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1858
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1859
  simd_prefix(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1860
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1861
  emit_operand(dst, src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1862
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1863
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1864
void Assembler::divss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1865
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1866
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1867
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1868
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  1869
  emit_int8((unsigned char)(0xC0 | encode));
1066
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1872
void Assembler::emms() {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1873
  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
  1874
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1875
  emit_int8(0x77);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1876
}
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
void Assembler::hlt() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1879
  emit_int8((unsigned char)0xF4);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1880
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1881
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1882
void Assembler::idivl(Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1883
  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
  1884
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1885
  emit_int8((unsigned char)(0xF8 | encode));
1066
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
7121
69928525c55c 6997311: SIGFPE in new long division asm code
kvn
parents: 7115
diff changeset
  1888
void Assembler::divl(Register src) { // Unsigned
69928525c55c 6997311: SIGFPE in new long division asm code
kvn
parents: 7115
diff changeset
  1889
  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
  1890
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1891
  emit_int8((unsigned char)(0xF0 | encode));
7121
69928525c55c 6997311: SIGFPE in new long division asm code
kvn
parents: 7115
diff changeset
  1892
}
69928525c55c 6997311: SIGFPE in new long division asm code
kvn
parents: 7115
diff changeset
  1893
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1894
void Assembler::imull(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1895
  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
  1896
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1897
  emit_int8((unsigned char)0xAF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1898
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1899
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1900
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
void Assembler::imull(Register dst, Register src, int value) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1903
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1904
  if (is8bit(value)) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1905
    emit_int8(0x6B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1906
    emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1907
    emit_int8(value & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1908
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1909
    emit_int8(0x69);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1910
    emit_int8((unsigned char)(0xC0 | encode));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1911
    emit_int32(value);
1066
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
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1914
21105
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1915
void Assembler::imull(Register dst, Address src) {
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1916
  InstructionMark im(this);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1917
  prefix(src, dst);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1918
  emit_int8(0x0F);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1919
  emit_int8((unsigned char) 0xAF);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1920
  emit_operand(dst, src);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1921
}
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1922
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  1923
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1924
void Assembler::incl(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1925
  // Don't use it directly. Use MacroAssembler::increment() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1926
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1927
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1928
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1929
  emit_operand(rax, dst);
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
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10006
diff changeset
  1932
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
  1933
  InstructionMark im(this);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1934
  assert((0 <= cc) && (cc < 16), "illegal cc");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1935
  if (L.is_bound()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1936
    address dst = target(L);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1937
    assert(dst != NULL, "jcc most probably wrong");
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
    const int short_size = 2;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1940
    const int long_size = 6;
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1941
    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
  1942
    if (maybe_short && is8bit(offs - short_size)) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1943
      // 0111 tttn #8-bit disp
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1944
      emit_int8(0x70 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1945
      emit_int8((offs - short_size) & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1946
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1947
      // 0000 1111 1000 tttn #32-bit disp
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1948
      assert(is_simm32(offs - long_size),
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1949
             "must be 32bit offset (call4)");
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1950
      emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1951
      emit_int8((unsigned char)(0x80 | cc));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1952
      emit_int32(offs - long_size);
1066
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
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1955
    // Note: could eliminate cond. jumps to this jump if condition
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1956
    //       is the same however, seems to be rather unlikely case.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1957
    // 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
  1958
    //       an 8-bit displacement
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1959
    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
  1960
    emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1961
    emit_int8((unsigned char)(0x80 | cc));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  1962
    emit_int32(0);
1066
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
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1965
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1966
void Assembler::jccb(Condition cc, Label& L) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1967
  if (L.is_bound()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1968
    const int short_size = 2;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1969
    address entry = target(L);
11434
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1970
#ifdef ASSERT
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1971
    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
  1972
    intptr_t delta = short_branch_delta();
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1973
    if (delta != 0) {
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1974
      dist += (dist < 0 ? (-delta) :delta);
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1975
    }
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  1976
    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
  1977
#endif
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  1978
    intptr_t offs = (intptr_t)entry - (intptr_t)pc();
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1979
    // 0111 tttn #8-bit disp
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1980
    emit_int8(0x70 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1981
    emit_int8((offs - short_size) & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1982
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1983
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1984
    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
  1985
    emit_int8(0x70 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1986
    emit_int8(0);
1066
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
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1989
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1990
void Assembler::jmp(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1991
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1992
  prefix(adr);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  1993
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1994
  emit_operand(rsp, adr);
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
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10006
diff changeset
  1997
void Assembler::jmp(Label& L, bool maybe_short) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1998
  if (L.is_bound()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1999
    address entry = target(L);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2000
    assert(entry != NULL, "jmp most probably wrong");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2001
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2002
    const int short_size = 2;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2003
    const int long_size = 5;
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  2004
    intptr_t offs = entry - pc();
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10006
diff changeset
  2005
    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
  2006
      emit_int8((unsigned char)0xEB);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2007
      emit_int8((offs - short_size) & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2008
    } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2009
      emit_int8((unsigned char)0xE9);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  2010
      emit_int32(offs - long_size);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2011
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2012
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2013
    // By default, forward jumps are always 32-bit displacements, since
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2014
    // 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
  2015
    // 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
  2016
    // force an 8-bit displacement.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2017
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2018
    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
  2019
    emit_int8((unsigned char)0xE9);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  2020
    emit_int32(0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2021
  }
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::jmp(Register entry) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2025
  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
  2026
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2027
  emit_int8((unsigned char)(0xE0 | encode));
1066
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2030
void Assembler::jmp_literal(address dest, RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2031
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2032
  emit_int8((unsigned char)0xE9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2033
  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
  2034
  intptr_t disp = dest - (pc() + sizeof(int32_t));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2035
  assert(is_simm32(disp), "must be 32bit offset (jmp)");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2036
  emit_data(disp, rspec.reloc(), call32_operand);
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::jmpb(Label& L) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2040
  if (L.is_bound()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2041
    const int short_size = 2;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2042
    address entry = target(L);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2043
    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
  2044
#ifdef ASSERT
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  2045
    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
  2046
    intptr_t delta = short_branch_delta();
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  2047
    if (delta != 0) {
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  2048
      dist += (dist < 0 ? (-delta) :delta);
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  2049
    }
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 11430
diff changeset
  2050
    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
  2051
#endif
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  2052
    intptr_t offs = entry - pc();
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2053
    emit_int8((unsigned char)0xEB);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2054
    emit_int8((offs - short_size) & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2055
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2056
    InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2057
    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
  2058
    emit_int8((unsigned char)0xEB);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2059
    emit_int8(0);
1066
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
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2062
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2063
void Assembler::ldmxcsr( Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2064
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2065
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2066
  prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2067
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2068
  emit_int8((unsigned char)0xAE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2069
  emit_operand(as_Register(2), src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2070
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2071
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2072
void Assembler::leal(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2073
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2074
#ifdef _LP64
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2075
  emit_int8(0x67); // addr32
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2076
  prefix(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2077
#endif // LP64
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2078
  emit_int8((unsigned char)0x8D);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2079
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2080
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2081
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  2082
void Assembler::lfence() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2083
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2084
  emit_int8((unsigned char)0xAE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2085
  emit_int8((unsigned char)0xE8);
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  2086
}
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  2087
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2088
void Assembler::lock() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2089
  emit_int8((unsigned char)0xF0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2090
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2091
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  2092
void Assembler::lzcntl(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  2093
  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
  2094
  emit_int8((unsigned char)0xF3);
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  2095
  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
  2096
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2097
  emit_int8((unsigned char)0xBD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2098
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  2099
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  2100
2338
a8660a1b709b 6822204: volatile fences should prefer lock:addl to actual mfence instructions
never
parents: 2332
diff changeset
  2101
// Emit mfence instruction
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2102
void Assembler::mfence() {
2338
a8660a1b709b 6822204: volatile fences should prefer lock:addl to actual mfence instructions
never
parents: 2332
diff changeset
  2103
  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
  2104
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2105
  emit_int8((unsigned char)0xAE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2106
  emit_int8((unsigned char)0xF0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2107
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2108
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2109
void Assembler::mov(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2110
  LP64_ONLY(movq(dst, src)) NOT_LP64(movl(dst, src));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2111
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2112
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2113
void Assembler::movapd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2114
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2115
  int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2116
  InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2117
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2118
  emit_int8(0x28);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2119
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2120
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2121
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2122
void Assembler::movaps(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2123
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2124
  int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2125
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2126
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2127
  emit_int8(0x28);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2128
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2129
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2130
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2131
void Assembler::movlhps(XMMRegister dst, XMMRegister src) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2132
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2133
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2134
  int encode = simd_prefix_and_encode(dst, src, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2135
  emit_int8(0x16);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2136
  emit_int8((unsigned char)(0xC0 | encode));
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2137
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2138
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2139
void Assembler::movb(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2140
  NOT_LP64(assert(dst->has_byte_register(), "must have byte register"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2141
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2142
  prefix(src, dst, true);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2143
  emit_int8((unsigned char)0x8A);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2144
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2145
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2146
33465
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  2147
void Assembler::movddup(XMMRegister dst, XMMRegister src) {
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  2148
  NOT_LP64(assert(VM_Version::supports_sse3(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2149
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_128bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2150
  InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2151
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
33465
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  2152
  emit_int8(0x12);
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  2153
  emit_int8(0xC0 | encode);
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  2154
}
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  2155
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2156
void Assembler::kmovbl(KRegister dst, Register src) {
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2157
  assert(VM_Version::supports_avx512dq(), "");
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2158
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2159
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2160
  emit_int8((unsigned char)0x92);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2161
  emit_int8((unsigned char)(0xC0 | encode));
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2162
}
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2163
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2164
void Assembler::kmovbl(Register dst, KRegister src) {
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2165
  assert(VM_Version::supports_avx512dq(), "");
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2166
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2167
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2168
  emit_int8((unsigned char)0x93);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2169
  emit_int8((unsigned char)(0xC0 | encode));
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2170
}
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2171
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2172
void Assembler::kmovwl(KRegister dst, Register src) {
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2173
  assert(VM_Version::supports_evex(), "");
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2174
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2175
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2176
  emit_int8((unsigned char)0x92);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2177
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2178
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2179
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2180
void Assembler::kmovwl(Register dst, KRegister src) {
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2181
  assert(VM_Version::supports_evex(), "");
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2182
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2183
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2184
  emit_int8((unsigned char)0x93);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2185
  emit_int8((unsigned char)(0xC0 | encode));
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2186
}
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2187
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2188
void Assembler::kmovdl(KRegister dst, Register src) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2189
  assert(VM_Version::supports_avx512bw(), "");
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2190
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2191
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2192
  emit_int8((unsigned char)0x92);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2193
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2194
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2195
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2196
void Assembler::kmovdl(Register dst, KRegister src) {
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2197
  assert(VM_Version::supports_avx512bw(), "");
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2198
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2199
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2200
  emit_int8((unsigned char)0x93);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2201
  emit_int8((unsigned char)(0xC0 | encode));
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2202
}
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2203
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2204
void Assembler::kmovql(KRegister dst, KRegister src) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2205
  assert(VM_Version::supports_avx512bw(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2206
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2207
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2208
  emit_int8((unsigned char)0x90);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2209
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2210
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2211
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2212
void Assembler::kmovql(KRegister dst, Address src) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2213
  assert(VM_Version::supports_avx512bw(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2214
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2215
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2216
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2217
  emit_int8((unsigned char)0x90);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2218
  emit_operand((Register)dst, src);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2219
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2220
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2221
void Assembler::kmovql(Address dst, KRegister src) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2222
  assert(VM_Version::supports_avx512bw(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2223
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2224
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2225
  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2226
  emit_int8((unsigned char)0x90);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2227
  emit_operand((Register)src, dst);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2228
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2229
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2230
void Assembler::kmovql(KRegister dst, Register src) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2231
  assert(VM_Version::supports_avx512bw(), "");
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2232
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2233
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2234
  emit_int8((unsigned char)0x92);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2235
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2236
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2237
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2238
void Assembler::kmovql(Register dst, KRegister src) {
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2239
  assert(VM_Version::supports_avx512bw(), "");
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2240
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2241
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2242
  emit_int8((unsigned char)0x93);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2243
  emit_int8((unsigned char)(0xC0 | encode));
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2244
}
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2245
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2246
// This instruction produces ZF or CF flags
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2247
void Assembler::kortestbl(KRegister src1, KRegister src2) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2248
  assert(VM_Version::supports_avx512dq(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2249
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2250
  int encode = vex_prefix_and_encode(src1->encoding(), 0, src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2251
  emit_int8((unsigned char)0x98);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2252
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2253
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2254
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2255
// This instruction produces ZF or CF flags
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2256
void Assembler::kortestwl(KRegister src1, KRegister src2) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2257
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2258
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2259
  int encode = vex_prefix_and_encode(src1->encoding(), 0, src2->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2260
  emit_int8((unsigned char)0x98);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2261
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2262
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2263
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2264
// This instruction produces ZF or CF flags
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2265
void Assembler::kortestdl(KRegister src1, KRegister src2) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2266
  assert(VM_Version::supports_avx512bw(), "");
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2267
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2268
  int encode = vex_prefix_and_encode(src1->encoding(), 0, src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2269
  emit_int8((unsigned char)0x98);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2270
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2271
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2272
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2273
// This instruction produces ZF or CF flags
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2274
void Assembler::kortestql(KRegister src1, KRegister src2) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2275
  assert(VM_Version::supports_avx512bw(), "");
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2276
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2277
  int encode = vex_prefix_and_encode(src1->encoding(), 0, src2->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2278
  emit_int8((unsigned char)0x98);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2279
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2280
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2281
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2282
void Assembler::movb(Address dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2283
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2284
   prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2285
  emit_int8((unsigned char)0xC6);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2286
  emit_operand(rax, dst, 1);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2287
  emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2288
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2289
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2290
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2291
void Assembler::movb(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2292
  assert(src->has_byte_register(), "must have byte register");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2293
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2294
  prefix(dst, src, true);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2295
  emit_int8((unsigned char)0x88);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2296
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2297
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2298
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2299
void Assembler::movdl(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2300
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2301
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2302
  int encode = simd_prefix_and_encode(dst, xnoreg, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2303
  emit_int8(0x6E);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2304
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2305
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2306
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2307
void Assembler::movdl(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2308
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2309
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2310
  // swap src/dst to get correct prefix
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2311
  int encode = simd_prefix_and_encode(src, xnoreg, as_XMMRegister(dst->encoding()), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2312
  emit_int8(0x7E);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2313
  emit_int8((unsigned char)(0xC0 | encode));
1066
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
8494
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  2316
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
  2317
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2318
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2319
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2320
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2321
  simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2322
  emit_int8(0x6E);
8494
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  2323
  emit_operand(dst, src);
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  2324
}
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  2325
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2326
void Assembler::movdl(Address dst, XMMRegister src) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2327
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2328
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2329
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2330
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2331
  simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2332
  emit_int8(0x7E);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2333
  emit_operand(src, dst);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2334
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2335
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2336
void Assembler::movdqa(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2337
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2338
  int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2339
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2340
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2341
  emit_int8(0x6F);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2342
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2343
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2344
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2345
void Assembler::movdqa(XMMRegister dst, Address src) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2346
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2347
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2348
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2349
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2350
  simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2351
  emit_int8(0x6F);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2352
  emit_operand(dst, src);
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2353
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  2354
1437
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2355
void Assembler::movdqu(XMMRegister dst, Address src) {
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2356
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2357
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2358
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2359
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2360
  simd_prefix(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2361
  emit_int8(0x6F);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2362
  emit_operand(dst, src);
1437
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2363
}
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2364
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2365
void Assembler::movdqu(XMMRegister dst, XMMRegister src) {
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2366
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2367
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2368
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2369
  emit_int8(0x6F);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2370
  emit_int8((unsigned char)(0xC0 | encode));
1437
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2371
}
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2372
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2373
void Assembler::movdqu(Address dst, XMMRegister src) {
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2374
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2375
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2376
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2377
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2378
  simd_prefix(src, xnoreg, dst, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2379
  emit_int8(0x7F);
1437
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2380
  emit_operand(src, dst);
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2381
}
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  2382
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2383
// Move Unaligned 256bit Vector
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2384
void Assembler::vmovdqu(XMMRegister dst, XMMRegister src) {
24325
7a1b3799b906 8041957: -XX:UseAVX=0 cause assert(UseAVX) failed
kvn
parents: 23497
diff changeset
  2385
  assert(UseAVX > 0, "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2386
  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2387
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2388
  emit_int8(0x6F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2389
  emit_int8((unsigned char)(0xC0 | encode));
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2390
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2391
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2392
void Assembler::vmovdqu(XMMRegister dst, Address src) {
24325
7a1b3799b906 8041957: -XX:UseAVX=0 cause assert(UseAVX) failed
kvn
parents: 23497
diff changeset
  2393
  assert(UseAVX > 0, "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2394
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2395
  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2396
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2397
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2398
  emit_int8(0x6F);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2399
  emit_operand(dst, src);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2400
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2401
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2402
void Assembler::vmovdqu(Address dst, XMMRegister src) {
24325
7a1b3799b906 8041957: -XX:UseAVX=0 cause assert(UseAVX) failed
kvn
parents: 23497
diff changeset
  2403
  assert(UseAVX > 0, "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2404
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2405
  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2406
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2407
  // swap src<->dst for encoding
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2408
  assert(src != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2409
  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2410
  emit_int8(0x7F);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2411
  emit_operand(src, dst);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2412
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2413
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2414
// Move Unaligned EVEX enabled Vector (programmable : 8,16,32,64)
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2415
void Assembler::evmovdqub(XMMRegister dst, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2416
  assert(VM_Version::supports_evex(), "");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2417
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2418
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2419
  emit_int8(0x6F);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2420
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2421
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2422
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2423
void Assembler::evmovdqub(XMMRegister dst, Address src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2424
  assert(VM_Version::supports_evex(), "");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2425
  InstructionMark im(this);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2426
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2427
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2428
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2429
  emit_int8(0x6F);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2430
  emit_operand(dst, src);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2431
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2432
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2433
void Assembler::evmovdqub(Address dst, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2434
  assert(VM_Version::supports_evex(), "");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2435
  assert(src != xnoreg, "sanity");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2436
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2437
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2438
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2439
  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2440
  emit_int8(0x7F);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2441
  emit_operand(src, dst);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2442
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2443
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2444
void Assembler::evmovdquw(XMMRegister dst, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2445
  assert(VM_Version::supports_evex(), "");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2446
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2447
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2448
  emit_int8(0x6F);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2449
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2450
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2451
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2452
void Assembler::evmovdquw(XMMRegister dst, Address src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2453
  assert(VM_Version::supports_evex(), "");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2454
  InstructionMark im(this);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2455
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2456
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2457
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2458
  emit_int8(0x6F);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2459
  emit_operand(dst, src);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2460
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2461
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2462
void Assembler::evmovdquw(Address dst, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2463
  assert(VM_Version::supports_evex(), "");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2464
  assert(src != xnoreg, "sanity");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2465
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  2466
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2467
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2468
  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2469
  emit_int8(0x7F);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2470
  emit_operand(src, dst);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  2471
}
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2472
void Assembler::evmovdqul(XMMRegister dst, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2473
  assert(VM_Version::supports_evex(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2474
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2475
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2476
  emit_int8(0x6F);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2477
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2478
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2479
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2480
void Assembler::evmovdqul(XMMRegister dst, Address src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2481
  assert(VM_Version::supports_evex(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2482
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2483
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2484
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2485
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2486
  emit_int8(0x6F);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2487
  emit_operand(dst, src);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2488
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2489
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2490
void Assembler::evmovdqul(Address dst, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2491
  assert(VM_Version::supports_evex(), "");
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  2492
  assert(src != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2493
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2494
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2495
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2496
  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2497
  emit_int8(0x7F);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2498
  emit_operand(src, dst);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2499
}
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2500
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2501
void Assembler::evmovdquq(XMMRegister dst, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2502
  assert(VM_Version::supports_evex(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2503
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2504
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2505
  emit_int8(0x6F);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2506
  emit_int8((unsigned char)(0xC0 | encode));
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2507
}
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2508
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2509
void Assembler::evmovdquq(XMMRegister dst, Address src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2510
  assert(VM_Version::supports_evex(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2511
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2512
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2513
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2514
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2515
  emit_int8(0x6F);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2516
  emit_operand(dst, src);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2517
}
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2518
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2519
void Assembler::evmovdquq(Address dst, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2520
  assert(VM_Version::supports_evex(), "");
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  2521
  assert(src != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2522
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2523
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2524
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2525
  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2526
  emit_int8(0x7F);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2527
  emit_operand(src, dst);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2528
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  2529
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2530
// Uses zero extension on 64bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2531
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2532
void Assembler::movl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2533
  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
  2534
  emit_int8((unsigned char)(0xB8 | encode));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  2535
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2536
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2537
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2538
void Assembler::movl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2539
  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
  2540
  emit_int8((unsigned char)0x8B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2541
  emit_int8((unsigned char)(0xC0 | encode));
1066
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::movl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2545
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2546
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2547
  emit_int8((unsigned char)0x8B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2548
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2549
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2550
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2551
void Assembler::movl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2552
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2553
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2554
  emit_int8((unsigned char)0xC7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2555
  emit_operand(rax, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  2556
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2557
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2558
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2559
void Assembler::movl(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2560
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2561
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2562
  emit_int8((unsigned char)0x89);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2563
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2564
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2565
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2566
// 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
  2567
// 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
  2568
// The selection is done in MacroAssembler::movdbl() and movflt().
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2569
void Assembler::movlpd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2570
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2571
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2572
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2573
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2574
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2575
  emit_int8(0x12);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2576
  emit_operand(dst, src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2577
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2578
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2579
void Assembler::movq( MMXRegister dst, Address src ) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2580
  assert( VM_Version::supports_mmx(), "" );
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2581
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2582
  emit_int8(0x6F);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2583
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2584
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2585
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2586
void Assembler::movq( Address dst, MMXRegister src ) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2587
  assert( VM_Version::supports_mmx(), "" );
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2588
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2589
  emit_int8(0x7F);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2590
  // workaround gcc (3.2.1-7a) bug
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2591
  // 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
  2592
  // gcc will tail jump and try and reverse the parameters completely
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2593
  // obliterating dst in the process. By having a version available
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2594
  // 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
  2595
  // avoided.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2596
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2597
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2598
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2599
void Assembler::movq(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2600
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2601
  InstructionMark im(this);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2602
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2603
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2604
  simd_prefix(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2605
  emit_int8(0x7E);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2606
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2607
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2608
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2609
void Assembler::movq(Address dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2610
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2611
  InstructionMark im(this);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2612
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2613
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2614
  simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2615
  emit_int8((unsigned char)0xD6);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2616
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2617
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2618
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2619
void Assembler::movsbl(Register dst, Address src) { // movsxb
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2620
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2621
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2622
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2623
  emit_int8((unsigned char)0xBE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2624
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2625
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2626
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2627
void Assembler::movsbl(Register dst, Register src) { // movsxb
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2628
  NOT_LP64(assert(src->has_byte_register(), "must have byte register"));
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
  2629
  int encode = prefix_and_encode(dst->encoding(), false, src->encoding(), true);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2630
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2631
  emit_int8((unsigned char)0xBE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2632
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2633
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2634
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2635
void Assembler::movsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2636
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2637
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2638
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2639
  emit_int8(0x10);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2640
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2641
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2642
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2643
void Assembler::movsd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2644
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2645
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2646
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2647
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2648
  simd_prefix(dst, xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2649
  emit_int8(0x10);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2650
  emit_operand(dst, src);
1066
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2653
void Assembler::movsd(Address dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2654
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2655
  InstructionMark im(this);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2656
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2657
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2658
  simd_prefix(src, xnoreg, dst, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2659
  emit_int8(0x11);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2660
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2661
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2662
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2663
void Assembler::movss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2664
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2665
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2666
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2667
  emit_int8(0x10);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2668
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2669
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2670
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2671
void Assembler::movss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2672
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2673
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2674
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2675
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2676
  simd_prefix(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2677
  emit_int8(0x10);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2678
  emit_operand(dst, src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2679
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2680
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2681
void Assembler::movss(Address dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2682
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2683
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2684
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2685
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2686
  simd_prefix(src, xnoreg, dst, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2687
  emit_int8(0x11);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2688
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2689
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2690
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2691
void Assembler::movswl(Register dst, Address src) { // movsxw
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2692
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2693
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2694
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2695
  emit_int8((unsigned char)0xBF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2696
  emit_operand(dst, src);
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2699
void Assembler::movswl(Register dst, Register src) { // movsxw
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2700
  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
  2701
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2702
  emit_int8((unsigned char)0xBF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2703
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2704
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2705
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2706
void Assembler::movw(Address dst, int imm16) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2707
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2708
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2709
  emit_int8(0x66); // switch to 16-bit mode
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2710
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2711
  emit_int8((unsigned char)0xC7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2712
  emit_operand(rax, dst, 2);
14831
84828ee2a91c 8004536: replace AbstractAssembler emit_word with emit_int16
twisti
parents: 14626
diff changeset
  2713
  emit_int16(imm16);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2714
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2715
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2716
void Assembler::movw(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2717
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2718
  emit_int8(0x66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2719
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2720
  emit_int8((unsigned char)0x8B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2721
  emit_operand(dst, src);
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2724
void Assembler::movw(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2725
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2726
  emit_int8(0x66);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2727
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2728
  emit_int8((unsigned char)0x89);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2729
  emit_operand(src, dst);
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2732
void Assembler::movzbl(Register dst, Address src) { // movzxb
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2733
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2734
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2735
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2736
  emit_int8((unsigned char)0xB6);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2737
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2738
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2739
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2740
void Assembler::movzbl(Register dst, Register src) { // movzxb
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2741
  NOT_LP64(assert(src->has_byte_register(), "must have byte register"));
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
  2742
  int encode = prefix_and_encode(dst->encoding(), false, src->encoding(), true);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2743
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2744
  emit_int8((unsigned char)0xB6);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2745
  emit_int8(0xC0 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2746
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2747
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2748
void Assembler::movzwl(Register dst, Address src) { // movzxw
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2749
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2750
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2751
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2752
  emit_int8((unsigned char)0xB7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2753
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2754
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2755
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2756
void Assembler::movzwl(Register dst, Register src) { // movzxw
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2757
  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
  2758
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2759
  emit_int8((unsigned char)0xB7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2760
  emit_int8(0xC0 | encode);
1066
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::mull(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2764
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2765
  prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2766
  emit_int8((unsigned char)0xF7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2767
  emit_operand(rsp, src);
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2770
void Assembler::mull(Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2771
  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
  2772
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2773
  emit_int8((unsigned char)(0xE0 | encode));
1066
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2776
void Assembler::mulsd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2777
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2778
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2779
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2780
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2781
  simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2782
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2783
  emit_operand(dst, src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2784
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2785
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2786
void Assembler::mulsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2787
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2788
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2789
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2790
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2791
  emit_int8((unsigned char)(0xC0 | encode));
1066
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2794
void Assembler::mulss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2795
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2796
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2797
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2798
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2799
  simd_prefix(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2800
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2801
  emit_operand(dst, src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2802
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2803
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2804
void Assembler::mulss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2805
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2806
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2807
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2808
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2809
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2810
}
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
void Assembler::negl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2813
  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
  2814
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2815
  emit_int8((unsigned char)(0xD8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2816
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2817
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2818
void Assembler::nop(int i) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2819
#ifdef ASSERT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2820
  assert(i > 0, " ");
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2821
  // 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
  2822
  // pain to disassemble code while debugging. If asserts are on clearly
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2823
  // 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
  2824
  // to do alignment.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2825
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2826
  for (; i > 0 ; i--) emit_int8((unsigned char)0x90);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2827
  return;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2828
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2829
#endif // ASSERT
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2830
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2831
  if (UseAddressNop && VM_Version::is_intel()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2832
    //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2833
    // Using multi-bytes nops "0x0F 0x1F [address]" for Intel
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2834
    //  1: 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2835
    //  2: 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2836
    //  3: 0x66 0x66 0x90 (don't use "0x0F 0x1F 0x00" - need patching safe padding)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2837
    //  4: 0x0F 0x1F 0x40 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2838
    //  5: 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2839
    //  6: 0x66 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2840
    //  7: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2841
    //  8: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2842
    //  9: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2843
    // 10: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2844
    // 11: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2845
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2846
    // The rest coding is Intel specific - don't use consecutive address nops
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2847
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2848
    // 12: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2849
    // 13: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2850
    // 14: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2851
    // 15: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2852
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2853
    while(i >= 15) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2854
      // For Intel don't generate consecutive addess nops (mix with regular nops)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2855
      i -= 15;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2856
      emit_int8(0x66);   // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2857
      emit_int8(0x66);   // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2858
      emit_int8(0x66);   // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2859
      addr_nop_8();
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2860
      emit_int8(0x66);   // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2861
      emit_int8(0x66);   // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2862
      emit_int8(0x66);   // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2863
      emit_int8((unsigned char)0x90);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2864
                         // nop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2865
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2866
    switch (i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2867
      case 14:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2868
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2869
      case 13:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2870
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2871
      case 12:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2872
        addr_nop_8();
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2873
        emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2874
        emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2875
        emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2876
        emit_int8((unsigned char)0x90);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2877
                         // nop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2878
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2879
      case 11:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2880
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2881
      case 10:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2882
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2883
      case 9:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2884
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2885
      case 8:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2886
        addr_nop_8();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2887
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2888
      case 7:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2889
        addr_nop_7();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2890
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2891
      case 6:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2892
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2893
      case 5:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2894
        addr_nop_5();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2895
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2896
      case 4:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2897
        addr_nop_4();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2898
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2899
      case 3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2900
        // 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
  2901
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2902
      case 2:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2903
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2904
      case 1:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2905
        emit_int8((unsigned char)0x90);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2906
                         // nop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2907
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2908
      default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2909
        assert(i == 0, " ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2910
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2911
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2912
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2913
  if (UseAddressNop && VM_Version::is_amd()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2914
    //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2915
    // Using multi-bytes nops "0x0F 0x1F [address]" for AMD.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2916
    //  1: 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2917
    //  2: 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2918
    //  3: 0x66 0x66 0x90 (don't use "0x0F 0x1F 0x00" - need patching safe padding)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2919
    //  4: 0x0F 0x1F 0x40 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2920
    //  5: 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2921
    //  6: 0x66 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2922
    //  7: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2923
    //  8: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2924
    //  9: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2925
    // 10: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2926
    // 11: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2927
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2928
    // The rest coding is AMD specific - use consecutive address nops
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2929
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2930
    // 12: 0x66 0x0F 0x1F 0x44 0x00 0x00 0x66 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2931
    // 13: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00 0x66 0x0F 0x1F 0x44 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2932
    // 14: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2933
    // 15: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2934
    // 16: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2935
    //     Size prefixes (0x66) are added for larger sizes
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2936
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2937
    while(i >= 22) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2938
      i -= 11;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2939
      emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2940
      emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2941
      emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2942
      addr_nop_8();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2943
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2944
    // Generate first nop for size between 21-12
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2945
    switch (i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2946
      case 21:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2947
        i -= 1;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2948
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2949
      case 20:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2950
      case 19:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2951
        i -= 1;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2952
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2953
      case 18:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2954
      case 17:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2955
        i -= 1;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2956
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2957
      case 16:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2958
      case 15:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2959
        i -= 8;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2960
        addr_nop_8();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2961
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2962
      case 14:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2963
      case 13:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2964
        i -= 7;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2965
        addr_nop_7();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2966
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2967
      case 12:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2968
        i -= 6;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2969
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2970
        addr_nop_5();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2971
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2972
      default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2973
        assert(i < 12, " ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2974
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2975
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2976
    // Generate second nop for size between 11-1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2977
    switch (i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2978
      case 11:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2979
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2980
      case 10:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2981
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2982
      case 9:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2983
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2984
      case 8:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2985
        addr_nop_8();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2986
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2987
      case 7:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2988
        addr_nop_7();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2989
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2990
      case 6:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  2991
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2992
      case 5:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2993
        addr_nop_5();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2994
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2995
      case 4:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2996
        addr_nop_4();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2997
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2998
      case 3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2999
        // 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
  3000
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3001
      case 2:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3002
        emit_int8(0x66); // size prefix
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3003
      case 1:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3004
        emit_int8((unsigned char)0x90);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3005
                         // nop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3006
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3007
      default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3008
        assert(i == 0, " ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3009
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3010
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3011
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3012
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3013
  // Using nops with size prefixes "0x66 0x90".
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3014
  // From AMD Optimization Guide:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3015
  //  1: 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3016
  //  2: 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3017
  //  3: 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3018
  //  4: 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3019
  //  5: 0x66 0x66 0x90 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3020
  //  6: 0x66 0x66 0x90 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3021
  //  7: 0x66 0x66 0x66 0x90 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3022
  //  8: 0x66 0x66 0x66 0x90 0x66 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3023
  //  9: 0x66 0x66 0x90 0x66 0x66 0x90 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3024
  // 10: 0x66 0x66 0x66 0x90 0x66 0x66 0x90 0x66 0x66 0x90
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3025
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3026
  while(i > 12) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3027
    i -= 4;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3028
    emit_int8(0x66); // size prefix
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3029
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3030
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3031
    emit_int8((unsigned char)0x90);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3032
                     // nop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3033
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3034
  // 1 - 12 nops
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3035
  if(i > 8) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3036
    if(i > 9) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3037
      i -= 1;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3038
      emit_int8(0x66);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3039
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3040
    i -= 3;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3041
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3042
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3043
    emit_int8((unsigned char)0x90);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3044
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3045
  // 1 - 8 nops
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3046
  if(i > 4) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3047
    if(i > 6) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3048
      i -= 1;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3049
      emit_int8(0x66);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3050
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3051
    i -= 3;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3052
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3053
    emit_int8(0x66);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3054
    emit_int8((unsigned char)0x90);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3055
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3056
  switch (i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3057
    case 4:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3058
      emit_int8(0x66);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3059
    case 3:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3060
      emit_int8(0x66);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3061
    case 2:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3062
      emit_int8(0x66);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3063
    case 1:
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3064
      emit_int8((unsigned char)0x90);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3065
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3066
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3067
      assert(i == 0, " ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3068
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3069
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3070
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3071
void Assembler::notl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3072
  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
  3073
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3074
  emit_int8((unsigned char)(0xD0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3075
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3076
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3077
void Assembler::orl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3078
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3079
  prefix(dst);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  3080
  emit_arith_operand(0x81, rcx, dst, imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3081
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3082
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3083
void Assembler::orl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3084
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3085
  emit_arith(0x81, 0xC8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3086
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3087
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3088
void Assembler::orl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3089
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3090
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3091
  emit_int8(0x0B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3092
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3093
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3094
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3095
void Assembler::orl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3096
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3097
  emit_arith(0x0B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3098
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3099
31129
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  3100
void Assembler::orl(Address dst, Register src) {
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  3101
  InstructionMark im(this);
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  3102
  prefix(dst, src);
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  3103
  emit_int8(0x09);
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  3104
  emit_operand(src, dst);
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  3105
}
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  3106
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3107
void Assembler::packuswb(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3108
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3109
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3110
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3111
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3112
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3113
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3114
  emit_int8(0x67);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3115
  emit_operand(dst, src);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3116
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3117
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3118
void Assembler::packuswb(XMMRegister dst, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3119
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3120
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3121
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3122
  emit_int8(0x67);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3123
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  3124
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  3125
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  3126
void Assembler::vpackuswb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  3127
  assert(UseAVX > 0, "some form of AVX must be enabled");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3128
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3129
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3130
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3131
  emit_int8(0x67);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3132
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  3133
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  3134
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  3135
void Assembler::vpermq(XMMRegister dst, XMMRegister src, int imm8, int vector_len) {
15612
d4073ad8ce3d 8007708: compiler/6855215 assert(VM_Version::supports_sse4_2())
kvn
parents: 15483
diff changeset
  3136
  assert(VM_Version::supports_avx2(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3137
  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3138
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
15612
d4073ad8ce3d 8007708: compiler/6855215 assert(VM_Version::supports_sse4_2())
kvn
parents: 15483
diff changeset
  3139
  emit_int8(0x00);
d4073ad8ce3d 8007708: compiler/6855215 assert(VM_Version::supports_sse4_2())
kvn
parents: 15483
diff changeset
  3140
  emit_int8(0xC0 | encode);
d4073ad8ce3d 8007708: compiler/6855215 assert(VM_Version::supports_sse4_2())
kvn
parents: 15483
diff changeset
  3141
  emit_int8(imm8);
15242
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  3142
}
695bb216be99 6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents: 15117
diff changeset
  3143
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3144
void Assembler::pause() {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3145
  emit_int8((unsigned char)0xF3);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3146
  emit_int8((unsigned char)0x90);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3147
}
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3148
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3149
void Assembler::pcmpestri(XMMRegister dst, Address src, int imm8) {
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3150
  assert(VM_Version::supports_sse4_2(), "");
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3151
  InstructionMark im(this);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3152
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3153
  simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3154
  emit_int8(0x61);
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3155
  emit_operand(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3156
  emit_int8(imm8);
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3157
}
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3158
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3159
void Assembler::pcmpestri(XMMRegister dst, XMMRegister src, int imm8) {
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3160
  assert(VM_Version::supports_sse4_2(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3161
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3162
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3163
  emit_int8(0x61);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3164
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3165
  emit_int8(imm8);
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3166
}
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3167
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3168
// In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3169
void Assembler::pcmpeqb(XMMRegister dst, XMMRegister src) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3170
  assert(VM_Version::supports_sse2(), "");
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3171
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3172
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3173
  emit_int8(0x74);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3174
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3175
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3176
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3177
// In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3178
void Assembler::vpcmpeqb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3179
  assert(VM_Version::supports_avx(), "");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3180
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3181
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3182
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3183
  emit_int8(0x74);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3184
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3185
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3186
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3187
// In this context, kdst is written the mask used to process the equal components
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3188
void Assembler::evpcmpeqb(KRegister kdst, XMMRegister nds, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3189
  assert(VM_Version::supports_avx512bw(), "");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3190
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3191
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3192
  int encode = vex_prefix_and_encode(kdst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3193
  emit_int8(0x74);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3194
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3195
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3196
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3197
void Assembler::evpcmpeqb(KRegister kdst, XMMRegister nds, Address src, int vector_len) {
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3198
  assert(VM_Version::supports_avx512bw(), "");
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3199
  InstructionMark im(this);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3200
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3201
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3202
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3203
  int dst_enc = kdst->encoding();
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3204
  vex_prefix(src, nds_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3205
  emit_int8(0x74);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3206
  emit_operand(as_Register(dst_enc), src);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3207
}
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3208
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3209
// In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3210
void Assembler::pcmpeqw(XMMRegister dst, XMMRegister src) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3211
  assert(VM_Version::supports_sse2(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3212
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3213
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3214
  emit_int8(0x75);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3215
  emit_int8((unsigned char)(0xC0 | encode));
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3216
}
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3217
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3218
// In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3219
void Assembler::vpcmpeqw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3220
  assert(VM_Version::supports_avx(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3221
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3222
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3223
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3224
  emit_int8(0x75);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3225
  emit_int8((unsigned char)(0xC0 | encode));
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3226
}
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3227
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3228
// In this context, kdst is written the mask used to process the equal components
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3229
void Assembler::evpcmpeqw(KRegister kdst, XMMRegister nds, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3230
  assert(VM_Version::supports_avx512bw(), "");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3231
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3232
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3233
  int encode = vex_prefix_and_encode(kdst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3234
  emit_int8(0x75);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3235
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3236
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3237
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3238
void Assembler::evpcmpeqw(KRegister kdst, XMMRegister nds, Address src, int vector_len) {
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3239
  assert(VM_Version::supports_avx512bw(), "");
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3240
  InstructionMark im(this);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3241
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3242
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3243
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3244
  int dst_enc = kdst->encoding();
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3245
  vex_prefix(src, nds_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3246
  emit_int8(0x75);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3247
  emit_operand(as_Register(dst_enc), src);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3248
}
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3249
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3250
// In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3251
void Assembler::pcmpeqd(XMMRegister dst, XMMRegister src) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3252
  assert(VM_Version::supports_sse2(), "");
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3253
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3254
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3255
  emit_int8(0x76);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3256
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3257
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3258
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3259
// In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3260
void Assembler::vpcmpeqd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3261
  assert(VM_Version::supports_avx(), "");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3262
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3263
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3264
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3265
  emit_int8(0x76);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3266
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3267
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3268
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3269
// In this context, kdst is written the mask used to process the equal components
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3270
void Assembler::evpcmpeqd(KRegister kdst, XMMRegister nds, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3271
  assert(VM_Version::supports_evex(), "");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3272
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3273
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3274
  int encode = vex_prefix_and_encode(kdst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3275
  emit_int8(0x76);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3276
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3277
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3278
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3279
void Assembler::evpcmpeqd(KRegister kdst, XMMRegister nds, Address src, int vector_len) {
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3280
  assert(VM_Version::supports_evex(), "");
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3281
  InstructionMark im(this);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3282
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3283
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3284
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3285
  int dst_enc = kdst->encoding();
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3286
  vex_prefix(src, nds_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3287
  emit_int8(0x76);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3288
  emit_operand(as_Register(dst_enc), src);
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3289
}
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3290
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3291
// In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3292
void Assembler::pcmpeqq(XMMRegister dst, XMMRegister src) {
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3293
  assert(VM_Version::supports_sse4_1(), "");
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3294
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3295
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3296
  emit_int8(0x29);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3297
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3298
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3299
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3300
// In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3301
void Assembler::vpcmpeqq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3302
  assert(VM_Version::supports_avx(), "");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3303
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3304
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3305
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3306
  emit_int8(0x29);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3307
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3308
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3309
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3310
// In this context, kdst is written the mask used to process the equal components
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3311
void Assembler::evpcmpeqq(KRegister kdst, XMMRegister nds, XMMRegister src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3312
  assert(VM_Version::supports_evex(), "");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3313
  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3314
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3315
  int encode = vex_prefix_and_encode(kdst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3316
  emit_int8(0x29);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3317
  emit_int8((unsigned char)(0xC0 | encode));
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3318
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3319
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3320
// In this context, kdst is written the mask used to process the equal components
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3321
void Assembler::evpcmpeqq(KRegister kdst, XMMRegister nds, Address src, int vector_len) {
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3322
  assert(VM_Version::supports_evex(), "");
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3323
  InstructionMark im(this);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3324
  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3325
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3326
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3327
  int dst_enc = kdst->encoding();
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3328
  vex_prefix(src, nds_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3329
  emit_int8(0x29);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3330
  emit_operand(as_Register(dst_enc), src);
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3331
}
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3332
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3333
void Assembler::pmovmskb(Register dst, XMMRegister src) {
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3334
  assert(VM_Version::supports_sse2(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3335
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3336
  int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3337
  emit_int8((unsigned char)0xD7);
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3338
  emit_int8((unsigned char)(0xC0 | encode));
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3339
}
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3340
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3341
void Assembler::vpmovmskb(Register dst, XMMRegister src) {
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3342
  assert(VM_Version::supports_avx2(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3343
  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3344
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3345
  emit_int8((unsigned char)0xD7);
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3346
  emit_int8((unsigned char)(0xC0 | encode));
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3347
}
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3348
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3349
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
  3350
  assert(VM_Version::supports_sse4_1(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3351
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false);
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3352
  int encode = simd_prefix_and_encode(src, xnoreg, as_XMMRegister(dst->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3353
  emit_int8(0x16);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3354
  emit_int8((unsigned char)(0xC0 | encode));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3355
  emit_int8(imm8);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3356
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3357
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3358
void Assembler::pextrd(Address dst, XMMRegister src, int imm8) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3359
  assert(VM_Version::supports_sse4_1(), "");
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3360
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3361
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3362
  simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3363
  emit_int8(0x16);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3364
  emit_operand(src, dst);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3365
  emit_int8(imm8);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3366
}
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3367
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3368
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
  3369
  assert(VM_Version::supports_sse4_1(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3370
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false);
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3371
  int encode = simd_prefix_and_encode(src, xnoreg, as_XMMRegister(dst->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3372
  emit_int8(0x16);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3373
  emit_int8((unsigned char)(0xC0 | encode));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3374
  emit_int8(imm8);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3375
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3376
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3377
void Assembler::pextrq(Address dst, XMMRegister src, int imm8) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3378
  assert(VM_Version::supports_sse4_1(), "");
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3379
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3380
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3381
  simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3382
  emit_int8(0x16);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3383
  emit_operand(src, dst);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3384
  emit_int8(imm8);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3385
}
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3386
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3387
void Assembler::pextrw(Register dst, XMMRegister src, int imm8) {
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3388
  assert(VM_Version::supports_sse2(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3389
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3390
  int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
33169
d9dc5d6fdb31 8139454: java/lang/Math/WorstCaseTests.java crashes on Linux-amd64
iveresov
parents: 33160
diff changeset
  3391
  emit_int8((unsigned char)0xC5);
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3392
  emit_int8((unsigned char)(0xC0 | encode));
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3393
  emit_int8(imm8);
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3394
}
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3395
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3396
void Assembler::pextrw(Address dst, XMMRegister src, int imm8) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3397
  assert(VM_Version::supports_sse4_1(), "");
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3398
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3399
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_16bit);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3400
  simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3401
  emit_int8((unsigned char)0x15);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3402
  emit_operand(src, dst);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3403
  emit_int8(imm8);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3404
}
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3405
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3406
void Assembler::pextrb(Address dst, XMMRegister src, int imm8) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3407
  assert(VM_Version::supports_sse4_1(), "");
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3408
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3409
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_8bit);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3410
  simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3411
  emit_int8(0x14);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3412
  emit_operand(src, dst);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3413
  emit_int8(imm8);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3414
}
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3415
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3416
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
  3417
  assert(VM_Version::supports_sse4_1(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3418
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3419
  int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3420
  emit_int8(0x22);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3421
  emit_int8((unsigned char)(0xC0 | encode));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3422
  emit_int8(imm8);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3423
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3424
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3425
void Assembler::pinsrd(XMMRegister dst, Address src, int imm8) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3426
  assert(VM_Version::supports_sse4_1(), "");
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3427
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3428
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3429
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3430
  emit_int8(0x22);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3431
  emit_operand(dst,src);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3432
  emit_int8(imm8);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3433
}
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3434
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3435
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
  3436
  assert(VM_Version::supports_sse4_1(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3437
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3438
  int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3439
  emit_int8(0x22);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3440
  emit_int8((unsigned char)(0xC0 | encode));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3441
  emit_int8(imm8);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3442
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  3443
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3444
void Assembler::pinsrq(XMMRegister dst, Address src, int imm8) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3445
  assert(VM_Version::supports_sse4_1(), "");
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3446
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3447
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3448
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3449
  emit_int8(0x22);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3450
  emit_operand(dst, src);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3451
  emit_int8(imm8);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3452
}
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3453
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3454
void Assembler::pinsrw(XMMRegister dst, Register src, int imm8) {
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3455
  assert(VM_Version::supports_sse2(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3456
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3457
  int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3458
  emit_int8((unsigned char)0xC4);
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3459
  emit_int8((unsigned char)(0xC0 | encode));
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3460
  emit_int8(imm8);
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3461
}
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  3462
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3463
void Assembler::pinsrw(XMMRegister dst, Address src, int imm8) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3464
  assert(VM_Version::supports_sse2(), "");
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3465
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3466
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_16bit);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3467
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3468
  emit_int8((unsigned char)0xC4);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3469
  emit_operand(dst, src);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3470
  emit_int8(imm8);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3471
}
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3472
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3473
void Assembler::pinsrb(XMMRegister dst, Address src, int imm8) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3474
  assert(VM_Version::supports_sse4_1(), "");
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3475
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3476
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_8bit);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3477
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3478
  emit_int8(0x20);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3479
  emit_operand(dst, src);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3480
  emit_int8(imm8);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3481
}
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  3482
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3483
void Assembler::pmovzxbw(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3484
  assert(VM_Version::supports_sse4_1(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3485
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3486
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3487
  attributes.set_address_attributes(/* tuple_type */ EVEX_HVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3488
  simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3489
  emit_int8(0x30);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3490
  emit_operand(dst, src);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3491
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3492
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3493
void Assembler::pmovzxbw(XMMRegister dst, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3494
  assert(VM_Version::supports_sse4_1(), "");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3495
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3496
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3497
  emit_int8(0x30);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3498
  emit_int8((unsigned char)(0xC0 | encode));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3499
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3500
34203
6817dadf6c7e 8142980: SKX SpecJvm2008 - Derby
mcberg
parents: 34162
diff changeset
  3501
void Assembler::vpmovzxbw(XMMRegister dst, Address src, int vector_len) {
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3502
  assert(VM_Version::supports_avx(), "");
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3503
  InstructionMark im(this);
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3504
  assert(dst != xnoreg, "sanity");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3505
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3506
  attributes.set_address_attributes(/* tuple_type */ EVEX_HVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3507
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3508
  emit_int8(0x30);
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3509
  emit_operand(dst, src);
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3510
}
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  3511
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3512
// generic
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3513
void Assembler::pop(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3514
  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
  3515
  emit_int8(0x58 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3516
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3517
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3518
void Assembler::popcntl(Register dst, Address src) {
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3519
  assert(VM_Version::supports_popcnt(), "must support");
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3520
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3521
  emit_int8((unsigned char)0xF3);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3522
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3523
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3524
  emit_int8((unsigned char)0xB8);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3525
  emit_operand(dst, src);
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3526
}
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3527
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3528
void Assembler::popcntl(Register dst, Register src) {
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3529
  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
  3530
  emit_int8((unsigned char)0xF3);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3531
  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
  3532
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3533
  emit_int8((unsigned char)0xB8);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3534
  emit_int8((unsigned char)(0xC0 | encode));
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3535
}
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  3536
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3537
void Assembler::popf() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3538
  emit_int8((unsigned char)0x9D);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3539
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3540
4430
95b539dfa1e8 6769124: various 64-bit fixes for c1
roland
parents: 4019
diff changeset
  3541
#ifndef _LP64 // no 32bit push/pop on amd64
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3542
void Assembler::popl(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3543
  // NOTE: this will adjust stack by 8byte on 64bits
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3544
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3545
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3546
  emit_int8((unsigned char)0x8F);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3547
  emit_operand(rax, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3548
}
4430
95b539dfa1e8 6769124: various 64-bit fixes for c1
roland
parents: 4019
diff changeset
  3549
#endif
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3550
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3551
void Assembler::prefetch_prefix(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3552
  prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3553
  emit_int8(0x0F);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3554
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3555
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3556
void Assembler::prefetchnta(Address src) {
10286
74b0f625d56a 7081926: assert(VM_Version::supports_sse2()) failed: must support
kvn
parents: 10268
diff changeset
  3557
  NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3558
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3559
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3560
  emit_int8(0x18);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3561
  emit_operand(rax, src); // 0, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3562
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3563
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3564
void Assembler::prefetchr(Address src) {
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
  3565
  assert(VM_Version::supports_3dnow_prefetch(), "must support");
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3566
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3567
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3568
  emit_int8(0x0D);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3569
  emit_operand(rax, src); // 0, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3570
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3571
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3572
void Assembler::prefetcht0(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3573
  NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3574
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3575
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3576
  emit_int8(0x18);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3577
  emit_operand(rcx, src); // 1, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3578
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3579
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3580
void Assembler::prefetcht1(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3581
  NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3582
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3583
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3584
  emit_int8(0x18);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3585
  emit_operand(rdx, src); // 2, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3586
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3587
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3588
void Assembler::prefetcht2(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3589
  NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3590
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3591
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3592
  emit_int8(0x18);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3593
  emit_operand(rbx, src); // 3, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3594
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3595
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3596
void Assembler::prefetchw(Address src) {
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
  3597
  assert(VM_Version::supports_3dnow_prefetch(), "must support");
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3598
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3599
  prefetch_prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3600
  emit_int8(0x0D);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3601
  emit_operand(rcx, src); // 1, src
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3602
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3603
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3604
void Assembler::prefix(Prefix p) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3605
  emit_int8(p);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3606
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3607
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  3608
void Assembler::pshufb(XMMRegister dst, XMMRegister src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  3609
  assert(VM_Version::supports_ssse3(), "");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3610
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3611
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3612
  emit_int8(0x00);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3613
  emit_int8((unsigned char)(0xC0 | encode));
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  3614
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  3615
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  3616
void Assembler::pshufb(XMMRegister dst, Address src) {
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  3617
  assert(VM_Version::supports_ssse3(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3618
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3619
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3620
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3621
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3622
  emit_int8(0x00);
14132
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  3623
  emit_operand(dst, src);
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  3624
}
3c1437abcefd 7184394: add intrinsics to use AES instructions
kvn
parents: 13974
diff changeset
  3625
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3626
void Assembler::pshufd(XMMRegister dst, XMMRegister src, int mode) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3627
  assert(isByte(mode), "invalid value");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3628
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3629
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_128bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3630
  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3631
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3632
  emit_int8(0x70);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3633
  emit_int8((unsigned char)(0xC0 | encode));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3634
  emit_int8(mode & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3635
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3636
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3637
void Assembler::pshufd(XMMRegister dst, Address src, int mode) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3638
  assert(isByte(mode), "invalid value");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3639
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3640
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3641
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3642
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3643
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3644
  simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3645
  emit_int8(0x70);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3646
  emit_operand(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3647
  emit_int8(mode & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3648
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3649
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3650
void Assembler::pshuflw(XMMRegister dst, XMMRegister src, int mode) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3651
  assert(isByte(mode), "invalid value");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3652
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3653
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3654
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3655
  emit_int8(0x70);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3656
  emit_int8((unsigned char)(0xC0 | encode));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3657
  emit_int8(mode & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3658
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3659
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3660
void Assembler::pshuflw(XMMRegister dst, Address src, int mode) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3661
  assert(isByte(mode), "invalid value");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3662
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3663
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3664
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  3665
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3666
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3667
  simd_prefix(dst, xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3668
  emit_int8(0x70);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3669
  emit_operand(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3670
  emit_int8(mode & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3671
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3672
8494
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  3673
void Assembler::psrldq(XMMRegister dst, int shift) {
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  3674
  // Shift left 128 bit value in dst XMMRegister by shift number of bytes.
8494
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  3675
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3676
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  3677
  // XMM3 is for /3 encoding: 66 0F 73 /3 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3678
  int encode = simd_prefix_and_encode(xmm3, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
31404
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 31129
diff changeset
  3679
  emit_int8(0x73);
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 31129
diff changeset
  3680
  emit_int8((unsigned char)(0xC0 | encode));
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 31129
diff changeset
  3681
  emit_int8(shift);
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 31129
diff changeset
  3682
}
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 31129
diff changeset
  3683
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 31129
diff changeset
  3684
void Assembler::pslldq(XMMRegister dst, int shift) {
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  3685
  // Shift left 128 bit value in dst XMMRegister by shift number of bytes.
31404
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 31129
diff changeset
  3686
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3687
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  3688
  // XMM7 is for /7 encoding: 66 0F 73 /7 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3689
  int encode = simd_prefix_and_encode(xmm7, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3690
  emit_int8(0x73);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3691
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3692
  emit_int8(shift);
8494
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  3693
}
4258c78226d9 6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents: 8332
diff changeset
  3694
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3695
void Assembler::ptest(XMMRegister dst, Address src) {
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3696
  assert(VM_Version::supports_sse4_1(), "");
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3697
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3698
  InstructionMark im(this);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3699
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3700
  simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3701
  emit_int8(0x17);
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3702
  emit_operand(dst, src);
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3703
}
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3704
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3705
void Assembler::ptest(XMMRegister dst, XMMRegister src) {
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3706
  assert(VM_Version::supports_sse4_1(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3707
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3708
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3709
  emit_int8(0x17);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3710
  emit_int8((unsigned char)(0xC0 | encode));
2348
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3711
}
4e71ed4c2709 6761600: Use sse 4.2 in intrinsics
cfang
parents: 2338
diff changeset
  3712
15117
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3713
void Assembler::vptest(XMMRegister dst, Address src) {
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3714
  assert(VM_Version::supports_avx(), "");
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3715
  InstructionMark im(this);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3716
  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
15117
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3717
  assert(dst != xnoreg, "sanity");
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3718
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3719
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
15117
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3720
  emit_int8(0x17);
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3721
  emit_operand(dst, src);
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3722
}
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3723
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3724
void Assembler::vptest(XMMRegister dst, XMMRegister src) {
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3725
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3726
  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3727
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
15117
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3728
  emit_int8(0x17);
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3729
  emit_int8((unsigned char)(0xC0 | encode));
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3730
}
625397df6f4f 8005419: Improve intrinsics code performance on x86 by using AVX2
kvn
parents: 15116
diff changeset
  3731
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3732
void Assembler::punpcklbw(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3733
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3734
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3735
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3736
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3737
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3738
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3739
  emit_int8(0x60);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3740
  emit_operand(dst, src);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3741
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3742
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3743
void Assembler::punpcklbw(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3744
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3745
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3746
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3747
  emit_int8(0x60);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3748
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3749
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3750
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3751
void Assembler::punpckldq(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3752
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3753
  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3754
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3755
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3756
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3757
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3758
  emit_int8(0x62);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3759
  emit_operand(dst, src);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3760
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3761
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3762
void Assembler::punpckldq(XMMRegister dst, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3763
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3764
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3765
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3766
  emit_int8(0x62);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3767
  emit_int8((unsigned char)(0xC0 | encode));
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3768
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  3769
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3770
void Assembler::punpcklqdq(XMMRegister dst, XMMRegister src) {
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3771
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3772
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3773
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3774
  emit_int8(0x6C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3775
  emit_int8((unsigned char)(0xC0 | encode));
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3776
}
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  3777
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3778
void Assembler::push(int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3779
  // in 64bits we push 64bits onto the stack but only
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3780
  // take a 32bit immediate
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3781
  emit_int8(0x68);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  3782
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3783
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3784
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3785
void Assembler::push(Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3786
  int encode = prefix_and_encode(src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3787
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3788
  emit_int8(0x50 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3789
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3790
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3791
void Assembler::pushf() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3792
  emit_int8((unsigned char)0x9C);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3793
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3794
4430
95b539dfa1e8 6769124: various 64-bit fixes for c1
roland
parents: 4019
diff changeset
  3795
#ifndef _LP64 // no 32bit push/pop on amd64
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3796
void Assembler::pushl(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3797
  // Note this will push 64bit on 64bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3798
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3799
  prefix(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3800
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3801
  emit_operand(rsi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3802
}
4430
95b539dfa1e8 6769124: various 64-bit fixes for c1
roland
parents: 4019
diff changeset
  3803
#endif
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3804
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3805
void Assembler::rcll(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3806
  assert(isShiftCount(imm8), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3807
  int encode = prefix_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3808
  if (imm8 == 1) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3809
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3810
    emit_int8((unsigned char)(0xD0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3811
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3812
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3813
    emit_int8((unsigned char)0xD0 | encode);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3814
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3815
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3816
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3817
33465
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  3818
void Assembler::rcpps(XMMRegister dst, XMMRegister src) {
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  3819
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3820
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3821
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
33465
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  3822
  emit_int8(0x53);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3823
  emit_int8((unsigned char)(0xC0 | encode));
33465
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  3824
}
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  3825
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  3826
void Assembler::rcpss(XMMRegister dst, XMMRegister src) {
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  3827
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3828
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3829
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
33465
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  3830
  emit_int8(0x53);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3831
  emit_int8((unsigned char)(0xC0 | encode));
33465
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  3832
}
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33198
diff changeset
  3833
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3834
void Assembler::rdtsc() {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3835
  emit_int8((unsigned char)0x0F);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3836
  emit_int8((unsigned char)0x31);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3837
}
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  3838
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3839
// copies data from [esi] to [edi] using rcx pointer sized words
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3840
// generic
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3841
void Assembler::rep_mov() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3842
  emit_int8((unsigned char)0xF3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3843
  // MOVSQ
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3844
  LP64_ONLY(prefix(REX_W));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3845
  emit_int8((unsigned char)0xA5);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3846
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3847
15114
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  3848
// sets rcx bytes with rax, value at [edi]
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  3849
void Assembler::rep_stosb() {
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  3850
  emit_int8((unsigned char)0xF3); // REP
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  3851
  LP64_ONLY(prefix(REX_W));
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  3852
  emit_int8((unsigned char)0xAA); // STOSB
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  3853
}
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  3854
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3855
// sets rcx pointer sized words with rax, value at [edi]
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3856
// generic
15114
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  3857
void Assembler::rep_stos() {
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  3858
  emit_int8((unsigned char)0xF3); // REP
4074553c678b 8005522: use fast-string instructions on x86 for zeroing
kvn
parents: 14837
diff changeset
  3859
  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
  3860
  emit_int8((unsigned char)0xAB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3861
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3862
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3863
// scans rcx pointer sized words at [edi] for occurance of rax,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3864
// generic
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3865
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
  3866
  emit_int8((unsigned char)0xF2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3867
  // SCASQ
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3868
  LP64_ONLY(prefix(REX_W));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3869
  emit_int8((unsigned char)0xAF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3870
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3871
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3872
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3873
// scans rcx 4 byte words at [edi] for occurance of rax,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3874
// generic
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3875
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
  3876
  emit_int8((unsigned char)0xF2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3877
  // SCASL
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3878
  emit_int8((unsigned char)0xAF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3879
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3880
#endif
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3881
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3882
void Assembler::ret(int imm16) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3883
  if (imm16 == 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3884
    emit_int8((unsigned char)0xC3);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3885
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3886
    emit_int8((unsigned char)0xC2);
14831
84828ee2a91c 8004536: replace AbstractAssembler emit_word with emit_int16
twisti
parents: 14626
diff changeset
  3887
    emit_int16(imm16);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3888
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3889
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3890
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3891
void Assembler::sahf() {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3892
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3893
  // Not supported in 64bit mode
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3894
  ShouldNotReachHere();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3895
#endif
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3896
  emit_int8((unsigned char)0x9E);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3897
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3898
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3899
void Assembler::sarl(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3900
  int encode = prefix_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3901
  assert(isShiftCount(imm8), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3902
  if (imm8 == 1) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3903
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3904
    emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3905
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3906
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3907
    emit_int8((unsigned char)(0xF8 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3908
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3909
  }
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
void Assembler::sarl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3913
  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
  3914
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3915
  emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3916
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3917
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3918
void Assembler::sbbl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3919
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3920
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3921
  emit_arith_operand(0x81, rbx, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3922
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3923
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3924
void Assembler::sbbl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3925
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3926
  emit_arith(0x81, 0xD8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3927
}
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3930
void Assembler::sbbl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3931
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3932
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3933
  emit_int8(0x1B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3934
  emit_operand(dst, src);
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3937
void Assembler::sbbl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3938
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3939
  emit_arith(0x1B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3940
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3941
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3942
void Assembler::setb(Condition cc, Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3943
  assert(0 <= cc && cc < 16, "illegal cc");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3944
  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
  3945
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3946
  emit_int8((unsigned char)0x90 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3947
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3948
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3949
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3950
void Assembler::shll(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3951
  assert(isShiftCount(imm8), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3952
  int encode = prefix_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3953
  if (imm8 == 1 ) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3954
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3955
    emit_int8((unsigned char)(0xE0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3956
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3957
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3958
    emit_int8((unsigned char)(0xE0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3959
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3960
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3961
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3962
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3963
void Assembler::shll(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3964
  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
  3965
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3966
  emit_int8((unsigned char)(0xE0 | encode));
1066
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::shrl(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3970
  assert(isShiftCount(imm8), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3971
  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
  3972
  emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3973
  emit_int8((unsigned char)(0xE8 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3974
  emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3975
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3976
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3977
void Assembler::shrl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3978
  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
  3979
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3980
  emit_int8((unsigned char)(0xE8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3981
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3982
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3983
// copies a single word from [esi] to [edi]
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3984
void Assembler::smovl() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  3985
  emit_int8((unsigned char)0xA5);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3986
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  3987
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3988
void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  3989
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3990
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3991
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3992
  emit_int8(0x51);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3993
  emit_int8((unsigned char)(0xC0 | encode));
1066
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
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  3996
void Assembler::sqrtsd(XMMRegister dst, Address src) {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  3997
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3998
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3999
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4000
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4001
  simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4002
  emit_int8(0x51);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4003
  emit_operand(dst, src);
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  4004
}
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  4005
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  4006
void Assembler::sqrtss(XMMRegister dst, XMMRegister src) {
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4007
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4008
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4009
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4010
  emit_int8(0x51);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4011
  emit_int8((unsigned char)(0xC0 | encode));
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  4012
}
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  4013
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  4014
void Assembler::std() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4015
  emit_int8((unsigned char)0xFD);
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  4016
}
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  4017
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  4018
void Assembler::sqrtss(XMMRegister dst, Address src) {
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  4019
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4020
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4021
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4022
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4023
  simd_prefix(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4024
  emit_int8(0x51);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4025
  emit_operand(dst, src);
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  4026
}
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
  4027
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4028
void Assembler::stmxcsr( Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4029
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4030
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4031
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4032
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4033
  emit_int8((unsigned char)0xAE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4034
  emit_operand(as_Register(3), dst);
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::subl(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4038
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4039
  prefix(dst);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  4040
  emit_arith_operand(0x81, rbp, dst, imm32);
1066
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::subl(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4044
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4045
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4046
  emit_int8(0x29);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4047
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4048
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4049
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  4050
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
  4051
  prefix(dst);
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  4052
  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
  4053
}
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  4054
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  4055
// 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
  4056
void Assembler::subl_imm32(Register dst, int32_t imm32) {
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  4057
  prefix(dst);
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  4058
  emit_arith_imm32(0x81, 0xE8, dst, imm32);
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  4059
}
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  4060
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4061
void Assembler::subl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4062
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4063
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4064
  emit_int8(0x2B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4065
  emit_operand(dst, src);
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4068
void Assembler::subl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4069
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4070
  emit_arith(0x2B, 0xC0, dst, src);
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4073
void Assembler::subsd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4074
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4075
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4076
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4077
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4078
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4079
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4080
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4081
void Assembler::subsd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4082
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4083
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4084
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4085
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4086
  simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4087
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4088
  emit_operand(dst, src);
1066
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4091
void Assembler::subss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4092
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4093
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4094
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4095
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4096
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4097
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4098
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4099
void Assembler::subss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4100
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4101
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4102
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4103
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4104
  simd_prefix(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4105
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4106
  emit_operand(dst, src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4107
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4108
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4109
void Assembler::testb(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4110
  NOT_LP64(assert(dst->has_byte_register(), "must have byte register"));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4111
  (void) prefix_and_encode(dst->encoding(), true);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4112
  emit_arith_b(0xF6, 0xC0, dst, imm8);
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4115
void Assembler::testl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4116
  // not using emit_arith because test
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4117
  // doesn't support sign-extension of
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4118
  // 8bit operands
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4119
  int encode = dst->encoding();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4120
  if (encode == 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4121
    emit_int8((unsigned char)0xA9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4122
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4123
    encode = prefix_and_encode(encode);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4124
    emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4125
    emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4126
  }
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  4127
  emit_int32(imm32);
1066
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::testl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4131
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4132
  emit_arith(0x85, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4133
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4134
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4135
void Assembler::testl(Register dst, Address src) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4136
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4137
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4138
  emit_int8((unsigned char)0x85);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4139
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4140
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4141
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4142
void Assembler::tzcntl(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4143
  assert(VM_Version::supports_bmi1(), "tzcnt instruction not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4144
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4145
  int encode = prefix_and_encode(dst->encoding(), src->encoding());
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4146
  emit_int8(0x0F);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4147
  emit_int8((unsigned char)0xBC);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4148
  emit_int8((unsigned char)0xC0 | encode);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4149
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4150
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4151
void Assembler::tzcntq(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4152
  assert(VM_Version::supports_bmi1(), "tzcnt instruction not supported");
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4153
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4154
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4155
  emit_int8(0x0F);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4156
  emit_int8((unsigned char)0xBC);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4157
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4158
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  4159
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4160
void Assembler::ucomisd(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4161
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4162
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4163
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4164
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4165
  simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4166
  emit_int8(0x2E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4167
  emit_operand(dst, src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4168
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4169
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4170
void Assembler::ucomisd(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4171
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4172
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4173
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4174
  emit_int8(0x2E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4175
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4176
}
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
void Assembler::ucomiss(XMMRegister dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4179
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4180
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4181
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4182
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4183
  simd_prefix(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4184
  emit_int8(0x2E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4185
  emit_operand(dst, src);
1066
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
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4188
void Assembler::ucomiss(XMMRegister dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4189
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4190
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4191
  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4192
  emit_int8(0x2E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4193
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4194
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4195
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4196
void Assembler::xabort(int8_t imm8) {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4197
  emit_int8((unsigned char)0xC6);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4198
  emit_int8((unsigned char)0xF8);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4199
  emit_int8((unsigned char)(imm8 & 0xFF));
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4200
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4201
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4202
void Assembler::xaddl(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4203
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4204
  prefix(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4205
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4206
  emit_int8((unsigned char)0xC1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4207
  emit_operand(src, dst);
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
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4210
void Assembler::xbegin(Label& abort, relocInfo::relocType rtype) {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4211
  InstructionMark im(this);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4212
  relocate(rtype);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4213
  if (abort.is_bound()) {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4214
    address entry = target(abort);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4215
    assert(entry != NULL, "abort entry NULL");
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4216
    intptr_t offset = entry - pc();
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4217
    emit_int8((unsigned char)0xC7);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4218
    emit_int8((unsigned char)0xF8);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4219
    emit_int32(offset - 6); // 2 opcode + 4 address
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4220
  } else {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4221
    abort.add_patch_at(code(), locator());
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4222
    emit_int8((unsigned char)0xC7);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4223
    emit_int8((unsigned char)0xF8);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4224
    emit_int32(0);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4225
  }
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4226
}
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4227
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4228
void Assembler::xchgl(Register dst, Address src) { // xchg
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4229
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4230
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4231
  emit_int8((unsigned char)0x87);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4232
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4233
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4234
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4235
void Assembler::xchgl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4236
  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
  4237
  emit_int8((unsigned char)0x87);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4238
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4239
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4240
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4241
void Assembler::xend() {
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4242
  emit_int8((unsigned char)0x0F);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4243
  emit_int8((unsigned char)0x01);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4244
  emit_int8((unsigned char)0xD5);
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4245
}
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 23220
diff changeset
  4246
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  4247
void Assembler::xgetbv() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4248
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4249
  emit_int8(0x01);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4250
  emit_int8((unsigned char)0xD0);
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  4251
}
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 14625
diff changeset
  4252
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4253
void Assembler::xorl(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4254
  prefix(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4255
  emit_arith(0x81, 0xF0, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4256
}
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
void Assembler::xorl(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4259
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4260
  prefix(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  4261
  emit_int8(0x33);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4262
  emit_operand(dst, src);
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::xorl(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4266
  (void) prefix_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  4267
  emit_arith(0x33, 0xC0, dst, src);
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
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  4270
void Assembler::xorb(Register dst, Address src) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  4271
  InstructionMark im(this);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  4272
  prefix(src, dst);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  4273
  emit_int8(0x32);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  4274
  emit_operand(dst, src);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35146
diff changeset
  4275
}
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4276
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4277
// 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
  4278
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4279
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
  4280
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4281
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4282
  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4283
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4284
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4285
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4286
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4287
  emit_operand(dst, src);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4288
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4289
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4290
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
  4291
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4292
  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4293
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4294
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4295
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4296
  emit_int8((unsigned char)(0xC0 | encode));
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4297
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4298
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4299
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
  4300
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4301
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4302
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4303
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4304
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4305
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4306
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4307
  emit_operand(dst, src);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4308
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4309
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4310
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
  4311
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4312
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4313
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4314
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4315
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4316
  emit_int8((unsigned char)(0xC0 | encode));
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4317
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4318
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4319
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
  4320
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4321
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4322
  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4323
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4324
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4325
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4326
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4327
  emit_operand(dst, src);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4328
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4329
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4330
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
  4331
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4332
  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4333
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4334
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4335
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4336
  emit_int8((unsigned char)(0xC0 | encode));
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4337
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4338
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4339
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
  4340
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4341
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4342
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4343
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4344
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4345
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4346
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4347
  emit_operand(dst, src);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4348
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4349
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4350
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
  4351
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4352
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4353
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4354
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4355
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4356
  emit_int8((unsigned char)(0xC0 | encode));
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4357
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4358
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4359
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
  4360
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4361
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4362
  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4363
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4364
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4365
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4366
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4367
  emit_operand(dst, src);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4368
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4369
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4370
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
  4371
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4372
  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4373
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4374
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4375
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4376
  emit_int8((unsigned char)(0xC0 | encode));
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4377
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4378
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4379
void Assembler::vmulss(XMMRegister dst, XMMRegister nds, Address src) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4380
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4381
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4382
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4383
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4384
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4385
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4386
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4387
  emit_operand(dst, src);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4388
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4389
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4390
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
  4391
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4392
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4393
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4394
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4395
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4396
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4397
}
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4398
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4399
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
  4400
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4401
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4402
  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4403
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4404
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4405
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4406
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4407
  emit_operand(dst, src);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4408
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4409
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4410
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
  4411
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4412
  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4413
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4414
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4415
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4416
  emit_int8((unsigned char)(0xC0 | encode));
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4417
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4418
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4419
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
  4420
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4421
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4422
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4423
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4424
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4425
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4426
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4427
  emit_operand(dst, src);
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4428
}
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4430
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
  4431
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4432
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4433
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4434
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4435
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4436
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4437
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4438
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4439
//====================VECTOR ARITHMETIC=====================================
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4440
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4441
// Float-point vector arithmetic
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4442
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4443
void Assembler::addpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4444
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4445
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4446
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4447
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4448
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4449
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4450
35146
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4451
void Assembler::addpd(XMMRegister dst, Address src) {
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4452
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4453
  InstructionMark im(this);
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4454
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4455
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4456
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4457
  emit_int8(0x58);
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4458
  emit_operand(dst, src);
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4459
}
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4460
9ebfec283f56 8145688: Update for x86 pow in the math lib
kvn
parents: 35113
diff changeset
  4461
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4462
void Assembler::addps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4463
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4464
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4465
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4466
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4467
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4468
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4469
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4470
void Assembler::vaddpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4471
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4472
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4473
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4474
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4475
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4476
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4477
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4478
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4479
void Assembler::vaddps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4480
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4481
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4482
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4483
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4484
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4485
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4486
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4487
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4488
void Assembler::vaddpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4489
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4490
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4491
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4492
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4493
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4494
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4495
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4496
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4497
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4498
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4499
void Assembler::vaddps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4500
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4501
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4502
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4503
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4504
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4505
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4506
  emit_int8(0x58);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4507
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4508
}
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
void Assembler::subpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4511
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4512
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4513
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4514
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4515
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4516
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4517
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4518
void Assembler::subps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4519
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4520
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4521
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4522
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4523
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4524
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4525
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4526
void Assembler::vsubpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4527
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4528
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4529
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4530
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4531
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4532
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4533
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4534
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4535
void Assembler::vsubps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4536
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4537
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4538
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4539
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4540
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4541
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4542
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4543
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4544
void Assembler::vsubpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4545
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4546
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4547
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4548
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4549
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4550
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4551
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4552
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4553
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4554
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4555
void Assembler::vsubps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4556
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4557
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4558
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4559
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4560
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4561
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4562
  emit_int8(0x5C);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4563
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4564
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4565
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4566
void Assembler::mulpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4567
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4568
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4569
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4570
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4571
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4572
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4573
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4574
void Assembler::mulpd(XMMRegister dst, Address src) {
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4575
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4576
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4577
  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4578
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4579
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4580
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4581
  emit_operand(dst, src);
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4582
}
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4583
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4584
void Assembler::mulps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4585
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4586
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4587
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4588
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4589
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4590
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4591
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4592
void Assembler::vmulpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4593
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4594
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4595
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4596
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4597
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4598
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4599
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4600
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4601
void Assembler::vmulps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4602
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4603
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4604
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4605
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4606
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4607
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4608
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4609
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4610
void Assembler::vmulpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4611
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4612
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4613
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4614
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4615
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4616
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4617
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4618
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4619
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4620
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4621
void Assembler::vmulps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  4622
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4623
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4624
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4625
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4626
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4627
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4628
  emit_int8(0x59);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4629
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4630
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4631
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4632
void Assembler::divpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4633
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4634
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4635
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4636
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4637
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4638
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4639
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4640
void Assembler::divps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4641
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4642
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4643
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4644
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4645
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4646
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4647
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4648
void Assembler::vdivpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4649
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4650
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4651
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4652
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4653
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4654
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4655
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4656
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4657
void Assembler::vdivps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4658
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4659
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4660
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4661
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4662
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4663
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4664
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4665
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4666
void Assembler::vdivpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4667
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4668
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4669
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4670
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4671
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4672
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4673
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4674
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4675
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4676
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4677
void Assembler::vdivps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4678
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4679
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4680
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4681
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4682
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4683
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4684
  emit_int8(0x5E);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4685
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4686
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4687
32723
56534fb3d71a 8135028: support for vectorizing double precision sqrt
mcberg
parents: 32391
diff changeset
  4688
void Assembler::vsqrtpd(XMMRegister dst, XMMRegister src, int vector_len) {
56534fb3d71a 8135028: support for vectorizing double precision sqrt
mcberg
parents: 32391
diff changeset
  4689
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4690
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4691
  int nds_enc = 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4692
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4693
  emit_int8(0x51);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4694
  emit_int8((unsigned char)(0xC0 | encode));
32723
56534fb3d71a 8135028: support for vectorizing double precision sqrt
mcberg
parents: 32391
diff changeset
  4695
}
56534fb3d71a 8135028: support for vectorizing double precision sqrt
mcberg
parents: 32391
diff changeset
  4696
56534fb3d71a 8135028: support for vectorizing double precision sqrt
mcberg
parents: 32391
diff changeset
  4697
void Assembler::vsqrtpd(XMMRegister dst, Address src, int vector_len) {
56534fb3d71a 8135028: support for vectorizing double precision sqrt
mcberg
parents: 32391
diff changeset
  4698
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4699
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4700
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4701
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4702
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4703
  emit_int8(0x51);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4704
  emit_operand(dst, src);
32723
56534fb3d71a 8135028: support for vectorizing double precision sqrt
mcberg
parents: 32391
diff changeset
  4705
}
56534fb3d71a 8135028: support for vectorizing double precision sqrt
mcberg
parents: 32391
diff changeset
  4706
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4707
void Assembler::andpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4708
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4709
  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4710
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4711
  emit_int8(0x54);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4712
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4713
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4714
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4715
void Assembler::andps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4716
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4717
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4718
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4719
  emit_int8(0x54);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4720
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4721
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4722
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4723
void Assembler::andps(XMMRegister dst, Address src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4724
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4725
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4726
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4727
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4728
  simd_prefix(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4729
  emit_int8(0x54);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4730
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4731
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4732
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4733
void Assembler::andpd(XMMRegister dst, Address src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4734
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4735
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4736
  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4737
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4738
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4739
  emit_int8(0x54);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4740
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4741
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4742
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4743
void Assembler::vandpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4744
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4745
  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4746
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4747
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4748
  emit_int8(0x54);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4749
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4750
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4751
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4752
void Assembler::vandps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4753
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4754
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4755
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4756
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4757
  emit_int8(0x54);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4758
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4759
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4760
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4761
void Assembler::vandpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4762
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4763
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4764
  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4765
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4766
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4767
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4768
  emit_int8(0x54);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4769
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4770
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4771
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4772
void Assembler::vandps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4773
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4774
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4775
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4776
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4777
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4778
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4779
  emit_int8(0x54);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4780
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4781
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4782
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4783
void Assembler::unpckhpd(XMMRegister dst, XMMRegister src) {
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4784
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4785
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4786
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4787
  emit_int8(0x15);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4788
  emit_int8((unsigned char)(0xC0 | encode));
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4789
}
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4790
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4791
void Assembler::unpcklpd(XMMRegister dst, XMMRegister src) {
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4792
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4793
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4794
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4795
  emit_int8(0x14);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4796
  emit_int8((unsigned char)(0xC0 | encode));
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4797
}
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  4798
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4799
void Assembler::xorpd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4800
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4801
  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4802
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4803
  emit_int8(0x57);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4804
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4805
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4806
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4807
void Assembler::xorps(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4808
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4809
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4810
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4811
  emit_int8(0x57);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4812
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4813
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4814
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4815
void Assembler::xorpd(XMMRegister dst, Address src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4816
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4817
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4818
  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4819
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4820
  simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4821
  emit_int8(0x57);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4822
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4823
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4824
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4825
void Assembler::xorps(XMMRegister dst, Address src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4826
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4827
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4828
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4829
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4830
  simd_prefix(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4831
  emit_int8(0x57);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4832
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4833
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4834
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4835
void Assembler::vxorpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  4836
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4837
  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4838
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4839
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4840
  emit_int8(0x57);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4841
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4842
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4843
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4844
void Assembler::vxorps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  4845
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4846
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4847
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4848
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4849
  emit_int8(0x57);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4850
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4851
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4852
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4853
void Assembler::vxorpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4854
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4855
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4856
  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4857
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4858
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4859
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4860
  emit_int8(0x57);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4861
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4862
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4863
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4864
void Assembler::vxorps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4865
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4866
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4867
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4868
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4869
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4870
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4871
  emit_int8(0x57);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4872
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4873
}
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4874
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4875
// Integer vector arithmetic
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4876
void Assembler::vphaddw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4877
  assert(VM_Version::supports_avx() && (vector_len == 0) ||
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4878
         VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4879
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4880
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4881
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
30211
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4882
  emit_int8(0x01);
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4883
  emit_int8((unsigned char)(0xC0 | encode));
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4884
}
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4885
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4886
void Assembler::vphaddd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4887
  assert(VM_Version::supports_avx() && (vector_len == 0) ||
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4888
         VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4889
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4890
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4891
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
30211
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4892
  emit_int8(0x02);
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4893
  emit_int8((unsigned char)(0xC0 | encode));
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4894
}
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4895
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4896
void Assembler::paddb(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4897
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  4898
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4899
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4900
  emit_int8((unsigned char)0xFC);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4901
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4902
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4903
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4904
void Assembler::paddw(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4905
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  4906
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4907
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4908
  emit_int8((unsigned char)0xFD);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4909
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4910
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4911
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4912
void Assembler::paddd(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4913
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4914
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4915
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4916
  emit_int8((unsigned char)0xFE);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4917
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4918
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4919
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4920
void Assembler::paddq(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4921
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4922
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4923
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4924
  emit_int8((unsigned char)0xD4);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4925
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4926
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  4927
30211
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4928
void Assembler::phaddw(XMMRegister dst, XMMRegister src) {
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4929
  NOT_LP64(assert(VM_Version::supports_sse3(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4930
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4931
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
30211
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4932
  emit_int8(0x01);
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4933
  emit_int8((unsigned char)(0xC0 | encode));
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4934
}
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4935
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4936
void Assembler::phaddd(XMMRegister dst, XMMRegister src) {
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4937
  NOT_LP64(assert(VM_Version::supports_sse3(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4938
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4939
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
30211
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4940
  emit_int8(0x02);
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4941
  emit_int8((unsigned char)(0xC0 | encode));
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4942
}
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  4943
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4944
void Assembler::vpaddb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4945
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  4946
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4947
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4948
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4949
  emit_int8((unsigned char)0xFC);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4950
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4951
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4952
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4953
void Assembler::vpaddw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4954
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  4955
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4956
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4957
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4958
  emit_int8((unsigned char)0xFD);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4959
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4960
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4961
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4962
void Assembler::vpaddd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4963
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4964
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4965
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4966
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4967
  emit_int8((unsigned char)0xFE);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4968
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4969
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4970
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4971
void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4972
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4973
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4974
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4975
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4976
  emit_int8((unsigned char)0xD4);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4977
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4978
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4979
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4980
void Assembler::vpaddb(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4981
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4982
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  4983
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4984
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4985
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4986
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4987
  emit_int8((unsigned char)0xFC);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4988
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4989
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4990
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4991
void Assembler::vpaddw(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  4992
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4993
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  4994
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4995
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4996
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4997
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4998
  emit_int8((unsigned char)0xFD);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  4999
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5000
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5001
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5002
void Assembler::vpaddd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5003
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5004
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5005
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5006
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5007
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5008
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5009
  emit_int8((unsigned char)0xFE);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5010
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5011
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5012
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5013
void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5014
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5015
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5016
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5017
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5018
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5019
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5020
  emit_int8((unsigned char)0xD4);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5021
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5022
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5023
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5024
void Assembler::psubb(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5025
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5026
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5027
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5028
  emit_int8((unsigned char)0xF8);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5029
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5030
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5031
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5032
void Assembler::psubw(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5033
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5034
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5035
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5036
  emit_int8((unsigned char)0xF9);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5037
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5038
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5039
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5040
void Assembler::psubd(XMMRegister dst, XMMRegister src) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5041
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5042
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5043
  emit_int8((unsigned char)0xFA);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5044
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5045
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5046
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5047
void Assembler::psubq(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5048
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5049
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5050
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5051
  emit_int8((unsigned char)0xFB);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5052
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5053
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5054
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5055
void Assembler::vpsubb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5056
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5057
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5058
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5059
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5060
  emit_int8((unsigned char)0xF8);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5061
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5062
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5063
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5064
void Assembler::vpsubw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5065
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5066
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5067
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5068
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5069
  emit_int8((unsigned char)0xF9);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5070
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5071
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5072
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5073
void Assembler::vpsubd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5074
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5075
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5076
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5077
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5078
  emit_int8((unsigned char)0xFA);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5079
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5080
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5081
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5082
void Assembler::vpsubq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5083
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5084
  InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5085
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5086
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5087
  emit_int8((unsigned char)0xFB);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5088
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5089
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5090
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5091
void Assembler::vpsubb(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5092
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5093
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5094
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5095
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5096
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5097
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5098
  emit_int8((unsigned char)0xF8);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5099
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5100
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5101
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5102
void Assembler::vpsubw(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5103
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5104
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5105
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5106
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5107
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5108
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5109
  emit_int8((unsigned char)0xF9);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5110
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5111
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5112
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5113
void Assembler::vpsubd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5114
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5115
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5116
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5117
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5118
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5119
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5120
  emit_int8((unsigned char)0xFA);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5121
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5122
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5123
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5124
void Assembler::vpsubq(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5125
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5126
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5127
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5128
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5129
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5130
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5131
  emit_int8((unsigned char)0xFB);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5132
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5133
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5134
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5135
void Assembler::pmullw(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5136
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5137
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5138
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5139
  emit_int8((unsigned char)0xD5);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5140
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5141
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5142
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5143
void Assembler::pmulld(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5144
  assert(VM_Version::supports_sse4_1(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5145
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5146
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5147
  emit_int8(0x40);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5148
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5149
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5150
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5151
void Assembler::vpmullw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5152
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5153
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5154
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5155
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5156
  emit_int8((unsigned char)0xD5);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5157
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5158
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5159
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5160
void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5161
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5162
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5163
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5164
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5165
  emit_int8(0x40);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5166
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5167
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5168
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5169
void Assembler::vpmullq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5170
  assert(UseAVX > 2, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5171
  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5172
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5173
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5174
  emit_int8(0x40);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5175
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5176
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5177
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5178
void Assembler::vpmullw(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5179
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5180
  InstructionMark im(this);
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5181
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5182
  attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5183
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5184
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5185
  emit_int8((unsigned char)0xD5);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5186
  emit_operand(dst, src);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5187
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5188
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5189
void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5190
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5191
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5192
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5193
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5194
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5195
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5196
  emit_int8(0x40);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5197
  emit_operand(dst, src);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5198
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5199
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5200
void Assembler::vpmullq(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5201
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5202
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5203
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5204
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5205
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5206
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5207
  emit_int8(0x40);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5208
  emit_operand(dst, src);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5209
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5210
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5211
// Shift packed integers left by specified number of bits.
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5212
void Assembler::psllw(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5213
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5214
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5215
  // XMM6 is for /6 encoding: 66 0F 71 /6 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5216
  int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5217
  emit_int8(0x71);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5218
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5219
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5220
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5221
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5222
void Assembler::pslld(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5223
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5224
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5225
  // XMM6 is for /6 encoding: 66 0F 72 /6 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5226
  int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5227
  emit_int8(0x72);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5228
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5229
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5230
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5231
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5232
void Assembler::psllq(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5233
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5234
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5235
  // XMM6 is for /6 encoding: 66 0F 73 /6 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5236
  int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5237
  emit_int8(0x73);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5238
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5239
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5240
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5241
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5242
void Assembler::psllw(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5243
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5244
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5245
  int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5246
  emit_int8((unsigned char)0xF1);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5247
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5248
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5249
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5250
void Assembler::pslld(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5251
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5252
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5253
  int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5254
  emit_int8((unsigned char)0xF2);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5255
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5256
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5257
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5258
void Assembler::psllq(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5259
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5260
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5261
  int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5262
  emit_int8((unsigned char)0xF3);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5263
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5264
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5265
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5266
void Assembler::vpsllw(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5267
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5268
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5269
  // XMM6 is for /6 encoding: 66 0F 71 /6 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5270
  int encode = vex_prefix_and_encode(xmm6->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5271
  emit_int8(0x71);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5272
  emit_int8((unsigned char)(0xC0 | encode));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5273
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5274
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5275
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5276
void Assembler::vpslld(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5277
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5278
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5279
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5280
  // XMM6 is for /6 encoding: 66 0F 72 /6 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5281
  int encode = vex_prefix_and_encode(xmm6->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5282
  emit_int8(0x72);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5283
  emit_int8((unsigned char)(0xC0 | encode));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5284
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5285
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5286
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5287
void Assembler::vpsllq(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5288
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5289
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5290
  // XMM6 is for /6 encoding: 66 0F 73 /6 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5291
  int encode = vex_prefix_and_encode(xmm6->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5292
  emit_int8(0x73);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5293
  emit_int8((unsigned char)(0xC0 | encode));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5294
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5295
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5296
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5297
void Assembler::vpsllw(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5298
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5299
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5300
  int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5301
  emit_int8((unsigned char)0xF1);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5302
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5303
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5304
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5305
void Assembler::vpslld(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5306
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5307
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5308
  int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5309
  emit_int8((unsigned char)0xF2);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5310
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5311
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5312
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5313
void Assembler::vpsllq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5314
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5315
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5316
  int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5317
  emit_int8((unsigned char)0xF3);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5318
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5319
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5320
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5321
// Shift packed integers logically right by specified number of bits.
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5322
void Assembler::psrlw(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5323
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5324
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5325
  // XMM2 is for /2 encoding: 66 0F 71 /2 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5326
  int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5327
  emit_int8(0x71);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5328
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5329
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5330
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5331
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5332
void Assembler::psrld(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5333
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5334
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5335
  // XMM2 is for /2 encoding: 66 0F 72 /2 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5336
  int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5337
  emit_int8(0x72);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5338
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5339
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5340
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5341
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5342
void Assembler::psrlq(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5343
  // Do not confuse it with psrldq SSE2 instruction which
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5344
  // shifts 128 bit value in xmm register by number of bytes.
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5345
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5346
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5347
  // XMM2 is for /2 encoding: 66 0F 73 /2 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5348
  int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5349
  emit_int8(0x73);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5350
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5351
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5352
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5353
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5354
void Assembler::psrlw(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5355
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5356
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5357
  int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5358
  emit_int8((unsigned char)0xD1);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5359
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5360
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5361
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5362
void Assembler::psrld(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5363
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5364
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5365
  int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5366
  emit_int8((unsigned char)0xD2);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5367
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5368
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5369
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5370
void Assembler::psrlq(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5371
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5372
  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5373
  int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5374
  emit_int8((unsigned char)0xD3);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5375
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5376
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5377
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5378
void Assembler::vpsrlw(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5379
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5380
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5381
  // XMM2 is for /2 encoding: 66 0F 71 /2 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5382
  int encode = vex_prefix_and_encode(xmm2->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5383
  emit_int8(0x71);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5384
  emit_int8((unsigned char)(0xC0 | encode));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5385
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5386
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5387
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5388
void Assembler::vpsrld(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5389
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5390
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5391
  // XMM2 is for /2 encoding: 66 0F 72 /2 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5392
  int encode = vex_prefix_and_encode(xmm2->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5393
  emit_int8(0x72);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5394
  emit_int8((unsigned char)(0xC0 | encode));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5395
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5396
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5397
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5398
void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5399
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5400
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5401
  // XMM2 is for /2 encoding: 66 0F 73 /2 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5402
  int encode = vex_prefix_and_encode(xmm2->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5403
  emit_int8(0x73);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5404
  emit_int8((unsigned char)(0xC0 | encode));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5405
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5406
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5407
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5408
void Assembler::vpsrlw(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5409
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5410
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5411
  int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5412
  emit_int8((unsigned char)0xD1);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5413
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5414
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5415
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5416
void Assembler::vpsrld(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5417
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5418
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5419
  int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5420
  emit_int8((unsigned char)0xD2);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5421
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5422
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5423
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5424
void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5425
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5426
  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5427
  int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5428
  emit_int8((unsigned char)0xD3);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5429
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5430
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5431
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5432
// Shift packed integers arithmetically right by specified number of bits.
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5433
void Assembler::psraw(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5434
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5435
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5436
  // XMM4 is for /4 encoding: 66 0F 71 /4 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5437
  int encode = simd_prefix_and_encode(xmm4, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5438
  emit_int8(0x71);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5439
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5440
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5441
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5442
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5443
void Assembler::psrad(XMMRegister dst, int shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5444
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5445
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5446
  // XMM4 is for /4 encoding: 66 0F 72 /4 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5447
  int encode = simd_prefix_and_encode(xmm4, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5448
  emit_int8(0x72);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5449
  emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5450
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5451
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5452
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5453
void Assembler::psraw(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5454
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5455
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5456
  int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5457
  emit_int8((unsigned char)0xE1);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5458
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5459
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5460
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5461
void Assembler::psrad(XMMRegister dst, XMMRegister shift) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5462
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5463
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5464
  int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5465
  emit_int8((unsigned char)0xE2);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5466
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5467
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5468
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5469
void Assembler::vpsraw(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5470
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5471
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5472
  // XMM4 is for /4 encoding: 66 0F 71 /4 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5473
  int encode = vex_prefix_and_encode(xmm4->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5474
  emit_int8(0x71);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5475
  emit_int8((unsigned char)(0xC0 | encode));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5476
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5477
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5478
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5479
void Assembler::vpsrad(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5480
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5481
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5482
  // XMM4 is for /4 encoding: 66 0F 71 /4 ib
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5483
  int encode = vex_prefix_and_encode(xmm4->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5484
  emit_int8(0x72);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5485
  emit_int8((unsigned char)(0xC0 | encode));
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5486
  emit_int8(shift & 0xFF);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5487
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5488
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5489
void Assembler::vpsraw(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5490
  assert(UseAVX > 0, "requires some form of AVX");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5491
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5492
  int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5493
  emit_int8((unsigned char)0xE1);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5494
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5495
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5496
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5497
void Assembler::vpsrad(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5498
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5499
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5500
  int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5501
  emit_int8((unsigned char)0xE2);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5502
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5503
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5504
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5505
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  5506
// logical operations packed integers
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5507
void Assembler::pand(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5508
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5509
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5510
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5511
  emit_int8((unsigned char)0xDB);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5512
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5513
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5514
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5515
void Assembler::vpand(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5516
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5517
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5518
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5519
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5520
  emit_int8((unsigned char)0xDB);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5521
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5522
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5523
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5524
void Assembler::vpand(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5525
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5526
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5527
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5528
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5529
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5530
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5531
  emit_int8((unsigned char)0xDB);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5532
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5533
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5534
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  5535
void Assembler::pandn(XMMRegister dst, XMMRegister src) {
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  5536
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5537
  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5538
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5539
  emit_int8((unsigned char)0xDF);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5540
  emit_int8((unsigned char)(0xC0 | encode));
33089
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  5541
}
f4e956ed8b43 8132207: update for x86 exp in the math lib
iveresov
parents: 33066
diff changeset
  5542
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5543
void Assembler::por(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5544
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5545
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5546
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5547
  emit_int8((unsigned char)0xEB);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5548
  emit_int8((unsigned char)(0xC0 | encode));
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5549
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5550
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5551
void Assembler::vpor(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5552
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5553
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5554
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5555
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5556
  emit_int8((unsigned char)0xEB);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5557
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5558
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5559
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5560
void Assembler::vpor(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5561
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5562
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5563
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5564
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5565
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5566
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5567
  emit_int8((unsigned char)0xEB);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5568
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5569
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5570
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5571
void Assembler::pxor(XMMRegister dst, XMMRegister src) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5572
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5573
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5574
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5575
  emit_int8((unsigned char)0xEF);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5576
  emit_int8((unsigned char)(0xC0 | encode));
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  5577
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  5578
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5579
void Assembler::vpxor(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5580
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5581
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5582
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5583
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5584
  emit_int8((unsigned char)0xEF);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5585
  emit_int8((unsigned char)(0xC0 | encode));
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5586
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5587
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5588
void Assembler::vpxor(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5589
  assert(UseAVX > 0, "requires some form of AVX");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5590
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5591
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5592
  attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5593
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5594
  vex_prefix(src, nds_enc, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5595
  emit_int8((unsigned char)0xEF);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5596
  emit_operand(dst, src);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5597
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13391
diff changeset
  5598
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  5599
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  5600
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
  5601
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5602
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5603
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5604
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5605
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5606
  emit_int8(0x18);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5607
  emit_int8((unsigned char)(0xC0 | encode));
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  5608
  // 0x00 - insert into lower 128 bits
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  5609
  // 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
  5610
  emit_int8(0x01);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  5611
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  5612
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5613
void Assembler::vinsertf64x4h(XMMRegister dst, XMMRegister nds, XMMRegister src, int value) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5614
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5615
  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5616
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5617
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5618
  emit_int8(0x1A);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5619
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5620
  // 0x00 - insert into lower 256 bits
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5621
  // 0x01 - insert into upper 256 bits
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5622
  emit_int8(value & 0x01);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5623
}
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5624
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5625
void Assembler::vinsertf64x4h(XMMRegister dst, Address src, int value) {
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5626
  assert(VM_Version::supports_evex(), "");
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5627
  assert(dst != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5628
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5629
  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5630
  attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_64bit);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5631
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5632
  vex_prefix(src, dst->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5633
  emit_int8(0x1A);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5634
  emit_operand(dst, src);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5635
  // 0x00 - insert into lower 256 bits
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5636
  // 0x01 - insert into upper 128 bits
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5637
  emit_int8(value & 0x01);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5638
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5639
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5640
void Assembler::vinsertf32x4h(XMMRegister dst, XMMRegister nds, XMMRegister src, int value) {
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5641
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5642
  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5643
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5644
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5645
  emit_int8(0x18);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5646
  emit_int8((unsigned char)(0xC0 | encode));
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5647
  // 0x00 - insert into q0 128 bits (0..127)
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5648
  // 0x01 - insert into q1 128 bits (128..255)
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5649
  // 0x02 - insert into q2 128 bits (256..383)
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5650
  // 0x03 - insert into q3 128 bits (384..511)
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5651
  emit_int8(value & 0x3);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5652
}
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5653
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5654
void Assembler::vinsertf32x4h(XMMRegister dst, Address src, int value) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5655
  assert(VM_Version::supports_avx(), "");
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5656
  assert(dst != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5657
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5658
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5659
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5660
  attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5661
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5662
  vex_prefix(src, dst->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5663
  emit_int8(0x18);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5664
  emit_operand(dst, src);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5665
  // 0x00 - insert into q0 128 bits (0..127)
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5666
  // 0x01 - insert into q1 128 bits (128..255)
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5667
  // 0x02 - insert into q2 128 bits (256..383)
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5668
  // 0x03 - insert into q3 128 bits (384..511)
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5669
  emit_int8(value & 0x3);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5670
}
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5671
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5672
void Assembler::vinsertf128h(XMMRegister dst, Address src) {
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5673
  assert(VM_Version::supports_avx(), "");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5674
  assert(dst != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5675
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5676
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5677
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5678
  attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5679
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5680
  vex_prefix(src, dst->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5681
  emit_int8(0x18);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5682
  emit_operand(dst, src);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5683
  // 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
  5684
  emit_int8(0x01);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5685
}
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5686
30211
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  5687
void Assembler::vextractf128h(XMMRegister dst, XMMRegister src) {
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  5688
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5689
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5690
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5691
  int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30211
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  5692
  emit_int8(0x19);
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  5693
  emit_int8((unsigned char)(0xC0 | encode));
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  5694
  // 0x00 - insert into lower 128 bits
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  5695
  // 0x01 - insert into upper 128 bits
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  5696
  emit_int8(0x01);
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  5697
}
442fbbb31f75 8074981: Integer/FP scalar reduction optimization
kvn
parents: 27691
diff changeset
  5698
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5699
void Assembler::vextractf128h(Address dst, XMMRegister src) {
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5700
  assert(VM_Version::supports_avx(), "");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5701
  assert(src != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5702
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5703
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5704
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5705
  attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5706
  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5707
  emit_int8(0x19);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5708
  emit_operand(src, dst);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5709
  // 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
  5710
  emit_int8(0x01);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5711
}
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5712
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  5713
void Assembler::vinserti128h(XMMRegister dst, XMMRegister nds, XMMRegister src) {
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  5714
  assert(VM_Version::supports_avx2(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5715
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5716
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5717
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5718
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5719
  emit_int8(0x38);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5720
  emit_int8((unsigned char)(0xC0 | encode));
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  5721
  // 0x00 - insert into lower 128 bits
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  5722
  // 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
  5723
  emit_int8(0x01);
13294
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  5724
}
80131b419f85 7181494: cleanup avx and vectors code
kvn
parents: 13104
diff changeset
  5725
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5726
void Assembler::vinserti64x4h(XMMRegister dst, XMMRegister nds, XMMRegister src, int value) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5727
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5728
  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5729
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5730
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5731
  emit_int8(0x38);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5732
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5733
  // 0x00 - insert into lower 256 bits
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5734
  // 0x01 - insert into upper 256 bits
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5735
  emit_int8(value & 0x01);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5736
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5737
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5738
void Assembler::vinserti128h(XMMRegister dst, Address src) {
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5739
  assert(VM_Version::supports_avx2(), "");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5740
  assert(dst != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5741
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5742
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5743
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5744
  attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5745
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5746
  vex_prefix(src, dst->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5747
  emit_int8(0x38);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5748
  emit_operand(dst, src);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5749
  // 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
  5750
  emit_int8(0x01);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5751
}
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5752
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5753
void Assembler::vextracti128h(XMMRegister dst, XMMRegister src) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5754
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5755
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5756
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5757
  int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5758
  emit_int8(0x39);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5759
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5760
  // 0x00 - insert into lower 128 bits
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5761
  // 0x01 - insert into upper 128 bits
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5762
  emit_int8(0x01);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5763
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5764
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5765
void Assembler::vextracti128h(Address dst, XMMRegister src) {
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5766
  assert(VM_Version::supports_avx2(), "");
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5767
  assert(src != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5768
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5769
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5770
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5771
  attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5772
  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  5773
  emit_int8(0x39);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5774
  emit_operand(src, dst);
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5775
  // 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
  5776
  emit_int8(0x01);
13883
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5777
}
6979b9850feb 7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents: 13728
diff changeset
  5778
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5779
void Assembler::vextracti64x4h(XMMRegister dst, XMMRegister src, int value) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5780
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5781
  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5782
  int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5783
  emit_int8(0x3B);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5784
  emit_int8((unsigned char)(0xC0 | encode));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5785
  // 0x00 - extract from lower 256 bits
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5786
  // 0x01 - extract from upper 256 bits
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5787
  emit_int8(value & 0x01);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5788
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5789
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5790
void Assembler::vextracti64x2h(XMMRegister dst, XMMRegister src, int value) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5791
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5792
  InstructionAttr attributes(AVX_512bit, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5793
  int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5794
  emit_int8(0x39);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5795
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5796
  // 0x01 - extract from bits 255:128
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5797
  // 0x02 - extract from bits 383:256
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5798
  // 0x03 - extract from bits 511:384
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5799
  emit_int8(value & 0x3);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5800
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5801
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5802
void Assembler::vextractf64x4h(XMMRegister dst, XMMRegister src, int value) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5803
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5804
  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5805
  int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5806
  emit_int8(0x1B);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5807
  emit_int8((unsigned char)(0xC0 | encode));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5808
  // 0x00 - extract from lower 256 bits
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5809
  // 0x01 - extract from upper 256 bits
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5810
  emit_int8(value & 0x1);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5811
}
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5812
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5813
void Assembler::vextractf64x4h(Address dst, XMMRegister src, int value) {
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5814
  assert(VM_Version::supports_evex(), "");
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5815
  assert(src != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5816
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5817
  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5818
  attributes.set_address_attributes(/* tuple_type */ EVEX_T4,/* input_size_in_bits */  EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5819
  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5820
  emit_int8(0x1B);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5821
  emit_operand(src, dst);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5822
  // 0x00 - extract from lower 256 bits
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5823
  // 0x01 - extract from upper 256 bits
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5824
  emit_int8(value & 0x01);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5825
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5826
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5827
void Assembler::vextractf32x4h(XMMRegister dst, XMMRegister src, int value) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5828
  assert(VM_Version::supports_avx(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5829
  int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5830
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5831
  int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5832
  emit_int8(0x19);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5833
  emit_int8((unsigned char)(0xC0 | encode));
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5834
  // 0x00 - extract from bits 127:0
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5835
  // 0x01 - extract from bits 255:128
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5836
  // 0x02 - extract from bits 383:256
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5837
  // 0x03 - extract from bits 511:384
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5838
  emit_int8(value & 0x3);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5839
}
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5840
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5841
void Assembler::vextractf32x4h(Address dst, XMMRegister src, int value) {
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5842
  assert(VM_Version::supports_evex(), "");
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5843
  assert(src != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5844
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5845
  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5846
  attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5847
  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5848
  emit_int8(0x19);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5849
  emit_operand(src, dst);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  5850
  // 0x00 - extract from bits 127:0
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5851
  // 0x01 - extract from bits 255:128
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5852
  // 0x02 - extract from bits 383:256
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5853
  // 0x03 - extract from bits 511:384
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5854
  emit_int8(value & 0x3);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5855
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5856
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5857
void Assembler::vextractf64x2h(XMMRegister dst, XMMRegister src, int value) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5858
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5859
  InstructionAttr attributes(AVX_512bit, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5860
  int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5861
  emit_int8(0x19);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5862
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5863
  // 0x01 - extract from bits 255:128
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5864
  // 0x02 - extract from bits 383:256
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5865
  // 0x03 - extract from bits 511:384
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5866
  emit_int8(value & 0x3);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5867
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5868
15115
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  5869
// 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
  5870
void Assembler::vpbroadcastd(XMMRegister dst, XMMRegister src) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5871
  assert(VM_Version::supports_avx2(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5872
  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5873
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5874
  emit_int8(0x58);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5875
  emit_int8((unsigned char)(0xC0 | encode));
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5876
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5877
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  5878
// duplicate 2-bytes integer data from src into 16 locations in dest
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  5879
void Assembler::vpbroadcastw(XMMRegister dst, XMMRegister src) {
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  5880
  assert(VM_Version::supports_avx2(), "");
35113
b11bd150ed8a 8144771: Use AVX3 instructions for string compare
kvn
parents: 34203
diff changeset
  5881
  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5882
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  5883
  emit_int8(0x79);
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  5884
  emit_int8((unsigned char)(0xC0 | encode));
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  5885
}
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33469
diff changeset
  5886
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5887
// duplicate 1-byte integer data from src into 16||32|64 locations in dest : requires AVX512BW and AVX512VL
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5888
void Assembler::evpbroadcastb(XMMRegister dst, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5889
  assert(VM_Version::supports_evex(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5890
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5891
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5892
  emit_int8(0x78);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5893
  emit_int8((unsigned char)(0xC0 | encode));
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5894
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5895
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5896
void Assembler::evpbroadcastb(XMMRegister dst, Address src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5897
  assert(VM_Version::supports_evex(), "");
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5898
  assert(dst != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5899
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5900
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5901
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_8bit);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5902
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5903
  vex_prefix(src, dst->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5904
  emit_int8(0x78);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5905
  emit_operand(dst, src);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5906
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5907
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5908
// duplicate 2-byte integer data from src into 8|16||32 locations in dest : requires AVX512BW and AVX512VL
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5909
void Assembler::evpbroadcastw(XMMRegister dst, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5910
  assert(VM_Version::supports_evex(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5911
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5912
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5913
  emit_int8(0x79);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5914
  emit_int8((unsigned char)(0xC0 | encode));
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5915
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5916
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5917
void Assembler::evpbroadcastw(XMMRegister dst, Address src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5918
  assert(VM_Version::supports_evex(), "");
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5919
  assert(dst != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5920
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5921
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5922
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_16bit);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5923
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5924
  vex_prefix(src, dst->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5925
  emit_int8(0x79);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5926
  emit_operand(dst, src);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5927
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5928
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5929
// duplicate 4-byte integer data from src into 4|8|16 locations in dest : requires AVX512VL
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  5930
void Assembler::evpbroadcastd(XMMRegister dst, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5931
  assert(VM_Version::supports_evex(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5932
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5933
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
15115
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  5934
  emit_int8(0x58);
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  5935
  emit_int8((unsigned char)(0xC0 | encode));
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  5936
}
f8ef87f6f07f 8005544: Use 256bit YMM registers in arraycopy stubs on x86
kvn
parents: 15114
diff changeset
  5937
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5938
void Assembler::evpbroadcastd(XMMRegister dst, Address src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5939
  assert(VM_Version::supports_evex(), "");
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5940
  assert(dst != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5941
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5942
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5943
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5944
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5945
  vex_prefix(src, dst->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5946
  emit_int8(0x58);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5947
  emit_operand(dst, src);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5948
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5949
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5950
// duplicate 8-byte integer data from src into 4|8|16 locations in dest : requires AVX512VL
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5951
void Assembler::evpbroadcastq(XMMRegister dst, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5952
  assert(VM_Version::supports_evex(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5953
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5954
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5955
  emit_int8(0x59);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5956
  emit_int8((unsigned char)(0xC0 | encode));
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5957
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5958
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5959
void Assembler::evpbroadcastq(XMMRegister dst, Address src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5960
  assert(VM_Version::supports_evex(), "");
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5961
  assert(dst != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5962
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5963
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5964
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5965
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5966
  vex_prefix(src, dst->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5967
  emit_int8(0x59);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5968
  emit_operand(dst, src);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5969
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5970
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5971
// duplicate single precision fp from src into 4|8|16 locations in dest : requires AVX512VL
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5972
void Assembler::evpbroadcastss(XMMRegister dst, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5973
  assert(VM_Version::supports_evex(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5974
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5975
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5976
  emit_int8(0x18);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5977
  emit_int8((unsigned char)(0xC0 | encode));
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5978
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5979
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5980
void Assembler::evpbroadcastss(XMMRegister dst, Address src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5981
  assert(VM_Version::supports_evex(), "");
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5982
  assert(dst != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5983
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5984
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5985
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5986
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5987
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5988
  emit_int8(0x18);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5989
  emit_operand(dst, src);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5990
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5991
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5992
// duplicate double precision fp from src into 2|4|8 locations in dest : requires AVX512VL
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5993
void Assembler::evpbroadcastsd(XMMRegister dst, XMMRegister src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5994
  assert(VM_Version::supports_evex(), "");
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5995
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  5996
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5997
  emit_int8(0x19);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5998
  emit_int8((unsigned char)(0xC0 | encode));
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  5999
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6000
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6001
void Assembler::evpbroadcastsd(XMMRegister dst, Address src, int vector_len) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6002
  assert(VM_Version::supports_evex(), "");
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6003
  assert(dst != xnoreg, "sanity");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6004
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6005
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6006
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6007
  // swap src<->dst for encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6008
  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6009
  emit_int8(0x19);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6010
  emit_operand(dst, src);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6011
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6012
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6013
// duplicate 1-byte integer data from src into 16||32|64 locations in dest : requires AVX512BW and AVX512VL
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6014
void Assembler::evpbroadcastb(XMMRegister dst, Register src, int vector_len) {
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6015
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6016
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6017
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6018
  emit_int8(0x7A);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6019
  emit_int8((unsigned char)(0xC0 | encode));
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6020
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6021
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6022
// duplicate 2-byte integer data from src into 8|16||32 locations in dest : requires AVX512BW and AVX512VL
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6023
void Assembler::evpbroadcastw(XMMRegister dst, Register src, int vector_len) {
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6024
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6025
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6026
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6027
  emit_int8(0x7B);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6028
  emit_int8((unsigned char)(0xC0 | encode));
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6029
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6030
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6031
// duplicate 4-byte integer data from src into 4|8|16 locations in dest : requires AVX512VL
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6032
void Assembler::evpbroadcastd(XMMRegister dst, Register src, int vector_len) {
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6033
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6034
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6035
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6036
  emit_int8(0x7C);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6037
  emit_int8((unsigned char)(0xC0 | encode));
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6038
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6039
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6040
// duplicate 8-byte integer data from src into 4|8|16 locations in dest : requires AVX512VL
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6041
void Assembler::evpbroadcastq(XMMRegister dst, Register src, int vector_len) {
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6042
  assert(VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6043
  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6044
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6045
  emit_int8(0x7C);
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6046
  emit_int8((unsigned char)(0xC0 | encode));
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6047
}
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6048
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  6049
// Carry-Less Multiplication Quadword
25932
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  6050
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
  6051
  assert(VM_Version::supports_clmul(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6052
  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6053
  int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
25932
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  6054
  emit_int8(0x44);
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  6055
  emit_int8((unsigned char)(0xC0 | encode));
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  6056
  emit_int8((unsigned char)mask);
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  6057
}
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  6058
15d133edd8f6 8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents: 24424
diff changeset
  6059
// Carry-Less Multiplication Quadword
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  6060
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
  6061
  assert(VM_Version::supports_avx() && VM_Version::supports_clmul(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6062
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6063
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6064
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  6065
  emit_int8(0x44);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  6066
  emit_int8((unsigned char)(0xC0 | encode));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  6067
  emit_int8((unsigned char)mask);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  6068
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 16670
diff changeset
  6069
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  6070
void Assembler::vzeroupper() {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  6071
  assert(VM_Version::supports_avx(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6072
  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6073
  (void)vex_prefix_and_encode(0, 0, 0, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6074
  emit_int8(0x77);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  6075
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 12955
diff changeset
  6076
11429
e894217a5d94 7121648: Use 3-operands SIMD instructions on x86 with AVX
kvn
parents: 11427
diff changeset
  6077
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6078
#ifndef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6079
// 32bit only pieces of the assembler
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6080
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6081
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
  6082
  // NO PREFIX AS NEVER 64BIT
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6083
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6084
  emit_int8((unsigned char)0x81);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6085
  emit_int8((unsigned char)(0xF8 | src1->encoding()));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6086
  emit_data(imm32, rspec, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6087
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6088
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6089
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
  6090
  // 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
  6091
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6092
  emit_int8((unsigned char)0x81);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6093
  emit_operand(rdi, src1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6094
  emit_data(imm32, rspec, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6095
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6096
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6097
// 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
  6098
// 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
  6099
// 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
  6100
void Assembler::cmpxchg8(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6101
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6102
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6103
  emit_int8((unsigned char)0xC7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6104
  emit_operand(rcx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6105
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6106
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6107
void Assembler::decl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6108
  // 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
  6109
 emit_int8(0x48 | dst->encoding());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6110
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6111
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6112
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6113
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6114
// 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
  6115
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6116
void Assembler::fabs() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6117
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6118
  emit_int8((unsigned char)0xE1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6119
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6120
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6121
void Assembler::fadd(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6122
  emit_farith(0xD8, 0xC0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6123
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6124
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6125
void Assembler::fadd_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6126
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6127
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6128
  emit_operand32(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6129
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6130
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6131
void Assembler::fadd_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6132
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6133
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6134
  emit_operand32(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6135
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6136
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6137
void Assembler::fadda(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6138
  emit_farith(0xDC, 0xC0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6139
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6140
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6141
void Assembler::faddp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6142
  emit_farith(0xDE, 0xC0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6143
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6144
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6145
void Assembler::fchs() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6146
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6147
  emit_int8((unsigned char)0xE0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6148
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6149
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6150
void Assembler::fcom(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6151
  emit_farith(0xD8, 0xD0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6152
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6153
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6154
void Assembler::fcomp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6155
  emit_farith(0xD8, 0xD8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6156
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6157
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6158
void Assembler::fcomp_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6159
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6160
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6161
  emit_operand32(rbx, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6162
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6163
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6164
void Assembler::fcomp_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6165
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6166
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6167
  emit_operand32(rbx, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6168
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6169
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6170
void Assembler::fcompp() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6171
  emit_int8((unsigned char)0xDE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6172
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6173
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6174
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6175
void Assembler::fcos() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6176
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6177
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6178
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6179
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6180
void Assembler::fdecstp() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6181
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6182
  emit_int8((unsigned char)0xF6);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6183
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6184
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6185
void Assembler::fdiv(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6186
  emit_farith(0xD8, 0xF0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6187
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6188
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6189
void Assembler::fdiv_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6190
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6191
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6192
  emit_operand32(rsi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6193
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6194
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6195
void Assembler::fdiv_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6196
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6197
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6198
  emit_operand32(rsi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6199
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6200
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6201
void Assembler::fdiva(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6202
  emit_farith(0xDC, 0xF8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6203
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6204
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6205
// 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
  6206
//       is erroneous for some of the floating-point instructions below.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6207
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6208
void Assembler::fdivp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6209
  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
  6210
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6211
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6212
void Assembler::fdivr(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6213
  emit_farith(0xD8, 0xF8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6214
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6215
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6216
void Assembler::fdivr_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6217
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6218
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6219
  emit_operand32(rdi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6220
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6221
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6222
void Assembler::fdivr_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6223
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6224
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6225
  emit_operand32(rdi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6226
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6227
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6228
void Assembler::fdivra(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6229
  emit_farith(0xDC, 0xF0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6230
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6231
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6232
void Assembler::fdivrp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6233
  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
  6234
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6235
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6236
void Assembler::ffree(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6237
  emit_farith(0xDD, 0xC0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6238
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6239
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6240
void Assembler::fild_d(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6241
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6242
  emit_int8((unsigned char)0xDF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6243
  emit_operand32(rbp, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6244
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6245
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6246
void Assembler::fild_s(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6247
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6248
  emit_int8((unsigned char)0xDB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6249
  emit_operand32(rax, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6250
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6251
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6252
void Assembler::fincstp() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6253
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6254
  emit_int8((unsigned char)0xF7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6255
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6256
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6257
void Assembler::finit() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6258
  emit_int8((unsigned char)0x9B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6259
  emit_int8((unsigned char)0xDB);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6260
  emit_int8((unsigned char)0xE3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6261
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6262
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6263
void Assembler::fist_s(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6264
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6265
  emit_int8((unsigned char)0xDB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6266
  emit_operand32(rdx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6267
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6268
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6269
void Assembler::fistp_d(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6270
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6271
  emit_int8((unsigned char)0xDF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6272
  emit_operand32(rdi, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6273
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6274
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6275
void Assembler::fistp_s(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6276
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6277
  emit_int8((unsigned char)0xDB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6278
  emit_operand32(rbx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6279
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6280
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6281
void Assembler::fld1() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6282
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6283
  emit_int8((unsigned char)0xE8);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6284
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6285
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6286
void Assembler::fld_d(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6287
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6288
  emit_int8((unsigned char)0xDD);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6289
  emit_operand32(rax, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6290
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6291
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6292
void Assembler::fld_s(Address adr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6293
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6294
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6295
  emit_operand32(rax, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6296
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6297
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6298
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6299
void Assembler::fld_s(int index) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6300
  emit_farith(0xD9, 0xC0, index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6301
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6302
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6303
void Assembler::fld_x(Address adr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6304
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6305
  emit_int8((unsigned char)0xDB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6306
  emit_operand32(rbp, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6307
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6308
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6309
void Assembler::fldcw(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6310
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6311
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6312
  emit_operand32(rbp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6313
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6314
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6315
void Assembler::fldenv(Address src) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6316
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6317
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6318
  emit_operand32(rsp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6319
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6320
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6321
void Assembler::fldlg2() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6322
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6323
  emit_int8((unsigned char)0xEC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6324
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6325
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6326
void Assembler::fldln2() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6327
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6328
  emit_int8((unsigned char)0xED);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6329
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6330
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6331
void Assembler::fldz() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6332
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6333
  emit_int8((unsigned char)0xEE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6334
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6335
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6336
void Assembler::flog() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6337
  fldln2();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6338
  fxch();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6339
  fyl2x();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6340
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6341
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6342
void Assembler::flog10() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6343
  fldlg2();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6344
  fxch();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6345
  fyl2x();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6346
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6347
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6348
void Assembler::fmul(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6349
  emit_farith(0xD8, 0xC8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6350
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6351
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6352
void Assembler::fmul_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6353
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6354
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6355
  emit_operand32(rcx, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6356
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6357
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6358
void Assembler::fmul_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6359
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6360
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6361
  emit_operand32(rcx, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6362
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6363
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6364
void Assembler::fmula(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6365
  emit_farith(0xDC, 0xC8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6366
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6367
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6368
void Assembler::fmulp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6369
  emit_farith(0xDE, 0xC8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6370
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6371
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6372
void Assembler::fnsave(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6373
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6374
  emit_int8((unsigned char)0xDD);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6375
  emit_operand32(rsi, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6376
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6377
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6378
void Assembler::fnstcw(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6379
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6380
  emit_int8((unsigned char)0x9B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6381
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6382
  emit_operand32(rdi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6383
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6384
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6385
void Assembler::fnstsw_ax() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6386
  emit_int8((unsigned char)0xDF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6387
  emit_int8((unsigned char)0xE0);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6388
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6389
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6390
void Assembler::fprem() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6391
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6392
  emit_int8((unsigned char)0xF8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6393
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6394
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6395
void Assembler::fprem1() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6396
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6397
  emit_int8((unsigned char)0xF5);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6398
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6399
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6400
void Assembler::frstor(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6401
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6402
  emit_int8((unsigned char)0xDD);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6403
  emit_operand32(rsp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6404
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6405
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6406
void Assembler::fsin() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6407
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6408
  emit_int8((unsigned char)0xFE);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6409
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6410
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6411
void Assembler::fsqrt() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6412
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6413
  emit_int8((unsigned char)0xFA);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6414
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6415
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6416
void Assembler::fst_d(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6417
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6418
  emit_int8((unsigned char)0xDD);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6419
  emit_operand32(rdx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6420
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6421
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6422
void Assembler::fst_s(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6423
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6424
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6425
  emit_operand32(rdx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6426
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6427
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6428
void Assembler::fstp_d(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6429
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6430
  emit_int8((unsigned char)0xDD);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6431
  emit_operand32(rbx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6432
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6433
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6434
void Assembler::fstp_d(int index) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6435
  emit_farith(0xDD, 0xD8, index);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6436
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6437
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6438
void Assembler::fstp_s(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6439
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6440
  emit_int8((unsigned char)0xD9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6441
  emit_operand32(rbx, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6442
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6443
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6444
void Assembler::fstp_x(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6445
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6446
  emit_int8((unsigned char)0xDB);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6447
  emit_operand32(rdi, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6448
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6449
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6450
void Assembler::fsub(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6451
  emit_farith(0xD8, 0xE0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6452
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6453
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6454
void Assembler::fsub_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6455
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6456
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6457
  emit_operand32(rsp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6458
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6459
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6460
void Assembler::fsub_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6461
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6462
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6463
  emit_operand32(rsp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6464
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6465
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6466
void Assembler::fsuba(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6467
  emit_farith(0xDC, 0xE8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6468
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6469
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6470
void Assembler::fsubp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6471
  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
  6472
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6473
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6474
void Assembler::fsubr(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6475
  emit_farith(0xD8, 0xE8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6476
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6477
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6478
void Assembler::fsubr_d(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6479
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6480
  emit_int8((unsigned char)0xDC);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6481
  emit_operand32(rbp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6482
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6483
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6484
void Assembler::fsubr_s(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6485
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6486
  emit_int8((unsigned char)0xD8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6487
  emit_operand32(rbp, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6488
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6489
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6490
void Assembler::fsubra(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6491
  emit_farith(0xDC, 0xE0, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6492
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6493
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6494
void Assembler::fsubrp(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6495
  emit_farith(0xDE, 0xE0, i);                    // ST(0) <- ST(1) - ST(0) and pop (Intel manual wrong)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6496
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6497
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6498
void Assembler::ftan() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6499
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6500
  emit_int8((unsigned char)0xF2);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6501
  emit_int8((unsigned char)0xDD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6502
  emit_int8((unsigned char)0xD8);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6503
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6504
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6505
void Assembler::ftst() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6506
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6507
  emit_int8((unsigned char)0xE4);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6508
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6509
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6510
void Assembler::fucomi(int i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6511
  // make sure the instruction is supported (introduced for P6, together with cmov)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6512
  guarantee(VM_Version::supports_cmov(), "illegal instruction");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6513
  emit_farith(0xDB, 0xE8, i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6514
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6515
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6516
void Assembler::fucomip(int i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6517
  // make sure the instruction is supported (introduced for P6, together with cmov)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6518
  guarantee(VM_Version::supports_cmov(), "illegal instruction");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6519
  emit_farith(0xDF, 0xE8, i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6520
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6521
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6522
void Assembler::fwait() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6523
  emit_int8((unsigned char)0x9B);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6524
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  6525
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6526
void Assembler::fxch(int i) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6527
  emit_farith(0xD9, 0xC8, i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6528
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6529
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6530
void Assembler::fyl2x() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6531
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6532
  emit_int8((unsigned char)0xF1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6533
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6534
12739
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  6535
void Assembler::frndint() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6536
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6537
  emit_int8((unsigned char)0xFC);
12739
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  6538
}
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  6539
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  6540
void Assembler::f2xm1() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6541
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6542
  emit_int8((unsigned char)0xF0);
12739
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  6543
}
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  6544
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  6545
void Assembler::fldl2e() {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6546
  emit_int8((unsigned char)0xD9);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6547
  emit_int8((unsigned char)0xEA);
12739
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  6548
}
09f26b73ae66 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 12268
diff changeset
  6549
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6550
// SSE SIMD prefix byte values corresponding to VexSimdPrefix encoding.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6551
static int simd_pre[4] = { 0, 0x66, 0xF3, 0xF2 };
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6552
// SSE opcode second byte values (first is 0x0F) corresponding to VexOpcode encoding.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6553
static int simd_opc[4] = { 0,    0, 0x38, 0x3A };
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6554
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6555
// Generate SSE legacy REX prefix and SIMD opcode based on VEX encoding.
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6556
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
  6557
  if (pre > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6558
    emit_int8(simd_pre[pre]);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6559
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6560
  if (rex_w) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6561
    prefixq(adr, xreg);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6562
  } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6563
    prefix(adr, xreg);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6564
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6565
  if (opc > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6566
    emit_int8(0x0F);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6567
    int opc2 = simd_opc[opc];
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6568
    if (opc2 > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6569
      emit_int8(opc2);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6570
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6571
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6572
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6573
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6574
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
  6575
  if (pre > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6576
    emit_int8(simd_pre[pre]);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6577
  }
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6578
  int encode = (rex_w) ? prefixq_and_encode(dst_enc, src_enc) : prefix_and_encode(dst_enc, src_enc);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6579
  if (opc > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6580
    emit_int8(0x0F);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6581
    int opc2 = simd_opc[opc];
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6582
    if (opc2 > 0) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6583
      emit_int8(opc2);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6584
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6585
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6586
  return encode;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6587
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6588
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6589
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6590
void Assembler::vex_prefix(bool vex_r, bool vex_b, bool vex_x, int nds_enc, VexSimdPrefix pre, VexOpcode opc) {
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6591
  int vector_len = _attributes->get_vector_len();
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6592
  bool vex_w = _attributes->is_rex_vex_w();
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6593
  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
  6594
    prefix(VEX_3bytes);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6595
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6596
    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
  6597
    byte1 = (~byte1) & 0xE0;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6598
    byte1 |= opc;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6599
    emit_int8(byte1);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6600
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6601
    int byte2 = ((~nds_enc) & 0xf) << 3;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6602
    byte2 |= (vex_w ? VEX_W : 0) | ((vector_len > 0) ? 4 : 0) | pre;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6603
    emit_int8(byte2);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6604
  } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6605
    prefix(VEX_2bytes);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6606
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6607
    int byte1 = vex_r ? VEX_R : 0;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6608
    byte1 = (~byte1) & 0x80;
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6609
    byte1 |= ((~nds_enc) & 0xf) << 3;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6610
    byte1 |= ((vector_len > 0 ) ? 4 : 0) | pre;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6611
    emit_int8(byte1);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6612
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6613
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6614
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6615
// This is a 4 byte encoding
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6616
void Assembler::evex_prefix(bool vex_r, bool vex_b, bool vex_x, bool evex_r, bool evex_v, int nds_enc, VexSimdPrefix pre, VexOpcode opc){
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6617
  // EVEX 0x62 prefix
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6618
  prefix(EVEX_4bytes);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6619
  bool vex_w = _attributes->is_rex_vex_w();
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6620
  int evex_encoding = (vex_w ? VEX_W : 0);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6621
  // EVEX.b is not currently used for broadcast of single element or data rounding modes
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6622
  _attributes->set_evex_encoding(evex_encoding);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6623
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6624
  // P0: byte 2, initialized to RXBR`00mm
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6625
  // instead of not'd
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6626
  int byte2 = (vex_r ? VEX_R : 0) | (vex_x ? VEX_X : 0) | (vex_b ? VEX_B : 0) | (evex_r ? EVEX_Rb : 0);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6627
  byte2 = (~byte2) & 0xF0;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6628
  // confine opc opcode extensions in mm bits to lower two bits
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6629
  // of form {0F, 0F_38, 0F_3A}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6630
  byte2 |= opc;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6631
  emit_int8(byte2);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6632
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6633
  // P1: byte 3 as Wvvvv1pp
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6634
  int byte3 = ((~nds_enc) & 0xf) << 3;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6635
  // p[10] is always 1
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6636
  byte3 |= EVEX_F;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6637
  byte3 |= (vex_w & 1) << 7;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6638
  // confine pre opcode extensions in pp bits to lower two bits
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6639
  // of form {66, F3, F2}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6640
  byte3 |= pre;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6641
  emit_int8(byte3);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6642
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6643
  // P2: byte 4 as zL'Lbv'aaa
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6644
  int byte4 = (_attributes->is_no_reg_mask()) ? 0 : 1; // kregs are implemented in the low 3 bits as aaa (hard code k1, it will be initialized for now)
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6645
  // EVEX.v` for extending EVEX.vvvv or VIDX
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6646
  byte4 |= (evex_v ? 0: EVEX_V);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6647
  // third EXEC.b for broadcast actions
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6648
  byte4 |= (_attributes->is_extended_context() ? EVEX_Rb : 0);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6649
  // fourth EVEX.L'L for vector length : 0 is 128, 1 is 256, 2 is 512, currently we do not support 1024
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6650
  byte4 |= ((_attributes->get_vector_len())& 0x3) << 5;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6651
  // last is EVEX.z for zero/merge actions
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6652
  byte4 |= (_attributes->is_clear_context() ? EVEX_Z : 0);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6653
  emit_int8(byte4);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6654
}
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6655
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6656
void Assembler::vex_prefix(Address adr, int nds_enc, int xreg_enc, VexSimdPrefix pre, VexOpcode opc, InstructionAttr *attributes) {
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6657
  bool vex_r = ((xreg_enc & 8) == 8) ? 1 : 0;
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6658
  bool vex_b = adr.base_needs_rex();
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6659
  bool vex_x = adr.index_needs_rex();
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6660
  set_attributes(attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6661
  attributes->set_current_assembler(this);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  6662
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  6663
  // if vector length is turned off, revert to AVX for vectors smaller than 512-bit
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6664
  if ((UseAVX > 2) && _legacy_mode_vl && attributes->uses_vl()) {
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6665
    switch (attributes->get_vector_len()) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6666
    case AVX_128bit:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6667
    case AVX_256bit:
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6668
      attributes->set_is_legacy_mode();
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6669
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6670
    }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6671
  }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6672
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6673
  if ((UseAVX > 2) && !attributes->is_legacy_mode())
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6674
  {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6675
    bool evex_r = (xreg_enc >= 16);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6676
    bool evex_v = (nds_enc >= 16);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6677
    attributes->set_is_evex_instruction();
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6678
    evex_prefix(vex_r, vex_b, vex_x, evex_r, evex_v, nds_enc, pre, opc);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6679
  } else {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6680
    vex_prefix(vex_r, vex_b, vex_x, nds_enc, pre, opc);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6681
  }
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6682
}
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6683
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6684
int Assembler::vex_prefix_and_encode(int dst_enc, int nds_enc, int src_enc, VexSimdPrefix pre, VexOpcode opc, InstructionAttr *attributes) {
31410
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6685
  bool vex_r = ((dst_enc & 8) == 8) ? 1 : 0;
2a222ae1205f 8081247: AVX 512 extended support
mcberg
parents: 31404
diff changeset
  6686
  bool vex_b = ((src_enc & 8) == 8) ? 1 : 0;
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6687
  bool vex_x = false;
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6688
  set_attributes(attributes);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6689
  attributes->set_current_assembler(this);
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  6690
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  6691
  // if vector length is turned off, revert to AVX for vectors smaller than 512-bit
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6692
  if ((UseAVX > 2) && _legacy_mode_vl && attributes->uses_vl()) {
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6693
    switch (attributes->get_vector_len()) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6694
    case AVX_128bit:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6695
    case AVX_256bit:
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6696
      if ((dst_enc >= 16) | (nds_enc >= 16) | (src_enc >= 16)) {
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6697
        // up propagate arithmetic instructions to meet RA requirements
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6698
        attributes->set_vector_len(AVX_512bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6699
      } else {
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6700
        attributes->set_is_legacy_mode();
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6701
      }
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6702
      break;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6703
    }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6704
  }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6705
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6706
  if ((UseAVX > 2) && !attributes->is_legacy_mode())
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6707
  {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6708
    bool evex_r = (dst_enc >= 16);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6709
    bool evex_v = (nds_enc >= 16);
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6710
    // can use vex_x as bank extender on rm encoding
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6711
    vex_x = (src_enc >= 16);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6712
    attributes->set_is_evex_instruction();
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6713
    evex_prefix(vex_r, vex_b, vex_x, evex_r, evex_v, nds_enc, pre, opc);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6714
  } else {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6715
    vex_prefix(vex_r, vex_b, vex_x, nds_enc, pre, opc);
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6716
  }
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6717
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6718
  // return modrm byte components for operands
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6719
  return (((dst_enc & 7) << 3) | (src_enc & 7));
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6720
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6721
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6722
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6723
void Assembler::simd_prefix(XMMRegister xreg, XMMRegister nds, Address adr, VexSimdPrefix pre,
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6724
                            VexOpcode opc, InstructionAttr *attributes) {
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6725
  if (UseAVX > 0) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6726
    int xreg_enc = xreg->encoding();
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6727
    int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6728
    vex_prefix(adr, nds_enc, xreg_enc, pre, opc, attributes);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6729
  } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6730
    assert((nds == xreg) || (nds == xnoreg), "wrong sse encoding");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6731
    rex_prefix(adr, xreg, pre, opc, attributes->is_rex_vex_w());
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6732
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6733
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6734
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 30211
diff changeset
  6735
int Assembler::simd_prefix_and_encode(XMMRegister dst, XMMRegister nds, XMMRegister src, VexSimdPrefix pre,
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6736
                                      VexOpcode opc, InstructionAttr *attributes) {
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6737
  int dst_enc = dst->encoding();
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6738
  int src_enc = src->encoding();
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6739
  if (UseAVX > 0) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6740
    int nds_enc = nds->is_valid() ? nds->encoding() : 0;
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6741
    return vex_prefix_and_encode(dst_enc, nds_enc, src_enc, pre, opc, attributes);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6742
  } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6743
    assert((nds == dst) || (nds == src) || (nds == xnoreg), "wrong sse encoding");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6744
    return rex_prefix_and_encode(dst_enc, src_enc, pre, opc, attributes->is_rex_vex_w());
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6745
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  6746
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6747
33469
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6748
void Assembler::cmppd(XMMRegister dst, XMMRegister nds, XMMRegister src, int cop, int vector_len) {
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6749
  assert(VM_Version::supports_avx(), "");
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6750
  assert(!VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6751
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6752
  int encode = simd_prefix_and_encode(dst, nds, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
33469
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6753
  emit_int8((unsigned char)0xC2);
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6754
  emit_int8((unsigned char)(0xC0 | encode));
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6755
  emit_int8((unsigned char)(0xF & cop));
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6756
}
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6757
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6758
void Assembler::vpblendd(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMMRegister src2, int vector_len) {
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6759
  assert(VM_Version::supports_avx(), "");
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6760
  assert(!VM_Version::supports_evex(), "");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6761
  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6762
  int nds_enc = nds->is_valid() ? nds->encoding() : 0;
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6763
  int encode = vex_prefix_and_encode(dst->encoding(), nds_enc, src1->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
33469
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6764
  emit_int8((unsigned char)0x4B);
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6765
  emit_int8((unsigned char)(0xC0 | encode));
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6766
  int src2_enc = src2->encoding();
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6767
  emit_int8((unsigned char)(0xF0 & src2_enc<<4));
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6768
}
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6769
30f4811eded0 8139340: SuperWord enhancement to support vector conditional move (CMovVD) on Intel AVX cpu
iveresov
parents: 33465
diff changeset
  6770
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6771
#ifndef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6772
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6773
void Assembler::incl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6774
  // 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
  6775
  emit_int8(0x40 | dst->encoding());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6776
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6777
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6778
void Assembler::lea(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6779
  leal(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6780
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6781
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6782
void Assembler::mov_literal32(Address dst, int32_t imm32, RelocationHolder const& rspec) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6783
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6784
  emit_int8((unsigned char)0xC7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6785
  emit_operand(rax, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6786
  emit_data((int)imm32, rspec, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6787
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6788
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  6789
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
  6790
  InstructionMark im(this);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  6791
  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
  6792
  emit_int8((unsigned char)(0xB8 | encode));
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  6793
  emit_data((int)imm32, rspec, 0);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  6794
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6795
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6796
void Assembler::popa() { // 32bit
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6797
  emit_int8(0x61);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6798
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6799
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6800
void Assembler::push_literal32(int32_t imm32, RelocationHolder const& rspec) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6801
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6802
  emit_int8(0x68);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6803
  emit_data(imm32, rspec, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6804
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6805
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6806
void Assembler::pusha() { // 32bit
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6807
  emit_int8(0x60);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6808
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6809
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6810
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
  6811
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6812
  emit_int8((unsigned char)0x95);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6813
  emit_int8((unsigned char)(0xE0 | dst->encoding()));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6814
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6815
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6816
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
  6817
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6818
  emit_int8((unsigned char)0xA5);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6819
  emit_int8((unsigned char)(0xC0 | src->encoding() << 3 | dst->encoding()));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6820
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6821
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  6822
// 0F A4 / r ib
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  6823
void Assembler::shldl(Register dst, Register src, int8_t imm8) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  6824
  emit_int8(0x0F);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  6825
  emit_int8((unsigned char)0xA4);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  6826
  emit_int8((unsigned char)(0xC0 | src->encoding() << 3 | dst->encoding()));
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  6827
  emit_int8(imm8);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  6828
}
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  6829
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6830
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
  6831
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6832
  emit_int8((unsigned char)0xAD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6833
  emit_int8((unsigned char)(0xC0 | src->encoding() << 3 | dst->encoding()));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6834
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6835
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6836
#else // LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6837
5253
d2c37eee9a65 6942223: c1 64 bit fixes
iveresov
parents: 5053
diff changeset
  6838
void Assembler::set_byte_if_not_zero(Register dst) {
d2c37eee9a65 6942223: c1 64 bit fixes
iveresov
parents: 5053
diff changeset
  6839
  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
  6840
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6841
  emit_int8((unsigned char)0x95);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  6842
  emit_int8((unsigned char)(0xE0 | enc));
5253
d2c37eee9a65 6942223: c1 64 bit fixes
iveresov
parents: 5053
diff changeset
  6843
}
d2c37eee9a65 6942223: c1 64 bit fixes
iveresov
parents: 5053
diff changeset
  6844
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6845
// 64bit only pieces of the assembler
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6846
// 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
  6847
// it cannot be used by instructions that want an immediate value.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6848
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6849
bool Assembler::reachable(AddressLiteral adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6850
  int64_t disp;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6851
  // 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
  6852
  // 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
  6853
  // always be reachable.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6854
  if (adr.reloc() == relocInfo::none) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6855
    return false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6856
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6857
  if (adr.reloc() == relocInfo::internal_word_type) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6858
    // This should be rip relative and easily reachable.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6859
    return true;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6860
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6861
  if (adr.reloc() == relocInfo::virtual_call_type ||
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6862
      adr.reloc() == relocInfo::opt_virtual_call_type ||
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6863
      adr.reloc() == relocInfo::static_call_type ||
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6864
      adr.reloc() == relocInfo::static_stub_type ) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6865
    // This should be rip relative within the code cache and easily
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6866
    // reachable until we get huge code caches. (At which point
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6867
    // ic code is going to have issues).
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6868
    return true;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6869
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6870
  if (adr.reloc() != relocInfo::external_word_type &&
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6871
      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
  6872
      adr.reloc() != relocInfo::poll_type &&         // relocs to identify them
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6873
      adr.reloc() != relocInfo::runtime_call_type ) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6874
    return false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6875
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6876
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6877
  // Stress the correction code
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6878
  if (ForceUnreachable) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6879
    // Must be runtimecall reloc, see if it is in the codecache
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6880
    // Flipping stuff in the codecache to be unreachable causes issues
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6881
    // with things like inline caches where the additional instructions
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6882
    // are not handled.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6883
    if (CodeCache::find_blob(adr._target) == NULL) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6884
      return false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6885
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6886
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6887
  // 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
  6888
  // 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
  6889
  // anywhere in the codeCache then we are always reachable.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6890
  // 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
  6891
  // to be more pessimistic.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6892
  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
  6893
  if (!is_simm32(disp)) return false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6894
  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
  6895
  if (!is_simm32(disp)) return false;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6896
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  6897
  disp = (int64_t)adr._target - ((int64_t)pc() + sizeof(int));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6898
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6899
  // 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
  6900
  // 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
  6901
  // 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
  6902
  // 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
  6903
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6904
  // 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
  6905
  // + 4 because better safe than sorry.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6906
  const int fudge = 12 + 4;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6907
  if (disp < 0) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6908
    disp -= fudge;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6909
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6910
    disp += fudge;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6911
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6912
  return is_simm32(disp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6913
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6914
8871
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  6915
// 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
  6916
// addressing.
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  6917
bool Assembler::is_polling_page_far() {
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  6918
  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
  6919
  return ForceUnreachable ||
ee1235a09fc3 7110489: C1: 64-bit tiered with ForceUnreachable: assert(reachable(src)) failed: Address should be reachable
never
parents: 10546
diff changeset
  6920
         !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
  6921
         !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
  6922
}
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8676
diff changeset
  6923
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6924
void Assembler::emit_data64(jlong data,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6925
                            relocInfo::relocType rtype,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6926
                            int format) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6927
  if (rtype == relocInfo::none) {
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  6928
    emit_int64(data);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6929
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6930
    emit_data64(data, Relocation::spec_simple(rtype), format);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6931
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6932
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6933
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6934
void Assembler::emit_data64(jlong data,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6935
                            RelocationHolder const& rspec,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6936
                            int format) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6937
  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
  6938
  assert(imm_operand == format, "must be immediate");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6939
  assert(inst_mark() != NULL, "must be inside InstructionMark");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6940
  // Do not use AbstractAssembler::relocate, which is not intended for
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6941
  // embedded words.  Instead, relocate to the enclosing instruction.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6942
  code_section()->relocate(inst_mark(), rspec, format);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6943
#ifdef ASSERT
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6944
  check_relocation(rspec, format);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6945
#endif
14625
b02f361c324e 8003195: AbstractAssembler should not store code pointers but use the CodeSection directly
twisti
parents: 14132
diff changeset
  6946
  emit_int64(data);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6947
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6948
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6949
int Assembler::prefix_and_encode(int reg_enc, bool byteinst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6950
  if (reg_enc >= 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6951
    prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6952
    reg_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6953
  } else if (byteinst && reg_enc >= 4) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6954
    prefix(REX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6955
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6956
  return reg_enc;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6957
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6958
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6959
int Assembler::prefixq_and_encode(int reg_enc) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6960
  if (reg_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6961
    prefix(REX_W);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6962
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6963
    prefix(REX_WB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6964
    reg_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6965
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6966
  return reg_enc;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6967
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6968
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
  6969
int Assembler::prefix_and_encode(int dst_enc, bool dst_is_byte, int src_enc, bool src_is_byte) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6970
  if (dst_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6971
    if (src_enc >= 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6972
      prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6973
      src_enc -= 8;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33089
diff changeset
  6974
    } else if ((src_is_byte && src_enc >= 4) || (dst_is_byte && dst_enc >= 4)) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6975
      prefix(REX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6976
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6977
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6978
    if (src_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6979
      prefix(REX_R);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6980
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6981
      prefix(REX_RB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6982
      src_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6983
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6984
    dst_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6985
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6986
  return dst_enc << 3 | src_enc;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6987
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6988
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6989
int Assembler::prefixq_and_encode(int dst_enc, int src_enc) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6990
  if (dst_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6991
    if (src_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6992
      prefix(REX_W);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6993
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6994
      prefix(REX_WB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6995
      src_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6996
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6997
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6998
    if (src_enc < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  6999
      prefix(REX_WR);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7000
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7001
      prefix(REX_WRB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7002
      src_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7003
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7004
    dst_enc -= 8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7005
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7006
  return dst_enc << 3 | src_enc;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7007
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7008
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7009
void Assembler::prefix(Register reg) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7010
  if (reg->encoding() >= 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7011
    prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7012
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7013
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7014
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7015
void Assembler::prefix(Register dst, Register src, Prefix p) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7016
  if (src->encoding() >= 8) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7017
    p = (Prefix)(p | REX_B);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7018
  }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7019
  if (dst->encoding() >= 8) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7020
    p = (Prefix)( p | REX_R);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7021
  }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7022
  if (p != Prefix_EMPTY) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7023
    // do not generate an empty prefix
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7024
    prefix(p);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7025
  }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7026
}
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7027
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7028
void Assembler::prefix(Register dst, Address adr, Prefix p) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7029
  if (adr.base_needs_rex()) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7030
    if (adr.index_needs_rex()) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7031
      assert(false, "prefix(Register dst, Address adr, Prefix p) does not support handling of an X");
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7032
    } else {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7033
      prefix(REX_B);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7034
    }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7035
  } else {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7036
    if (adr.index_needs_rex()) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7037
      assert(false, "prefix(Register dst, Address adr, Prefix p) does not support handling of an X");
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7038
    }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7039
  }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7040
  if (dst->encoding() >= 8) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7041
    p = (Prefix)(p | REX_R);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7042
  }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7043
  if (p != Prefix_EMPTY) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7044
    // do not generate an empty prefix
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7045
    prefix(p);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7046
  }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7047
}
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32727
diff changeset
  7048
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7049
void Assembler::prefix(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7050
  if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7051
    if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7052
      prefix(REX_XB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7053
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7054
      prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7055
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7056
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7057
    if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7058
      prefix(REX_X);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7059
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7060
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7061
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7062
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7063
void Assembler::prefixq(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7064
  if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7065
    if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7066
      prefix(REX_WXB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7067
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7068
      prefix(REX_WB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7069
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7070
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7071
    if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7072
      prefix(REX_WX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7073
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7074
      prefix(REX_W);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7075
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7076
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7077
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7078
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7079
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7080
void Assembler::prefix(Address adr, Register reg, bool byteinst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7081
  if (reg->encoding() < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7082
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7083
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7084
        prefix(REX_XB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7085
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7086
        prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7087
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7088
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7089
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7090
        prefix(REX_X);
10268
3b789f46f950 7079626: x64 emits unnecessary REX prefix
twisti
parents: 10267
diff changeset
  7091
      } else if (byteinst && reg->encoding() >= 4 ) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7092
        prefix(REX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7093
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7094
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7095
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7096
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7097
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7098
        prefix(REX_RXB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7099
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7100
        prefix(REX_RB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7101
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7102
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7103
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7104
        prefix(REX_RX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7105
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7106
        prefix(REX_R);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7107
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7108
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7109
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7110
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7111
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7112
void Assembler::prefixq(Address adr, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7113
  if (src->encoding() < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7114
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7115
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7116
        prefix(REX_WXB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7117
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7118
        prefix(REX_WB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7119
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7120
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7121
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7122
        prefix(REX_WX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7123
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7124
        prefix(REX_W);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7125
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7126
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7127
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7128
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7129
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7130
        prefix(REX_WRXB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7131
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7132
        prefix(REX_WRB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7133
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7134
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7135
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7136
        prefix(REX_WRX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7137
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7138
        prefix(REX_WR);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7139
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7140
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7141
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7142
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7143
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7144
void Assembler::prefix(Address adr, XMMRegister reg) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7145
  if (reg->encoding() < 8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7146
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7147
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7148
        prefix(REX_XB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7149
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7150
        prefix(REX_B);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7151
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7152
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7153
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7154
        prefix(REX_X);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7155
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7156
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7157
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7158
    if (adr.base_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7159
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7160
        prefix(REX_RXB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7161
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7162
        prefix(REX_RB);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7163
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7164
    } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7165
      if (adr.index_needs_rex()) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7166
        prefix(REX_RX);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7167
      } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7168
        prefix(REX_R);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7169
      }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7170
    }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7171
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7172
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7173
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7174
void Assembler::prefixq(Address adr, XMMRegister src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7175
  if (src->encoding() < 8) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7176
    if (adr.base_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7177
      if (adr.index_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7178
        prefix(REX_WXB);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7179
      } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7180
        prefix(REX_WB);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7181
      }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7182
    } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7183
      if (adr.index_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7184
        prefix(REX_WX);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7185
      } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7186
        prefix(REX_W);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7187
      }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7188
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7189
  } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7190
    if (adr.base_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7191
      if (adr.index_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7192
        prefix(REX_WRXB);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7193
      } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7194
        prefix(REX_WRB);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7195
      }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7196
    } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7197
      if (adr.index_needs_rex()) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7198
        prefix(REX_WRX);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7199
      } else {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7200
        prefix(REX_WR);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7201
      }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7202
    }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7203
  }
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7204
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7205
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7206
void Assembler::adcq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7207
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7208
  emit_arith(0x81, 0xD0, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7209
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7210
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7211
void Assembler::adcq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7212
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7213
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7214
  emit_int8(0x13);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7215
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7216
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7217
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7218
void Assembler::adcq(Register dst, Register src) {
20295
a5dd1b071c32 8025613: clang: remove -Wno-unused-value
twisti
parents: 18507
diff changeset
  7219
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7220
  emit_arith(0x13, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7221
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7222
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7223
void Assembler::addq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7224
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7225
  prefixq(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7226
  emit_arith_operand(0x81, rax, dst,imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7227
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7228
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7229
void Assembler::addq(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7230
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7231
  prefixq(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7232
  emit_int8(0x01);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7233
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7234
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7235
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7236
void Assembler::addq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7237
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7238
  emit_arith(0x81, 0xC0, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7239
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7240
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7241
void Assembler::addq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7242
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7243
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7244
  emit_int8(0x03);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7245
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7246
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7247
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7248
void Assembler::addq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7249
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7250
  emit_arith(0x03, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7251
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7252
26434
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7253
void Assembler::adcxq(Register dst, Register src) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7254
  //assert(VM_Version::supports_adx(), "adx instructions not supported");
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7255
  emit_int8((unsigned char)0x66);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7256
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7257
  emit_int8(0x0F);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7258
  emit_int8(0x38);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7259
  emit_int8((unsigned char)0xF6);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7260
  emit_int8((unsigned char)(0xC0 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7261
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7262
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7263
void Assembler::adoxq(Register dst, Register src) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7264
  //assert(VM_Version::supports_adx(), "adx instructions not supported");
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7265
  emit_int8((unsigned char)0xF3);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7266
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7267
  emit_int8(0x0F);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7268
  emit_int8(0x38);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7269
  emit_int8((unsigned char)0xF6);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7270
  emit_int8((unsigned char)(0xC0 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7271
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7272
10006
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  7273
void Assembler::andq(Address dst, int32_t imm32) {
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  7274
  InstructionMark im(this);
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  7275
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7276
  emit_int8((unsigned char)0x81);
10006
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  7277
  emit_operand(rsp, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  7278
  emit_int32(imm32);
10006
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  7279
}
2a7062afbad7 7056380: VM crashes with SIGSEGV in compiled code
never
parents: 9978
diff changeset
  7280
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7281
void Assembler::andq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7282
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7283
  emit_arith(0x81, 0xE0, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7284
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7285
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7286
void Assembler::andq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7287
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7288
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7289
  emit_int8(0x23);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7290
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7291
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7292
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7293
void Assembler::andq(Register dst, Register src) {
20295
a5dd1b071c32 8025613: clang: remove -Wno-unused-value
twisti
parents: 18507
diff changeset
  7294
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7295
  emit_arith(0x23, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7296
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7297
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7298
void Assembler::andnq(Register dst, Register src1, Register src2) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7299
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7300
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7301
  int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7302
  emit_int8((unsigned char)0xF2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7303
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7304
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7305
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7306
void Assembler::andnq(Register dst, Register src1, Address src2) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7307
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7308
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7309
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7310
  vex_prefix(src2, src1->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7311
  emit_int8((unsigned char)0xF2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7312
  emit_operand(dst, src2);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7313
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7314
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7315
void Assembler::bsfq(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7316
  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
  7317
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7318
  emit_int8((unsigned char)0xBC);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7319
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7320
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7321
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7322
void Assembler::bsrq(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7323
  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
  7324
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7325
  emit_int8((unsigned char)0xBD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7326
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7327
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7328
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7329
void Assembler::bswapq(Register reg) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7330
  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
  7331
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7332
  emit_int8((unsigned char)(0xC8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7333
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7334
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7335
void Assembler::blsiq(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7336
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7337
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7338
  int encode = vex_prefix_and_encode(rbx->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7339
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7340
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7341
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7342
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7343
void Assembler::blsiq(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7344
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7345
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7346
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7347
  vex_prefix(src, dst->encoding(), rbx->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7348
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7349
  emit_operand(rbx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7350
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7351
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7352
void Assembler::blsmskq(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7353
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7354
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7355
  int encode = vex_prefix_and_encode(rdx->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7356
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7357
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7358
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7359
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7360
void Assembler::blsmskq(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7361
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7362
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7363
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7364
  vex_prefix(src, dst->encoding(), rdx->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7365
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7366
  emit_operand(rdx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7367
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7368
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7369
void Assembler::blsrq(Register dst, Register src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7370
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7371
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7372
  int encode = vex_prefix_and_encode(rcx->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7373
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7374
  emit_int8((unsigned char)(0xC0 | encode));
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7375
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7376
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7377
void Assembler::blsrq(Register dst, Address src) {
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7378
  assert(VM_Version::supports_bmi1(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7379
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7380
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7381
  vex_prefix(src, dst->encoding(), rcx->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F_38, &attributes);
23220
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7382
  emit_int8((unsigned char)0xF3);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7383
  emit_operand(rcx, src);
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7384
}
fc827339dc37 8031321: Support Intel bit manipulation instructions
iveresov
parents: 21105
diff changeset
  7385
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7386
void Assembler::cdqq() {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7387
  prefix(REX_W);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7388
  emit_int8((unsigned char)0x99);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7389
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7390
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7391
void Assembler::clflush(Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7392
  prefix(adr);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7393
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7394
  emit_int8((unsigned char)0xAE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7395
  emit_operand(rdi, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7396
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7397
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7398
void Assembler::cmovq(Condition cc, Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7399
  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
  7400
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7401
  emit_int8(0x40 | cc);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7402
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7403
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7404
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7405
void Assembler::cmovq(Condition cc, Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7406
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7407
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7408
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7409
  emit_int8(0x40 | cc);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7410
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7411
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7412
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7413
void Assembler::cmpq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7414
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7415
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7416
  emit_int8((unsigned char)0x81);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7417
  emit_operand(rdi, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  7418
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7419
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7420
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7421
void Assembler::cmpq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7422
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7423
  emit_arith(0x81, 0xF8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7424
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7425
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7426
void Assembler::cmpq(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7427
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7428
  prefixq(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7429
  emit_int8(0x3B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7430
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7431
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7432
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7433
void Assembler::cmpq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7434
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7435
  emit_arith(0x3B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7436
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7437
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7438
void Assembler::cmpq(Register dst, Address  src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7439
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7440
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7441
  emit_int8(0x3B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7442
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7443
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7444
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7445
void Assembler::cmpxchgq(Register reg, Address adr) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7446
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7447
  prefixq(adr, reg);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7448
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7449
  emit_int8((unsigned char)0xB1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7450
  emit_operand(reg, adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7451
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7452
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7453
void Assembler::cvtsi2sdq(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7454
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7455
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7456
  int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7457
  emit_int8(0x2A);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7458
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7459
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7460
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7461
void Assembler::cvtsi2sdq(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7462
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7463
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7464
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7465
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7466
  simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7467
  emit_int8(0x2A);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7468
  emit_operand(dst, src);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7469
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7470
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7471
void Assembler::cvtsi2ssq(XMMRegister dst, Address src) {
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7472
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7473
  InstructionMark im(this);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7474
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7475
  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7476
  simd_prefix(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7477
  emit_int8(0x2A);
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7478
  emit_operand(dst, src);
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7479
}
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7480
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7481
void Assembler::cvttsd2siq(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7482
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7483
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7484
  int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7485
  emit_int8(0x2C);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7486
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7487
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7488
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7489
void Assembler::cvttss2siq(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7490
  NOT_LP64(assert(VM_Version::supports_sse(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7491
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7492
  int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7493
  emit_int8(0x2C);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7494
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7495
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7496
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7497
void Assembler::decl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7498
  // Don't use it directly. Use MacroAssembler::decrementl() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7499
  // 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
  7500
  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
  7501
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7502
  emit_int8((unsigned char)(0xC8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7503
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7504
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7505
void Assembler::decq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7506
  // Don't use it directly. Use MacroAssembler::decrementq() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7507
  // 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
  7508
  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
  7509
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7510
  emit_int8(0xC8 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7511
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7512
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7513
void Assembler::decq(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7514
  // Don't use it directly. Use MacroAssembler::decrementq() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7515
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7516
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7517
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7518
  emit_operand(rcx, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7519
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7520
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7521
void Assembler::fxrstor(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7522
  prefixq(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7523
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7524
  emit_int8((unsigned char)0xAE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7525
  emit_operand(as_Register(1), src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7526
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7527
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7528
void Assembler::xrstor(Address src) {
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7529
  prefixq(src);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7530
  emit_int8(0x0F);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7531
  emit_int8((unsigned char)0xAE);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7532
  emit_operand(as_Register(5), src);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7533
}
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7534
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7535
void Assembler::fxsave(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7536
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7537
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7538
  emit_int8((unsigned char)0xAE);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7539
  emit_operand(as_Register(0), dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7540
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7541
32727
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7542
void Assembler::xsave(Address dst) {
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7543
  prefixq(dst);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7544
  emit_int8(0x0F);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7545
  emit_int8((unsigned char)0xAE);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7546
  emit_operand(as_Register(4), dst);
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7547
}
320855c2baef 8132160: support for AVX 512 call frames and stack management
mcberg
parents: 32723
diff changeset
  7548
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7549
void Assembler::idivq(Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7550
  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
  7551
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7552
  emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7553
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7554
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7555
void Assembler::imulq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7556
  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
  7557
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7558
  emit_int8((unsigned char)0xAF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7559
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7560
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7561
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7562
void Assembler::imulq(Register dst, Register src, int value) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7563
  int encode = prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7564
  if (is8bit(value)) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7565
    emit_int8(0x6B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7566
    emit_int8((unsigned char)(0xC0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7567
    emit_int8(value & 0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7568
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7569
    emit_int8(0x69);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7570
    emit_int8((unsigned char)(0xC0 | encode));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  7571
    emit_int32(value);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7572
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7573
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7574
21105
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  7575
void Assembler::imulq(Register dst, Address src) {
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  7576
  InstructionMark im(this);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  7577
  prefixq(src, dst);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  7578
  emit_int8(0x0F);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  7579
  emit_int8((unsigned char) 0xAF);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  7580
  emit_operand(dst, src);
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  7581
}
47618ee96ed5 8026844: Various Math functions needs intrinsification
rbackman
parents: 20295
diff changeset
  7582
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7583
void Assembler::incl(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7584
  // Don't use it directly. Use MacroAssembler::incrementl() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7585
  // 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
  7586
  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
  7587
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7588
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7589
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7590
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7591
void Assembler::incq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7592
  // Don't use it directly. Use MacroAssembler::incrementq() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7593
  // 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
  7594
  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
  7595
  emit_int8((unsigned char)0xFF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7596
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7597
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7598
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7599
void Assembler::incq(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7600
  // Don't use it directly. Use MacroAssembler::incrementq() instead.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7601
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7602
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7603
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7604
  emit_operand(rax, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7605
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7606
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7607
void Assembler::lea(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7608
  leaq(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7609
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7610
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7611
void Assembler::leaq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7612
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7613
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7614
  emit_int8((unsigned char)0x8D);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7615
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7616
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7617
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7618
void Assembler::mov64(Register dst, int64_t imm64) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7619
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7620
  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
  7621
  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
  7622
  emit_int64(imm64);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7623
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7624
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7625
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
  7626
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7627
  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
  7628
  emit_int8(0xB8 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7629
  emit_data64(imm64, rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7630
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7631
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7632
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
  7633
  InstructionMark im(this);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7634
  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
  7635
  emit_int8((unsigned char)(0xB8 | encode));
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7636
  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
  7637
}
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7638
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7639
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
  7640
  InstructionMark im(this);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7641
  prefix(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7642
  emit_int8((unsigned char)0xC7);
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7643
  emit_operand(rax, dst, 4);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7644
  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
  7645
}
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7646
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7647
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
  7648
  InstructionMark im(this);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7649
  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
  7650
  emit_int8((unsigned char)0x81);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7651
  emit_int8((unsigned char)(0xF8 | encode));
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7652
  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
  7653
}
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7654
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7655
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
  7656
  InstructionMark im(this);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7657
  prefix(src1);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7658
  emit_int8((unsigned char)0x81);
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7659
  emit_operand(rax, src1, 4);
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7660
  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
  7661
}
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2150
diff changeset
  7662
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7663
void Assembler::lzcntq(Register dst, Register src) {
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7664
  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
  7665
  emit_int8((unsigned char)0xF3);
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7666
  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
  7667
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7668
  emit_int8((unsigned char)0xBD);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7669
  emit_int8((unsigned char)(0xC0 | encode));
2862
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7670
}
fad636edf18f 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 2534
diff changeset
  7671
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7672
void Assembler::movdq(XMMRegister dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7673
  // table D-1 says MMX/SSE2
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7674
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7675
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7676
  int encode = simd_prefix_and_encode(dst, xnoreg, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7677
  emit_int8(0x6E);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7678
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7679
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7680
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7681
void Assembler::movdq(Register dst, XMMRegister src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7682
  // table D-1 says MMX/SSE2
11427
bf248009cbbe 7116452: Add support for AVX instructions
kvn
parents: 11194
diff changeset
  7683
  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7684
  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7685
  // swap src/dst to get correct prefix
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7686
  int encode = simd_prefix_and_encode(src, xnoreg, as_XMMRegister(dst->encoding()), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7687
  emit_int8(0x7E);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7688
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7689
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7690
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7691
void Assembler::movq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7692
  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
  7693
  emit_int8((unsigned char)0x8B);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7694
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7695
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7696
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7697
void Assembler::movq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7698
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7699
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7700
  emit_int8((unsigned char)0x8B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7701
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7702
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7703
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7704
void Assembler::movq(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7705
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7706
  prefixq(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7707
  emit_int8((unsigned char)0x89);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7708
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7709
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7710
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7711
void Assembler::movsbq(Register dst, Address src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7712
  InstructionMark im(this);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7713
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7714
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7715
  emit_int8((unsigned char)0xBE);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7716
  emit_operand(dst, src);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7717
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7718
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7719
void Assembler::movsbq(Register dst, Register src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7720
  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
  7721
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7722
  emit_int8((unsigned char)0xBE);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7723
  emit_int8((unsigned char)(0xC0 | encode));
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7724
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7725
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7726
void Assembler::movslq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7727
  // dbx shows movslq(rcx, 3) as movq     $0x0000000049000000,(%rbx)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7728
  // and movslq(r8, 3); as movl     $0x0000000048000000,(%rbx)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7729
  // as a result we shouldn't use until tested at runtime...
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7730
  ShouldNotReachHere();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7731
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7732
  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
  7733
  emit_int8((unsigned char)(0xC7 | encode));
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  7734
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7735
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7736
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7737
void Assembler::movslq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7738
  assert(is_simm32(imm32), "lost bits");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7739
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7740
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7741
  emit_int8((unsigned char)0xC7);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7742
  emit_operand(rax, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  7743
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7744
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7745
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7746
void Assembler::movslq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7747
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7748
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7749
  emit_int8(0x63);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7750
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7751
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7752
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7753
void Assembler::movslq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7754
  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
  7755
  emit_int8(0x63);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7756
  emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7757
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7758
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7759
void Assembler::movswq(Register dst, Address src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7760
  InstructionMark im(this);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7761
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7762
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7763
  emit_int8((unsigned char)0xBF);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7764
  emit_operand(dst, src);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7765
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7766
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7767
void Assembler::movswq(Register dst, Register src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7768
  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
  7769
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7770
  emit_int8((unsigned char)0xBF);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7771
  emit_int8((unsigned char)(0xC0 | encode));
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7772
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7773
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7774
void Assembler::movzbq(Register dst, Address src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7775
  InstructionMark im(this);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7776
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7777
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7778
  emit_int8((unsigned char)0xB6);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7779
  emit_operand(dst, src);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7780
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7781
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7782
void Assembler::movzbq(Register dst, Register src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7783
  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
  7784
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7785
  emit_int8((unsigned char)0xB6);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7786
  emit_int8(0xC0 | encode);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7787
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7788
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7789
void Assembler::movzwq(Register dst, Address src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7790
  InstructionMark im(this);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7791
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7792
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7793
  emit_int8((unsigned char)0xB7);
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7794
  emit_operand(dst, src);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7795
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7796
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7797
void Assembler::movzwq(Register dst, Register src) {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7798
  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
  7799
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7800
  emit_int8((unsigned char)0xB7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7801
  emit_int8((unsigned char)(0xC0 | encode));
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7802
}
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 2149
diff changeset
  7803
26434
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7804
void Assembler::mulq(Address src) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7805
  InstructionMark im(this);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7806
  prefixq(src);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7807
  emit_int8((unsigned char)0xF7);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7808
  emit_operand(rsp, src);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7809
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7810
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7811
void Assembler::mulq(Register src) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7812
  int encode = prefixq_and_encode(src->encoding());
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7813
  emit_int8((unsigned char)0xF7);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7814
  emit_int8((unsigned char)(0xE0 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7815
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7816
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7817
void Assembler::mulxq(Register dst1, Register dst2, Register src) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7818
  assert(VM_Version::supports_bmi2(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7819
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7820
  int encode = vex_prefix_and_encode(dst1->encoding(), dst2->encoding(), src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F_38, &attributes);
26434
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7821
  emit_int8((unsigned char)0xF6);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7822
  emit_int8((unsigned char)(0xC0 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7823
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7824
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7825
void Assembler::negq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7826
  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
  7827
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7828
  emit_int8((unsigned char)(0xD8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7829
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7830
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7831
void Assembler::notq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7832
  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
  7833
  emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7834
  emit_int8((unsigned char)(0xD0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7835
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7836
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7837
void Assembler::orq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7838
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7839
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7840
  emit_int8((unsigned char)0x81);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7841
  emit_operand(rcx, dst, 4);
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  7842
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7843
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7844
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7845
void Assembler::orq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7846
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7847
  emit_arith(0x81, 0xC8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7848
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7849
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7850
void Assembler::orq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7851
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7852
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7853
  emit_int8(0x0B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7854
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7855
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7856
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7857
void Assembler::orq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7858
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7859
  emit_arith(0x0B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7860
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7861
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7862
void Assembler::popa() { // 64bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7863
  movq(r15, Address(rsp, 0));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7864
  movq(r14, Address(rsp, wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7865
  movq(r13, Address(rsp, 2 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7866
  movq(r12, Address(rsp, 3 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7867
  movq(r11, Address(rsp, 4 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7868
  movq(r10, Address(rsp, 5 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7869
  movq(r9,  Address(rsp, 6 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7870
  movq(r8,  Address(rsp, 7 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7871
  movq(rdi, Address(rsp, 8 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7872
  movq(rsi, Address(rsp, 9 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7873
  movq(rbp, Address(rsp, 10 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7874
  // skip rsp
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7875
  movq(rbx, Address(rsp, 12 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7876
  movq(rdx, Address(rsp, 13 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7877
  movq(rcx, Address(rsp, 14 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7878
  movq(rax, Address(rsp, 15 * wordSize));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7879
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7880
  addq(rsp, 16 * wordSize);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7881
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7882
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7883
void Assembler::popcntq(Register dst, Address src) {
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7884
  assert(VM_Version::supports_popcnt(), "must support");
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7885
  InstructionMark im(this);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7886
  emit_int8((unsigned char)0xF3);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7887
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7888
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7889
  emit_int8((unsigned char)0xB8);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7890
  emit_operand(dst, src);
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7891
}
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7892
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7893
void Assembler::popcntq(Register dst, Register src) {
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7894
  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
  7895
  emit_int8((unsigned char)0xF3);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7896
  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
  7897
  emit_int8((unsigned char)0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7898
  emit_int8((unsigned char)0xB8);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7899
  emit_int8((unsigned char)(0xC0 | encode));
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7900
}
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
  7901
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7902
void Assembler::popq(Address dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7903
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7904
  prefixq(dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7905
  emit_int8((unsigned char)0x8F);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7906
  emit_operand(rax, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7907
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7908
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7909
void Assembler::pusha() { // 64bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7910
  // we have to store original rsp.  ABI says that 128 bytes
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7911
  // below rsp are local scratch.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7912
  movq(Address(rsp, -5 * wordSize), rsp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7913
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7914
  subq(rsp, 16 * wordSize);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7915
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7916
  movq(Address(rsp, 15 * wordSize), rax);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7917
  movq(Address(rsp, 14 * wordSize), rcx);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7918
  movq(Address(rsp, 13 * wordSize), rdx);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7919
  movq(Address(rsp, 12 * wordSize), rbx);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7920
  // skip rsp
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7921
  movq(Address(rsp, 10 * wordSize), rbp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7922
  movq(Address(rsp, 9 * wordSize), rsi);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7923
  movq(Address(rsp, 8 * wordSize), rdi);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7924
  movq(Address(rsp, 7 * wordSize), r8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7925
  movq(Address(rsp, 6 * wordSize), r9);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7926
  movq(Address(rsp, 5 * wordSize), r10);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7927
  movq(Address(rsp, 4 * wordSize), r11);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7928
  movq(Address(rsp, 3 * wordSize), r12);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7929
  movq(Address(rsp, 2 * wordSize), r13);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7930
  movq(Address(rsp, wordSize), r14);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7931
  movq(Address(rsp, 0), r15);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7932
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7933
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7934
void Assembler::pushq(Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7935
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7936
  prefixq(src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7937
  emit_int8((unsigned char)0xFF);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7938
  emit_operand(rsi, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7939
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7940
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7941
void Assembler::rclq(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7942
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7943
  int encode = prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7944
  if (imm8 == 1) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7945
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7946
    emit_int8((unsigned char)(0xD0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7947
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7948
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7949
    emit_int8((unsigned char)(0xD0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7950
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7951
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7952
}
26434
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7953
31129
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7954
void Assembler::rcrq(Register dst, int imm8) {
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7955
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7956
  int encode = prefixq_and_encode(dst->encoding());
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7957
  if (imm8 == 1) {
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7958
    emit_int8((unsigned char)0xD1);
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7959
    emit_int8((unsigned char)(0xD8 | encode));
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7960
  } else {
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7961
    emit_int8((unsigned char)0xC1);
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7962
    emit_int8((unsigned char)(0xD8 | encode));
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7963
    emit_int8(imm8);
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7964
  }
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7965
}
02ee7609f0e1 8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents: 30768
diff changeset
  7966
26434
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7967
void Assembler::rorq(Register dst, int imm8) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7968
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7969
  int encode = prefixq_and_encode(dst->encoding());
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7970
  if (imm8 == 1) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7971
    emit_int8((unsigned char)0xD1);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7972
    emit_int8((unsigned char)(0xC8 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7973
  } else {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7974
    emit_int8((unsigned char)0xC1);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7975
    emit_int8((unsigned char)(0xc8 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7976
    emit_int8(imm8);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7977
  }
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7978
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7979
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7980
void Assembler::rorxq(Register dst, Register src, int imm8) {
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7981
  assert(VM_Version::supports_bmi2(), "bit manipulation instructions not supported");
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7982
  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7983
  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F_3A, &attributes);
26434
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7984
  emit_int8((unsigned char)0xF0);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7985
  emit_int8((unsigned char)(0xC0 | encode));
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7986
  emit_int8(imm8);
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7987
}
09ad55e5f486 8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents: 25932
diff changeset
  7988
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7989
void Assembler::sarq(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7990
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7991
  int encode = prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7992
  if (imm8 == 1) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7993
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7994
    emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7995
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7996
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7997
    emit_int8((unsigned char)(0xF8 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  7998
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  7999
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8000
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8001
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8002
void Assembler::sarq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8003
  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
  8004
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8005
  emit_int8((unsigned char)(0xF8 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8006
}
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  8007
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8008
void Assembler::sbbq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8009
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8010
  prefixq(dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8011
  emit_arith_operand(0x81, rbx, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8012
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8013
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8014
void Assembler::sbbq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8015
  (void) prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8016
  emit_arith(0x81, 0xD8, dst, imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8017
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8018
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8019
void Assembler::sbbq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8020
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8021
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8022
  emit_int8(0x1B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8023
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8024
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8025
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8026
void Assembler::sbbq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8027
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8028
  emit_arith(0x1B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8029
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8030
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8031
void Assembler::shlq(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8032
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8033
  int encode = prefixq_and_encode(dst->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8034
  if (imm8 == 1) {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8035
    emit_int8((unsigned char)0xD1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8036
    emit_int8((unsigned char)(0xE0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8037
  } else {
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8038
    emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8039
    emit_int8((unsigned char)(0xE0 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8040
    emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8041
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8042
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8043
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8044
void Assembler::shlq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8045
  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
  8046
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8047
  emit_int8((unsigned char)(0xE0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8048
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8049
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8050
void Assembler::shrq(Register dst, int imm8) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8051
  assert(isShiftCount(imm8 >> 1), "illegal shift count");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8052
  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
  8053
  emit_int8((unsigned char)0xC1);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8054
  emit_int8((unsigned char)(0xE8 | encode));
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8055
  emit_int8(imm8);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8056
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8057
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8058
void Assembler::shrq(Register dst) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8059
  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
  8060
  emit_int8((unsigned char)0xD3);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8061
  emit_int8(0xE8 | encode);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8062
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8063
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8064
void Assembler::subq(Address dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8065
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8066
  prefixq(dst);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  8067
  emit_arith_operand(0x81, rbp, dst, imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8068
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8069
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8070
void Assembler::subq(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8071
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8072
  prefixq(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8073
  emit_int8(0x29);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8074
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8075
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8076
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  8077
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
  8078
  (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
  8079
  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
  8080
}
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7439
diff changeset
  8081
11791
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  8082
// 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
  8083
void Assembler::subq_imm32(Register dst, int32_t imm32) {
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  8084
  (void) prefixq_and_encode(dst->encoding());
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  8085
  emit_arith_imm32(0x81, 0xE8, dst, imm32);
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  8086
}
3be8cae67887 7125136: SIGILL on linux amd64 in gc/ArrayJuggle/Juggle29
kvn
parents: 11438
diff changeset
  8087
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8088
void Assembler::subq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8089
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8090
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8091
  emit_int8(0x2B);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8092
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8093
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8094
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8095
void Assembler::subq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8096
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8097
  emit_arith(0x2B, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8098
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8099
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8100
void Assembler::testq(Register dst, int32_t imm32) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8101
  // not using emit_arith because test
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8102
  // doesn't support sign-extension of
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8103
  // 8bit operands
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8104
  int encode = dst->encoding();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8105
  if (encode == 0) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8106
    prefix(REX_W);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8107
    emit_int8((unsigned char)0xA9);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8108
  } else {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8109
    encode = prefixq_and_encode(encode);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8110
    emit_int8((unsigned char)0xF7);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8111
    emit_int8((unsigned char)(0xC0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8112
  }
15116
af423dcb739c 8004537: replace AbstractAssembler emit_long with emit_int32
twisti
parents: 15115
diff changeset
  8113
  emit_int32(imm32);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8114
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8115
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8116
void Assembler::testq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8117
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8118
  emit_arith(0x85, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8119
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8120
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8121
void Assembler::xaddq(Address dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8122
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8123
  prefixq(dst, src);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8124
  emit_int8(0x0F);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8125
  emit_int8((unsigned char)0xC1);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8126
  emit_operand(src, dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8127
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8128
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8129
void Assembler::xchgq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8130
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8131
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8132
  emit_int8((unsigned char)0x87);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8133
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8134
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8135
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8136
void Assembler::xchgq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8137
  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
  8138
  emit_int8((unsigned char)0x87);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8139
  emit_int8((unsigned char)(0xc0 | encode));
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8140
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8141
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8142
void Assembler::xorq(Register dst, Register src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8143
  (void) prefixq_and_encode(dst->encoding(), src->encoding());
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8144
  emit_arith(0x33, 0xC0, dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8145
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8146
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8147
void Assembler::xorq(Register dst, Address src) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8148
  InstructionMark im(this);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8149
  prefixq(src, dst);
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 14834
diff changeset
  8150
  emit_int8(0x33);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8151
  emit_operand(dst, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8152
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8153
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  8154
#endif // !LP64