author | kbarrett |
Thu, 22 Jun 2017 20:47:22 -0400 | |
changeset 46560 | 388aa8d67c80 |
parent 46549 | 744e7a498dac |
child 46563 | cfca8fbb4051 |
permissions | -rw-r--r-- |
2111 | 1 |
/* |
44737
d090627aedb8
8178723: Workaround for failure of CRC32C intrinsic on x86 machines without CLMUL support (JDK-8178720)
zmajo
parents:
43936
diff
changeset
|
2 |
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
2111 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4430
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4430
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:
4430
diff
changeset
|
21 |
* questions. |
2111 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
14626
0cf4eccf130f
8003240: x86: move MacroAssembler into separate file
twisti
parents:
14394
diff
changeset
|
26 |
#include "asm/macroAssembler.hpp" |
0cf4eccf130f
8003240: x86: move MacroAssembler into separate file
twisti
parents:
14394
diff
changeset
|
27 |
#include "asm/macroAssembler.inline.hpp" |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
28 |
#include "logging/log.hpp" |
7397 | 29 |
#include "memory/resourceArea.hpp" |
46560
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46549
diff
changeset
|
30 |
#include "prims/jvm.h" |
7397 | 31 |
#include "runtime/java.hpp" |
25949 | 32 |
#include "runtime/os.hpp" |
7397 | 33 |
#include "runtime/stubCodeGenerator.hpp" |
34 |
#include "vm_version_x86.hpp" |
|
2111 | 35 |
|
36 |
||
37 |
int VM_Version::_cpu; |
|
38 |
int VM_Version::_model; |
|
39 |
int VM_Version::_stepping; |
|
35148 | 40 |
VM_Version::CpuidInfo VM_Version::_cpuid_info = { 0, }; |
2111 | 41 |
|
23487
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
42 |
// Address of instruction which causes SEGV |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
43 |
address VM_Version::_cpuinfo_segv_addr = 0; |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
44 |
// Address of instruction after the one which causes SEGV |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
45 |
address VM_Version::_cpuinfo_cont_addr = 0; |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
46 |
|
2111 | 47 |
static BufferBlob* stub_blob; |
30624 | 48 |
static const int stub_size = 1000; |
2111 | 49 |
|
50 |
extern "C" { |
|
23527
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
51 |
typedef void (*get_cpu_info_stub_t)(void*); |
2111 | 52 |
} |
23527
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
53 |
static get_cpu_info_stub_t get_cpu_info_stub = NULL; |
2111 | 54 |
|
55 |
||
56 |
class VM_Version_StubGenerator: public StubCodeGenerator { |
|
57 |
public: |
|
58 |
||
59 |
VM_Version_StubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {} |
|
60 |
||
23527
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
61 |
address generate_get_cpu_info() { |
2111 | 62 |
// Flags to test CPU type. |
30624 | 63 |
const uint32_t HS_EFL_AC = 0x40000; |
64 |
const uint32_t HS_EFL_ID = 0x200000; |
|
2111 | 65 |
// Values for when we don't have a CPUID instruction. |
66 |
const int CPU_FAMILY_SHIFT = 8; |
|
30624 | 67 |
const uint32_t CPU_FAMILY_386 = (3 << CPU_FAMILY_SHIFT); |
68 |
const uint32_t CPU_FAMILY_486 = (4 << CPU_FAMILY_SHIFT); |
|
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
69 |
bool use_evex = FLAG_IS_DEFAULT(UseAVX) || (UseAVX > 2); |
2111 | 70 |
|
5902 | 71 |
Label detect_486, cpu486, detect_586, std_cpuid1, std_cpuid4; |
30624 | 72 |
Label sef_cpuid, ext_cpuid, ext_cpuid1, ext_cpuid5, ext_cpuid7, done, wrapup; |
73 |
Label legacy_setup, save_restore_except, legacy_save_restore, start_simd_check; |
|
2111 | 74 |
|
23527
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
75 |
StubCodeMark mark(this, "VM_Version", "get_cpu_info_stub"); |
2111 | 76 |
# define __ _masm-> |
77 |
||
78 |
address start = __ pc(); |
|
79 |
||
80 |
// |
|
23527
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
81 |
// void get_cpu_info(VM_Version::CpuidInfo* cpuid_info); |
2111 | 82 |
// |
83 |
// LP64: rcx and rdx are first and second argument registers on windows |
|
84 |
||
85 |
__ push(rbp); |
|
86 |
#ifdef _LP64 |
|
87 |
__ mov(rbp, c_rarg0); // cpuid_info address |
|
88 |
#else |
|
89 |
__ movptr(rbp, Address(rsp, 8)); // cpuid_info address |
|
90 |
#endif |
|
91 |
__ push(rbx); |
|
92 |
__ push(rsi); |
|
93 |
__ pushf(); // preserve rbx, and flags |
|
94 |
__ pop(rax); |
|
95 |
__ push(rax); |
|
96 |
__ mov(rcx, rax); |
|
97 |
// |
|
98 |
// if we are unable to change the AC flag, we have a 386 |
|
99 |
// |
|
11881
9642744ae9a5
7132070: Use a mach_port_t as the OSThread thread_id rather than pthread_t on BSD/OSX
sla
parents:
11439
diff
changeset
|
100 |
__ xorl(rax, HS_EFL_AC); |
2111 | 101 |
__ push(rax); |
102 |
__ popf(); |
|
103 |
__ pushf(); |
|
104 |
__ pop(rax); |
|
105 |
__ cmpptr(rax, rcx); |
|
106 |
__ jccb(Assembler::notEqual, detect_486); |
|
107 |
||
108 |
__ movl(rax, CPU_FAMILY_386); |
|
109 |
__ movl(Address(rbp, in_bytes(VM_Version::std_cpuid1_offset())), rax); |
|
110 |
__ jmp(done); |
|
111 |
||
112 |
// |
|
113 |
// If we are unable to change the ID flag, we have a 486 which does |
|
114 |
// not support the "cpuid" instruction. |
|
115 |
// |
|
116 |
__ bind(detect_486); |
|
117 |
__ mov(rax, rcx); |
|
11881
9642744ae9a5
7132070: Use a mach_port_t as the OSThread thread_id rather than pthread_t on BSD/OSX
sla
parents:
11439
diff
changeset
|
118 |
__ xorl(rax, HS_EFL_ID); |
2111 | 119 |
__ push(rax); |
120 |
__ popf(); |
|
121 |
__ pushf(); |
|
122 |
__ pop(rax); |
|
123 |
__ cmpptr(rcx, rax); |
|
124 |
__ jccb(Assembler::notEqual, detect_586); |
|
125 |
||
126 |
__ bind(cpu486); |
|
127 |
__ movl(rax, CPU_FAMILY_486); |
|
128 |
__ movl(Address(rbp, in_bytes(VM_Version::std_cpuid1_offset())), rax); |
|
129 |
__ jmp(done); |
|
130 |
||
131 |
// |
|
132 |
// At this point, we have a chip which supports the "cpuid" instruction |
|
133 |
// |
|
134 |
__ bind(detect_586); |
|
135 |
__ xorl(rax, rax); |
|
136 |
__ cpuid(); |
|
137 |
__ orl(rax, rax); |
|
138 |
__ jcc(Assembler::equal, cpu486); // if cpuid doesn't support an input |
|
139 |
// value of at least 1, we give up and |
|
140 |
// assume a 486 |
|
141 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::std_cpuid0_offset()))); |
|
142 |
__ movl(Address(rsi, 0), rax); |
|
143 |
__ movl(Address(rsi, 4), rbx); |
|
144 |
__ movl(Address(rsi, 8), rcx); |
|
145 |
__ movl(Address(rsi,12), rdx); |
|
146 |
||
5902 | 147 |
__ cmpl(rax, 0xa); // Is cpuid(0xB) supported? |
148 |
__ jccb(Assembler::belowEqual, std_cpuid4); |
|
149 |
||
150 |
// |
|
151 |
// cpuid(0xB) Processor Topology |
|
152 |
// |
|
153 |
__ movl(rax, 0xb); |
|
154 |
__ xorl(rcx, rcx); // Threads level |
|
155 |
__ cpuid(); |
|
156 |
||
157 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::tpl_cpuidB0_offset()))); |
|
158 |
__ movl(Address(rsi, 0), rax); |
|
159 |
__ movl(Address(rsi, 4), rbx); |
|
160 |
__ movl(Address(rsi, 8), rcx); |
|
161 |
__ movl(Address(rsi,12), rdx); |
|
162 |
||
163 |
__ movl(rax, 0xb); |
|
164 |
__ movl(rcx, 1); // Cores level |
|
165 |
__ cpuid(); |
|
166 |
__ push(rax); |
|
167 |
__ andl(rax, 0x1f); // Determine if valid topology level |
|
168 |
__ orl(rax, rbx); // eax[4:0] | ebx[0:15] == 0 indicates invalid level |
|
169 |
__ andl(rax, 0xffff); |
|
170 |
__ pop(rax); |
|
171 |
__ jccb(Assembler::equal, std_cpuid4); |
|
172 |
||
173 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::tpl_cpuidB1_offset()))); |
|
174 |
__ movl(Address(rsi, 0), rax); |
|
175 |
__ movl(Address(rsi, 4), rbx); |
|
176 |
__ movl(Address(rsi, 8), rcx); |
|
177 |
__ movl(Address(rsi,12), rdx); |
|
178 |
||
179 |
__ movl(rax, 0xb); |
|
180 |
__ movl(rcx, 2); // Packages level |
|
181 |
__ cpuid(); |
|
182 |
__ push(rax); |
|
183 |
__ andl(rax, 0x1f); // Determine if valid topology level |
|
184 |
__ orl(rax, rbx); // eax[4:0] | ebx[0:15] == 0 indicates invalid level |
|
185 |
__ andl(rax, 0xffff); |
|
186 |
__ pop(rax); |
|
187 |
__ jccb(Assembler::equal, std_cpuid4); |
|
188 |
||
189 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::tpl_cpuidB2_offset()))); |
|
190 |
__ movl(Address(rsi, 0), rax); |
|
191 |
__ movl(Address(rsi, 4), rbx); |
|
192 |
__ movl(Address(rsi, 8), rcx); |
|
193 |
__ movl(Address(rsi,12), rdx); |
|
2111 | 194 |
|
195 |
// |
|
196 |
// cpuid(0x4) Deterministic cache params |
|
197 |
// |
|
5902 | 198 |
__ bind(std_cpuid4); |
2111 | 199 |
__ movl(rax, 4); |
5902 | 200 |
__ cmpl(rax, Address(rbp, in_bytes(VM_Version::std_cpuid0_offset()))); // Is cpuid(0x4) supported? |
201 |
__ jccb(Assembler::greater, std_cpuid1); |
|
202 |
||
2111 | 203 |
__ xorl(rcx, rcx); // L1 cache |
204 |
__ cpuid(); |
|
205 |
__ push(rax); |
|
206 |
__ andl(rax, 0x1f); // Determine if valid cache parameters used |
|
207 |
__ orl(rax, rax); // eax[4:0] == 0 indicates invalid cache |
|
208 |
__ pop(rax); |
|
209 |
__ jccb(Assembler::equal, std_cpuid1); |
|
210 |
||
211 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::dcp_cpuid4_offset()))); |
|
212 |
__ movl(Address(rsi, 0), rax); |
|
213 |
__ movl(Address(rsi, 4), rbx); |
|
214 |
__ movl(Address(rsi, 8), rcx); |
|
215 |
__ movl(Address(rsi,12), rdx); |
|
216 |
||
217 |
// |
|
218 |
// Standard cpuid(0x1) |
|
219 |
// |
|
220 |
__ bind(std_cpuid1); |
|
221 |
__ movl(rax, 1); |
|
222 |
__ cpuid(); |
|
223 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::std_cpuid1_offset()))); |
|
224 |
__ movl(Address(rsi, 0), rax); |
|
225 |
__ movl(Address(rsi, 4), rbx); |
|
226 |
__ movl(Address(rsi, 8), rcx); |
|
227 |
__ movl(Address(rsi,12), rdx); |
|
228 |
||
11427 | 229 |
// |
230 |
// Check if OS has enabled XGETBV instruction to access XCR0 |
|
231 |
// (OSXSAVE feature flag) and CPU supports AVX |
|
232 |
// |
|
23487
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
233 |
__ andl(rcx, 0x18000000); // cpuid1 bits osxsave | avx |
11427 | 234 |
__ cmpl(rcx, 0x18000000); |
23487
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
235 |
__ jccb(Assembler::notEqual, sef_cpuid); // jump if AVX is not supported |
11427 | 236 |
|
237 |
// |
|
238 |
// XCR0, XFEATURE_ENABLED_MASK register |
|
239 |
// |
|
240 |
__ xorl(rcx, rcx); // zero for XCR0 register |
|
241 |
__ xgetbv(); |
|
242 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::xem_xcr0_offset()))); |
|
243 |
__ movl(Address(rsi, 0), rax); |
|
244 |
__ movl(Address(rsi, 4), rdx); |
|
245 |
||
246 |
// |
|
247 |
// cpuid(0x7) Structured Extended Features |
|
248 |
// |
|
249 |
__ bind(sef_cpuid); |
|
250 |
__ movl(rax, 7); |
|
251 |
__ cmpl(rax, Address(rbp, in_bytes(VM_Version::std_cpuid0_offset()))); // Is cpuid(0x7) supported? |
|
252 |
__ jccb(Assembler::greater, ext_cpuid); |
|
253 |
||
254 |
__ xorl(rcx, rcx); |
|
255 |
__ cpuid(); |
|
256 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::sef_cpuid7_offset()))); |
|
257 |
__ movl(Address(rsi, 0), rax); |
|
258 |
__ movl(Address(rsi, 4), rbx); |
|
259 |
||
260 |
// |
|
261 |
// Extended cpuid(0x80000000) |
|
262 |
// |
|
263 |
__ bind(ext_cpuid); |
|
2111 | 264 |
__ movl(rax, 0x80000000); |
265 |
__ cpuid(); |
|
266 |
__ cmpl(rax, 0x80000000); // Is cpuid(0x80000001) supported? |
|
267 |
__ jcc(Assembler::belowEqual, done); |
|
268 |
__ cmpl(rax, 0x80000004); // Is cpuid(0x80000005) supported? |
|
269 |
__ jccb(Assembler::belowEqual, ext_cpuid1); |
|
11417
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
270 |
__ cmpl(rax, 0x80000006); // Is cpuid(0x80000007) supported? |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
271 |
__ jccb(Assembler::belowEqual, ext_cpuid5); |
2111 | 272 |
__ cmpl(rax, 0x80000007); // Is cpuid(0x80000008) supported? |
11417
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
273 |
__ jccb(Assembler::belowEqual, ext_cpuid7); |
2111 | 274 |
// |
275 |
// Extended cpuid(0x80000008) |
|
276 |
// |
|
277 |
__ movl(rax, 0x80000008); |
|
278 |
__ cpuid(); |
|
279 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::ext_cpuid8_offset()))); |
|
280 |
__ movl(Address(rsi, 0), rax); |
|
281 |
__ movl(Address(rsi, 4), rbx); |
|
282 |
__ movl(Address(rsi, 8), rcx); |
|
283 |
__ movl(Address(rsi,12), rdx); |
|
284 |
||
285 |
// |
|
11417
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
286 |
// Extended cpuid(0x80000007) |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
287 |
// |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
288 |
__ bind(ext_cpuid7); |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
289 |
__ movl(rax, 0x80000007); |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
290 |
__ cpuid(); |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
291 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::ext_cpuid7_offset()))); |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
292 |
__ movl(Address(rsi, 0), rax); |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
293 |
__ movl(Address(rsi, 4), rbx); |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
294 |
__ movl(Address(rsi, 8), rcx); |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
295 |
__ movl(Address(rsi,12), rdx); |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
296 |
|
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
297 |
// |
2111 | 298 |
// Extended cpuid(0x80000005) |
299 |
// |
|
300 |
__ bind(ext_cpuid5); |
|
301 |
__ movl(rax, 0x80000005); |
|
302 |
__ cpuid(); |
|
303 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::ext_cpuid5_offset()))); |
|
304 |
__ movl(Address(rsi, 0), rax); |
|
305 |
__ movl(Address(rsi, 4), rbx); |
|
306 |
__ movl(Address(rsi, 8), rcx); |
|
307 |
__ movl(Address(rsi,12), rdx); |
|
308 |
||
309 |
// |
|
310 |
// Extended cpuid(0x80000001) |
|
311 |
// |
|
312 |
__ bind(ext_cpuid1); |
|
313 |
__ movl(rax, 0x80000001); |
|
314 |
__ cpuid(); |
|
315 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::ext_cpuid1_offset()))); |
|
316 |
__ movl(Address(rsi, 0), rax); |
|
317 |
__ movl(Address(rsi, 4), rbx); |
|
318 |
__ movl(Address(rsi, 8), rcx); |
|
319 |
__ movl(Address(rsi,12), rdx); |
|
320 |
||
321 |
// |
|
30624 | 322 |
// Check if OS has enabled XGETBV instruction to access XCR0 |
323 |
// (OSXSAVE feature flag) and CPU supports AVX |
|
324 |
// |
|
325 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::std_cpuid1_offset()))); |
|
326 |
__ movl(rcx, 0x18000000); // cpuid1 bits osxsave | avx |
|
327 |
__ andl(rcx, Address(rsi, 8)); // cpuid1 bits osxsave | avx |
|
328 |
__ cmpl(rcx, 0x18000000); |
|
329 |
__ jccb(Assembler::notEqual, done); // jump if AVX is not supported |
|
330 |
||
331 |
__ movl(rax, 0x6); |
|
332 |
__ andl(rax, Address(rbp, in_bytes(VM_Version::xem_xcr0_offset()))); // xcr0 bits sse | ymm |
|
333 |
__ cmpl(rax, 0x6); |
|
334 |
__ jccb(Assembler::equal, start_simd_check); // return if AVX is not supported |
|
335 |
||
336 |
// we need to bridge farther than imm8, so we use this island as a thunk |
|
337 |
__ bind(done); |
|
338 |
__ jmp(wrapup); |
|
339 |
||
340 |
__ bind(start_simd_check); |
|
341 |
// |
|
342 |
// Some OSs have a bug when upper 128/256bits of YMM/ZMM |
|
343 |
// registers are not restored after a signal processing. |
|
344 |
// Generate SEGV here (reference through NULL) |
|
345 |
// and check upper YMM/ZMM bits after it. |
|
2111 | 346 |
// |
30624 | 347 |
intx saved_useavx = UseAVX; |
348 |
intx saved_usesse = UseSSE; |
|
349 |
// check _cpuid_info.sef_cpuid7_ebx.bits.avx512f |
|
350 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::sef_cpuid7_offset()))); |
|
351 |
__ movl(rax, 0x10000); |
|
352 |
__ andl(rax, Address(rsi, 4)); // xcr0 bits sse | ymm |
|
353 |
__ cmpl(rax, 0x10000); |
|
354 |
__ jccb(Assembler::notEqual, legacy_setup); // jump if EVEX is not supported |
|
355 |
// check _cpuid_info.xem_xcr0_eax.bits.opmask |
|
356 |
// check _cpuid_info.xem_xcr0_eax.bits.zmm512 |
|
357 |
// check _cpuid_info.xem_xcr0_eax.bits.zmm32 |
|
358 |
__ movl(rax, 0xE0); |
|
359 |
__ andl(rax, Address(rbp, in_bytes(VM_Version::xem_xcr0_offset()))); // xcr0 bits sse | ymm |
|
360 |
__ cmpl(rax, 0xE0); |
|
361 |
__ jccb(Assembler::notEqual, legacy_setup); // jump if EVEX is not supported |
|
362 |
||
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
363 |
// If UseAVX is unitialized or is set by the user to include EVEX |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
364 |
if (use_evex) { |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
365 |
// EVEX setup: run in lowest evex mode |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
366 |
VM_Version::set_evex_cpuFeatures(); // Enable temporary to pass asserts |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
367 |
UseAVX = 3; |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
368 |
UseSSE = 2; |
42076
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
369 |
#ifdef _WINDOWS |
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
370 |
// xmm5-xmm15 are not preserved by caller on windows |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
371 |
// https://msdn.microsoft.com/en-us/library/9z1stfyw.aspx |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
372 |
__ subptr(rsp, 64); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
373 |
__ evmovdqul(Address(rsp, 0), xmm7, Assembler::AVX_512bit); |
42076
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
374 |
#ifdef _LP64 |
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
375 |
__ subptr(rsp, 64); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
376 |
__ evmovdqul(Address(rsp, 0), xmm8, Assembler::AVX_512bit); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
377 |
__ subptr(rsp, 64); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
378 |
__ evmovdqul(Address(rsp, 0), xmm31, Assembler::AVX_512bit); |
42076
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
379 |
#endif // _LP64 |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
380 |
#endif // _WINDOWS |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
381 |
|
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
382 |
// load value into all 64 bytes of zmm7 register |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
383 |
__ movl(rcx, VM_Version::ymm_test_value()); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
384 |
__ movdl(xmm0, rcx); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
385 |
__ movl(rcx, 0xffff); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
386 |
__ kmovwl(k1, rcx); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
387 |
__ evpbroadcastd(xmm0, xmm0, Assembler::AVX_512bit); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
388 |
__ evmovdqul(xmm7, xmm0, Assembler::AVX_512bit); |
30624 | 389 |
#ifdef _LP64 |
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
390 |
__ evmovdqul(xmm8, xmm0, Assembler::AVX_512bit); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
391 |
__ evmovdqul(xmm31, xmm0, Assembler::AVX_512bit); |
30624 | 392 |
#endif |
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
393 |
VM_Version::clean_cpuFeatures(); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
394 |
__ jmp(save_restore_except); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
395 |
} |
30624 | 396 |
|
397 |
__ bind(legacy_setup); |
|
398 |
// AVX setup |
|
399 |
VM_Version::set_avx_cpuFeatures(); // Enable temporary to pass asserts |
|
400 |
UseAVX = 1; |
|
401 |
UseSSE = 2; |
|
42076
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
402 |
#ifdef _WINDOWS |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
403 |
__ subptr(rsp, 32); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
404 |
__ vmovdqu(Address(rsp, 0), xmm7); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
405 |
#ifdef _LP64 |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
406 |
__ subptr(rsp, 32); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
407 |
__ vmovdqu(Address(rsp, 0), xmm8); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
408 |
__ subptr(rsp, 32); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
409 |
__ vmovdqu(Address(rsp, 0), xmm15); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
410 |
#endif // _LP64 |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
411 |
#endif // _WINDOWS |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
412 |
|
30624 | 413 |
// load value into all 32 bytes of ymm7 register |
414 |
__ movl(rcx, VM_Version::ymm_test_value()); |
|
415 |
||
416 |
__ movdl(xmm0, rcx); |
|
417 |
__ pshufd(xmm0, xmm0, 0x00); |
|
36561
b18243f4d955
8151002: Make Assembler methods vextract and vinsert match actual instructions
mikael
parents:
36555
diff
changeset
|
418 |
__ vinsertf128_high(xmm0, xmm0); |
30624 | 419 |
__ vmovdqu(xmm7, xmm0); |
420 |
#ifdef _LP64 |
|
421 |
__ vmovdqu(xmm8, xmm0); |
|
422 |
__ vmovdqu(xmm15, xmm0); |
|
423 |
#endif |
|
424 |
VM_Version::clean_cpuFeatures(); |
|
425 |
||
426 |
__ bind(save_restore_except); |
|
427 |
__ xorl(rsi, rsi); |
|
428 |
VM_Version::set_cpuinfo_segv_addr(__ pc()); |
|
429 |
// Generate SEGV |
|
430 |
__ movl(rax, Address(rsi, 0)); |
|
431 |
||
432 |
VM_Version::set_cpuinfo_cont_addr(__ pc()); |
|
433 |
// Returns here after signal. Save xmm0 to check it later. |
|
434 |
||
435 |
// check _cpuid_info.sef_cpuid7_ebx.bits.avx512f |
|
436 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::sef_cpuid7_offset()))); |
|
437 |
__ movl(rax, 0x10000); |
|
438 |
__ andl(rax, Address(rsi, 4)); |
|
439 |
__ cmpl(rax, 0x10000); |
|
46440
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
440 |
__ jcc(Assembler::notEqual, legacy_save_restore); |
30624 | 441 |
// check _cpuid_info.xem_xcr0_eax.bits.opmask |
442 |
// check _cpuid_info.xem_xcr0_eax.bits.zmm512 |
|
443 |
// check _cpuid_info.xem_xcr0_eax.bits.zmm32 |
|
444 |
__ movl(rax, 0xE0); |
|
445 |
__ andl(rax, Address(rbp, in_bytes(VM_Version::xem_xcr0_offset()))); // xcr0 bits sse | ymm |
|
446 |
__ cmpl(rax, 0xE0); |
|
46440
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
447 |
__ jcc(Assembler::notEqual, legacy_save_restore); |
30624 | 448 |
|
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
449 |
// If UseAVX is unitialized or is set by the user to include EVEX |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
450 |
if (use_evex) { |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
451 |
// EVEX check: run in lowest evex mode |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
452 |
VM_Version::set_evex_cpuFeatures(); // Enable temporary to pass asserts |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
453 |
UseAVX = 3; |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
454 |
UseSSE = 2; |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
455 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::zmm_save_offset()))); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
456 |
__ evmovdqul(Address(rsi, 0), xmm0, Assembler::AVX_512bit); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
457 |
__ evmovdqul(Address(rsi, 64), xmm7, Assembler::AVX_512bit); |
30624 | 458 |
#ifdef _LP64 |
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
459 |
__ evmovdqul(Address(rsi, 128), xmm8, Assembler::AVX_512bit); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
460 |
__ evmovdqul(Address(rsi, 192), xmm31, Assembler::AVX_512bit); |
30624 | 461 |
#endif |
42076
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
462 |
|
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
463 |
#ifdef _WINDOWS |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
464 |
#ifdef _LP64 |
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
465 |
__ evmovdqul(xmm31, Address(rsp, 0), Assembler::AVX_512bit); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
466 |
__ addptr(rsp, 64); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
467 |
__ evmovdqul(xmm8, Address(rsp, 0), Assembler::AVX_512bit); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
468 |
__ addptr(rsp, 64); |
42076
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
469 |
#endif // _LP64 |
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
470 |
__ evmovdqul(xmm7, Address(rsp, 0), Assembler::AVX_512bit); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
471 |
__ addptr(rsp, 64); |
42076
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
472 |
#endif // _WINDOWS |
46440
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
473 |
generate_vzeroupper(wrapup); |
42586
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
474 |
VM_Version::clean_cpuFeatures(); |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
475 |
UseAVX = saved_useavx; |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
476 |
UseSSE = saved_usesse; |
e14fee6a1839
8170039: Change UseAVX < 3 on SKX/KNL to not emit evex vector check
mcberg
parents:
42076
diff
changeset
|
477 |
__ jmp(wrapup); |
46440
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
478 |
} |
30624 | 479 |
|
480 |
__ bind(legacy_save_restore); |
|
481 |
// AVX check |
|
482 |
VM_Version::set_avx_cpuFeatures(); // Enable temporary to pass asserts |
|
483 |
UseAVX = 1; |
|
484 |
UseSSE = 2; |
|
485 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::ymm_save_offset()))); |
|
486 |
__ vmovdqu(Address(rsi, 0), xmm0); |
|
487 |
__ vmovdqu(Address(rsi, 32), xmm7); |
|
488 |
#ifdef _LP64 |
|
489 |
__ vmovdqu(Address(rsi, 64), xmm8); |
|
490 |
__ vmovdqu(Address(rsi, 96), xmm15); |
|
491 |
#endif |
|
42076
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
492 |
|
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
493 |
#ifdef _WINDOWS |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
494 |
#ifdef _LP64 |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
495 |
__ vmovdqu(xmm15, Address(rsp, 0)); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
496 |
__ addptr(rsp, 32); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
497 |
__ vmovdqu(xmm8, Address(rsp, 0)); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
498 |
__ addptr(rsp, 32); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
499 |
#endif // _LP64 |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
500 |
__ vmovdqu(xmm7, Address(rsp, 0)); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
501 |
__ addptr(rsp, 32); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
42039
diff
changeset
|
502 |
#endif // _WINDOWS |
46440
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
503 |
generate_vzeroupper(wrapup); |
30624 | 504 |
VM_Version::clean_cpuFeatures(); |
505 |
UseAVX = saved_useavx; |
|
506 |
UseSSE = saved_usesse; |
|
507 |
||
508 |
__ bind(wrapup); |
|
2111 | 509 |
__ popf(); |
510 |
__ pop(rsi); |
|
511 |
__ pop(rbx); |
|
512 |
__ pop(rbp); |
|
513 |
__ ret(0); |
|
514 |
||
515 |
# undef __ |
|
516 |
||
517 |
return start; |
|
518 |
}; |
|
46440
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
519 |
void generate_vzeroupper(Label& L_wrapup) { |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
520 |
# define __ _masm-> |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
521 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::std_cpuid0_offset()))); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
522 |
__ cmpl(Address(rsi, 4), 0x756e6547); // 'uneG' |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
523 |
__ jcc(Assembler::notEqual, L_wrapup); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
524 |
__ movl(rcx, 0x0FFF0FF0); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
525 |
__ lea(rsi, Address(rbp, in_bytes(VM_Version::std_cpuid1_offset()))); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
526 |
__ andl(rcx, Address(rsi, 0)); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
527 |
__ cmpl(rcx, 0x00050670); // If it is Xeon Phi 3200/5200/7200 |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
528 |
__ jcc(Assembler::equal, L_wrapup); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
529 |
__ cmpl(rcx, 0x00080650); // If it is Future Xeon Phi |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
530 |
__ jcc(Assembler::equal, L_wrapup); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
531 |
__ vzeroupper(); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
532 |
# undef __ |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
533 |
} |
2111 | 534 |
}; |
535 |
||
536 |
void VM_Version::get_processor_features() { |
|
537 |
||
538 |
_cpu = 4; // 486 by default |
|
539 |
_model = 0; |
|
540 |
_stepping = 0; |
|
35148 | 541 |
_features = 0; |
2111 | 542 |
_logical_processors_per_package = 1; |
25633
4cd9c4622c8c
8049717: expose L1_data_cache_line_size for diagnostic/sanity checks
dcubed
parents:
25468
diff
changeset
|
543 |
// i486 internal cache is both I&D and has a 16-byte line size |
4cd9c4622c8c
8049717: expose L1_data_cache_line_size for diagnostic/sanity checks
dcubed
parents:
25468
diff
changeset
|
544 |
_L1_data_cache_line_size = 16; |
2111 | 545 |
|
35102 | 546 |
// Get raw processor info |
23527
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
547 |
|
35102 | 548 |
get_cpu_info_stub(&_cpuid_info); |
23527
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
549 |
|
35102 | 550 |
assert_is_initialized(); |
551 |
_cpu = extended_cpu_family(); |
|
552 |
_model = extended_cpu_model(); |
|
553 |
_stepping = cpu_stepping(); |
|
2111 | 554 |
|
35102 | 555 |
if (cpu_family() > 4) { // it supports CPUID |
35148 | 556 |
_features = feature_flags(); |
35102 | 557 |
// Logical processors are only available on P4s and above, |
558 |
// and only if hyperthreading is available. |
|
559 |
_logical_processors_per_package = logical_processor_count(); |
|
560 |
_L1_data_cache_line_size = L1_line_size(); |
|
2111 | 561 |
} |
562 |
||
563 |
_supports_cx8 = supports_cmpxchg8(); |
|
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13885
diff
changeset
|
564 |
// xchg and xadd instructions |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13885
diff
changeset
|
565 |
_supports_atomic_getset4 = true; |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13885
diff
changeset
|
566 |
_supports_atomic_getadd4 = true; |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13885
diff
changeset
|
567 |
LP64_ONLY(_supports_atomic_getset8 = true); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13885
diff
changeset
|
568 |
LP64_ONLY(_supports_atomic_getadd8 = true); |
2111 | 569 |
|
570 |
#ifdef _LP64 |
|
571 |
// OS should support SSE for x64 and hardware should support at least SSE2. |
|
572 |
if (!VM_Version::supports_sse2()) { |
|
573 |
vm_exit_during_initialization("Unknown x64 processor: SSE2 not supported"); |
|
574 |
} |
|
4430 | 575 |
// in 64 bit the use of SSE2 is the minimum |
576 |
if (UseSSE < 2) UseSSE = 2; |
|
2111 | 577 |
#endif |
578 |
||
10010
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
579 |
#ifdef AMD64 |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
580 |
// flush_icache_stub have to be generated first. |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
581 |
// That is why Icache line size is hard coded in ICache class, |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
582 |
// see icache_x86.hpp. It is also the reason why we can't use |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
583 |
// clflush instruction in 32-bit VM since it could be running |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
584 |
// on CPU which does not support it. |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
585 |
// |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
586 |
// The only thing we can do is to verify that flushed |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
587 |
// ICache::line_size has correct value. |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
588 |
guarantee(_cpuid_info.std_cpuid1_edx.bits.clflush != 0, "clflush is not supported"); |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
589 |
// clflush_size is size in quadwords (8 bytes). |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
590 |
guarantee(_cpuid_info.std_cpuid1_ebx.bits.clflush_size == 8, "such clflush size is not supported"); |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
591 |
#endif |
72de7c910672
6990015: Incorrect Icache line size is used for 64 bit x86
kvn
parents:
9325
diff
changeset
|
592 |
|
2111 | 593 |
// If the OS doesn't support SSE, we can't use this feature even if the HW does |
594 |
if (!os::supports_sse()) |
|
35148 | 595 |
_features &= ~(CPU_SSE|CPU_SSE2|CPU_SSE3|CPU_SSSE3|CPU_SSE4A|CPU_SSE4_1|CPU_SSE4_2); |
2111 | 596 |
|
597 |
if (UseSSE < 4) { |
|
35148 | 598 |
_features &= ~CPU_SSE4_1; |
599 |
_features &= ~CPU_SSE4_2; |
|
2111 | 600 |
} |
601 |
||
602 |
if (UseSSE < 3) { |
|
35148 | 603 |
_features &= ~CPU_SSE3; |
604 |
_features &= ~CPU_SSSE3; |
|
605 |
_features &= ~CPU_SSE4A; |
|
2111 | 606 |
} |
607 |
||
608 |
if (UseSSE < 2) |
|
35148 | 609 |
_features &= ~CPU_SSE2; |
2111 | 610 |
|
611 |
if (UseSSE < 1) |
|
35148 | 612 |
_features &= ~CPU_SSE; |
2111 | 613 |
|
30624 | 614 |
// first try initial setting and detect what we can support |
615 |
if (UseAVX > 0) { |
|
616 |
if (UseAVX > 2 && supports_evex()) { |
|
617 |
UseAVX = 3; |
|
618 |
} else if (UseAVX > 1 && supports_avx2()) { |
|
619 |
UseAVX = 2; |
|
620 |
} else if (UseAVX > 0 && supports_avx()) { |
|
621 |
UseAVX = 1; |
|
622 |
} else { |
|
623 |
UseAVX = 0; |
|
624 |
} |
|
625 |
} else if (UseAVX < 0) { |
|
626 |
UseAVX = 0; |
|
627 |
} |
|
628 |
||
629 |
if (UseAVX < 3) { |
|
35148 | 630 |
_features &= ~CPU_AVX512F; |
631 |
_features &= ~CPU_AVX512DQ; |
|
632 |
_features &= ~CPU_AVX512CD; |
|
633 |
_features &= ~CPU_AVX512BW; |
|
634 |
_features &= ~CPU_AVX512VL; |
|
30624 | 635 |
} |
636 |
||
11427 | 637 |
if (UseAVX < 2) |
35148 | 638 |
_features &= ~CPU_AVX2; |
11427 | 639 |
|
46440
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
640 |
if (UseAVX < 1) { |
35148 | 641 |
_features &= ~CPU_AVX; |
46440
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
642 |
_features &= ~CPU_VZEROUPPER; |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
643 |
} |
11427 | 644 |
|
2111 | 645 |
if (logical_processors_per_package() == 1) { |
646 |
// HT processor could be installed on a system which doesn't support HT. |
|
35148 | 647 |
_features &= ~CPU_HT; |
2111 | 648 |
} |
649 |
||
46440
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
650 |
if( is_intel() ) { // Intel cpus specific settings |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
651 |
if ((cpu_family() == 0x06) && |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
652 |
((extended_cpu_model() == 0x57) || // Xeon Phi 3200/5200/7200 |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
653 |
(extended_cpu_model() == 0x85))) { // Future Xeon Phi |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
654 |
_features &= ~CPU_VZEROUPPER; |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
655 |
} |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
656 |
} |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
657 |
|
2111 | 658 |
char buf[256]; |
41323 | 659 |
jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", |
2111 | 660 |
cores_per_cpu(), threads_per_core(), |
661 |
cpu_family(), _model, _stepping, |
|
662 |
(supports_cmov() ? ", cmov" : ""), |
|
663 |
(supports_cmpxchg8() ? ", cx8" : ""), |
|
664 |
(supports_fxsr() ? ", fxsr" : ""), |
|
665 |
(supports_mmx() ? ", mmx" : ""), |
|
666 |
(supports_sse() ? ", sse" : ""), |
|
667 |
(supports_sse2() ? ", sse2" : ""), |
|
668 |
(supports_sse3() ? ", sse3" : ""), |
|
669 |
(supports_ssse3()? ", ssse3": ""), |
|
670 |
(supports_sse4_1() ? ", sse4.1" : ""), |
|
671 |
(supports_sse4_2() ? ", sse4.2" : ""), |
|
2255
54abdf3e1055
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
2111
diff
changeset
|
672 |
(supports_popcnt() ? ", popcnt" : ""), |
11427 | 673 |
(supports_avx() ? ", avx" : ""), |
674 |
(supports_avx2() ? ", avx2" : ""), |
|
14132 | 675 |
(supports_aes() ? ", aes" : ""), |
23491 | 676 |
(supports_clmul() ? ", clmul" : ""), |
15114
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
677 |
(supports_erms() ? ", erms" : ""), |
23491 | 678 |
(supports_rtm() ? ", rtm" : ""), |
2111 | 679 |
(supports_mmx_ext() ? ", mmxext" : ""), |
9135 | 680 |
(supports_3dnow_prefetch() ? ", 3dnowpref" : ""), |
2862
fad636edf18f
6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents:
2348
diff
changeset
|
681 |
(supports_lzcnt() ? ", lzcnt": ""), |
2111 | 682 |
(supports_sse4a() ? ", sse4a": ""), |
11417
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
683 |
(supports_ht() ? ", ht": ""), |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
684 |
(supports_tsc() ? ", tsc": ""), |
4ecc3253bec4
7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents:
10565
diff
changeset
|
685 |
(supports_tscinv_bit() ? ", tscinvbit": ""), |
23220
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
686 |
(supports_tscinv() ? ", tscinv": ""), |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
687 |
(supports_bmi1() ? ", bmi1" : ""), |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
688 |
(supports_bmi2() ? ", bmi2" : ""), |
30624 | 689 |
(supports_adx() ? ", adx" : ""), |
36555 | 690 |
(supports_evex() ? ", evex" : ""), |
41323 | 691 |
(supports_sha() ? ", sha" : ""), |
692 |
(supports_fma() ? ", fma" : "")); |
|
35148 | 693 |
_features_string = os::strdup(buf); |
2111 | 694 |
|
695 |
// UseSSE is set to the smaller of what hardware supports and what |
|
696 |
// the command line requires. I.e., you cannot set UseSSE to 2 on |
|
697 |
// older Pentiums which do not support it. |
|
11427 | 698 |
if (UseSSE > 4) UseSSE=4; |
699 |
if (UseSSE < 0) UseSSE=0; |
|
700 |
if (!supports_sse4_1()) // Drop to 3 if no SSE4 support |
|
2111 | 701 |
UseSSE = MIN2((intx)3,UseSSE); |
11427 | 702 |
if (!supports_sse3()) // Drop to 2 if no SSE3 support |
2111 | 703 |
UseSSE = MIN2((intx)2,UseSSE); |
11427 | 704 |
if (!supports_sse2()) // Drop to 1 if no SSE2 support |
2111 | 705 |
UseSSE = MIN2((intx)1,UseSSE); |
11427 | 706 |
if (!supports_sse ()) // Drop to 0 if no SSE support |
2111 | 707 |
UseSSE = 0; |
708 |
||
14132 | 709 |
// Use AES instructions if available. |
710 |
if (supports_aes()) { |
|
711 |
if (FLAG_IS_DEFAULT(UseAES)) { |
|
34176
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
712 |
FLAG_SET_DEFAULT(UseAES, true); |
14132 | 713 |
} |
34176
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
714 |
if (!UseAES) { |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
715 |
if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
716 |
warning("AES intrinsics require UseAES flag to be enabled. Intrinsics will be disabled."); |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
717 |
} |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
718 |
FLAG_SET_DEFAULT(UseAESIntrinsics, false); |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
719 |
} else { |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
720 |
if (UseSSE > 2) { |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
721 |
if (FLAG_IS_DEFAULT(UseAESIntrinsics)) { |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
722 |
FLAG_SET_DEFAULT(UseAESIntrinsics, true); |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
723 |
} |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
724 |
} else { |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
725 |
// The AES intrinsic stubs require AES instruction support (of course) |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
726 |
// but also require sse3 mode or higher for instructions it use. |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
727 |
if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
728 |
warning("X86 AES intrinsics require SSE3 instructions or higher. Intrinsics will be disabled."); |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
729 |
} |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
730 |
FLAG_SET_DEFAULT(UseAESIntrinsics, false); |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
731 |
} |
35154 | 732 |
|
733 |
// --AES-CTR begins-- |
|
734 |
if (!UseAESIntrinsics) { |
|
735 |
if (UseAESCTRIntrinsics && !FLAG_IS_DEFAULT(UseAESCTRIntrinsics)) { |
|
736 |
warning("AES-CTR intrinsics require UseAESIntrinsics flag to be enabled. Intrinsics will be disabled."); |
|
737 |
FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false); |
|
738 |
} |
|
739 |
} else { |
|
39256
ac12f57c6d9c
8158214: Crash with "assert(VM_Version::supports_sse4_1()) failed" if UseSSE < 4 is set
thartmann
parents:
38135
diff
changeset
|
740 |
if(supports_sse4_1()) { |
35154 | 741 |
if (FLAG_IS_DEFAULT(UseAESCTRIntrinsics)) { |
742 |
FLAG_SET_DEFAULT(UseAESCTRIntrinsics, true); |
|
743 |
} |
|
744 |
} else { |
|
745 |
// The AES-CTR intrinsic stubs require AES instruction support (of course) |
|
746 |
// but also require sse4.1 mode or higher for instructions it use. |
|
747 |
if (UseAESCTRIntrinsics && !FLAG_IS_DEFAULT(UseAESCTRIntrinsics)) { |
|
748 |
warning("X86 AES-CTR intrinsics require SSE4.1 instructions or higher. Intrinsics will be disabled."); |
|
749 |
} |
|
750 |
FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false); |
|
751 |
} |
|
752 |
} |
|
753 |
// --AES-CTR ends-- |
|
34176
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
754 |
} |
35537
bed5e2dc57a1
8146581: Minor corrections to the patch submitted for earlier bug id - 8143925
kvn
parents:
35154
diff
changeset
|
755 |
} else if (UseAES || UseAESIntrinsics || UseAESCTRIntrinsics) { |
34176
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
756 |
if (UseAES && !FLAG_IS_DEFAULT(UseAES)) { |
23491 | 757 |
warning("AES instructions are not available on this CPU"); |
34176
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
758 |
FLAG_SET_DEFAULT(UseAES, false); |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
759 |
} |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
760 |
if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
761 |
warning("AES intrinsics are not available on this CPU"); |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
762 |
FLAG_SET_DEFAULT(UseAESIntrinsics, false); |
c1b52e665b47
8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents:
34162
diff
changeset
|
763 |
} |
35154 | 764 |
if (UseAESCTRIntrinsics && !FLAG_IS_DEFAULT(UseAESCTRIntrinsics)) { |
765 |
warning("AES-CTR intrinsics are not available on this CPU"); |
|
766 |
FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false); |
|
767 |
} |
|
14132 | 768 |
} |
769 |
||
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
770 |
// Use CLMUL instructions if available. |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
771 |
if (supports_clmul()) { |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
772 |
if (FLAG_IS_DEFAULT(UseCLMUL)) { |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
773 |
UseCLMUL = true; |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
774 |
} |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
775 |
} else if (UseCLMUL) { |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
776 |
if (!FLAG_IS_DEFAULT(UseCLMUL)) |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
777 |
warning("CLMUL instructions not available on this CPU (AVX may also be required)"); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
778 |
FLAG_SET_DEFAULT(UseCLMUL, false); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
779 |
} |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
780 |
|
25932
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
781 |
if (UseCLMUL && (UseSSE > 2)) { |
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
782 |
if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) { |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
783 |
UseCRC32Intrinsics = true; |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
784 |
} |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
785 |
} else if (UseCRC32Intrinsics) { |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
786 |
if (!FLAG_IS_DEFAULT(UseCRC32Intrinsics)) |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
787 |
warning("CRC32 Intrinsics requires CLMUL instructions (not available on this CPU)"); |
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
788 |
FLAG_SET_DEFAULT(UseCRC32Intrinsics, false); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
789 |
} |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
15243
diff
changeset
|
790 |
|
44737
d090627aedb8
8178723: Workaround for failure of CRC32C intrinsic on x86 machines without CLMUL support (JDK-8178720)
zmajo
parents:
43936
diff
changeset
|
791 |
if (supports_sse4_2() && supports_clmul()) { |
33066 | 792 |
if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) { |
793 |
UseCRC32CIntrinsics = true; |
|
794 |
} |
|
44737
d090627aedb8
8178723: Workaround for failure of CRC32C intrinsic on x86 machines without CLMUL support (JDK-8178720)
zmajo
parents:
43936
diff
changeset
|
795 |
} else if (UseCRC32CIntrinsics) { |
33066 | 796 |
if (!FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) { |
797 |
warning("CRC32C intrinsics are not available on this CPU"); |
|
798 |
} |
|
799 |
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false); |
|
800 |
} |
|
801 |
||
31404
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
802 |
// GHASH/GCM intrinsics |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
803 |
if (UseCLMUL && (UseSSE > 2)) { |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
804 |
if (FLAG_IS_DEFAULT(UseGHASHIntrinsics)) { |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
805 |
UseGHASHIntrinsics = true; |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
806 |
} |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
807 |
} else if (UseGHASHIntrinsics) { |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
808 |
if (!FLAG_IS_DEFAULT(UseGHASHIntrinsics)) |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
809 |
warning("GHASH intrinsic requires CLMUL and SSE2 instructions on this CPU"); |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
810 |
FLAG_SET_DEFAULT(UseGHASHIntrinsics, false); |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
811 |
} |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
812 |
|
46546 | 813 |
if (supports_fma() && UseSSE >= 2) { // Check UseSSE since FMA code uses SSE instructions |
41323 | 814 |
if (FLAG_IS_DEFAULT(UseFMA)) { |
815 |
UseFMA = true; |
|
816 |
} |
|
817 |
} else if (UseFMA) { |
|
818 |
warning("FMA instructions are not available on this CPU"); |
|
819 |
FLAG_SET_DEFAULT(UseFMA, false); |
|
820 |
} |
|
821 |
||
38135
e06e2d071465
8154495: SHA256 AVX2 intrinsic (when no supports_sha() available)
jcivlin
parents:
37430
diff
changeset
|
822 |
if (supports_sha() LP64_ONLY(|| supports_avx2() && supports_bmi2())) { |
36555 | 823 |
if (FLAG_IS_DEFAULT(UseSHA)) { |
824 |
UseSHA = true; |
|
825 |
} |
|
826 |
} else if (UseSHA) { |
|
24953
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24424
diff
changeset
|
827 |
warning("SHA instructions are not available on this CPU"); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24424
diff
changeset
|
828 |
FLAG_SET_DEFAULT(UseSHA, false); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24424
diff
changeset
|
829 |
} |
31588
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31584
diff
changeset
|
830 |
|
38135
e06e2d071465
8154495: SHA256 AVX2 intrinsic (when no supports_sha() available)
jcivlin
parents:
37430
diff
changeset
|
831 |
if (supports_sha() && UseSHA) { |
36555 | 832 |
if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) { |
833 |
FLAG_SET_DEFAULT(UseSHA1Intrinsics, true); |
|
834 |
} |
|
835 |
} else if (UseSHA1Intrinsics) { |
|
31588
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31584
diff
changeset
|
836 |
warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU."); |
24953
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24424
diff
changeset
|
837 |
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false); |
31588
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31584
diff
changeset
|
838 |
} |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31584
diff
changeset
|
839 |
|
36555 | 840 |
if (UseSHA) { |
841 |
if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) { |
|
842 |
FLAG_SET_DEFAULT(UseSHA256Intrinsics, true); |
|
843 |
} |
|
844 |
} else if (UseSHA256Intrinsics) { |
|
31588
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31584
diff
changeset
|
845 |
warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU."); |
24953
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24424
diff
changeset
|
846 |
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false); |
31588
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31584
diff
changeset
|
847 |
} |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31584
diff
changeset
|
848 |
|
42039 | 849 |
if (UseSHA) { |
850 |
if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) { |
|
851 |
FLAG_SET_DEFAULT(UseSHA512Intrinsics, true); |
|
852 |
} |
|
853 |
} else if (UseSHA512Intrinsics) { |
|
31588
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31584
diff
changeset
|
854 |
warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU."); |
24953
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24424
diff
changeset
|
855 |
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24424
diff
changeset
|
856 |
} |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24424
diff
changeset
|
857 |
|
36555 | 858 |
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) { |
859 |
FLAG_SET_DEFAULT(UseSHA, false); |
|
860 |
} |
|
861 |
||
32581 | 862 |
if (UseAdler32Intrinsics) { |
863 |
warning("Adler32Intrinsics not available on this CPU."); |
|
864 |
FLAG_SET_DEFAULT(UseAdler32Intrinsics, false); |
|
865 |
} |
|
866 |
||
23491 | 867 |
if (!supports_rtm() && UseRTMLocking) { |
868 |
// Can't continue because UseRTMLocking affects UseBiasedLocking flag |
|
869 |
// setting during arguments processing. See use_biased_locking(). |
|
870 |
// VM_Version_init() is executed after UseBiasedLocking is used |
|
871 |
// in Thread::allocate(). |
|
872 |
vm_exit_during_initialization("RTM instructions are not available on this CPU"); |
|
873 |
} |
|
874 |
||
875 |
#if INCLUDE_RTM_OPT |
|
876 |
if (UseRTMLocking) { |
|
43936
093cd5bea2e2
8173679: Disable ProfileTrap code and UseRTMLocking in emulated client Win32
jcm
parents:
42586
diff
changeset
|
877 |
if (is_client_compilation_mode_vm()) { |
093cd5bea2e2
8173679: Disable ProfileTrap code and UseRTMLocking in emulated client Win32
jcm
parents:
42586
diff
changeset
|
878 |
// Only C2 does RTM locking optimization. |
093cd5bea2e2
8173679: Disable ProfileTrap code and UseRTMLocking in emulated client Win32
jcm
parents:
42586
diff
changeset
|
879 |
// Can't continue because UseRTMLocking affects UseBiasedLocking flag |
093cd5bea2e2
8173679: Disable ProfileTrap code and UseRTMLocking in emulated client Win32
jcm
parents:
42586
diff
changeset
|
880 |
// setting during arguments processing. See use_biased_locking(). |
093cd5bea2e2
8173679: Disable ProfileTrap code and UseRTMLocking in emulated client Win32
jcm
parents:
42586
diff
changeset
|
881 |
vm_exit_during_initialization("RTM locking optimization is not supported in emulated client VM"); |
093cd5bea2e2
8173679: Disable ProfileTrap code and UseRTMLocking in emulated client Win32
jcm
parents:
42586
diff
changeset
|
882 |
} |
26306
2b4cf8eb3de7
8055069: TSX and RTM should be deprecated more strongly until hardware is corrected
kvn
parents:
25949
diff
changeset
|
883 |
if (is_intel_family_core()) { |
2b4cf8eb3de7
8055069: TSX and RTM should be deprecated more strongly until hardware is corrected
kvn
parents:
25949
diff
changeset
|
884 |
if ((_model == CPU_MODEL_HASWELL_E3) || |
2b4cf8eb3de7
8055069: TSX and RTM should be deprecated more strongly until hardware is corrected
kvn
parents:
25949
diff
changeset
|
885 |
(_model == CPU_MODEL_HASWELL_E7 && _stepping < 3) || |
2b4cf8eb3de7
8055069: TSX and RTM should be deprecated more strongly until hardware is corrected
kvn
parents:
25949
diff
changeset
|
886 |
(_model == CPU_MODEL_BROADWELL && _stepping < 4)) { |
30624 | 887 |
// currently a collision between SKL and HSW_E3 |
888 |
if (!UnlockExperimentalVMOptions && UseAVX < 3) { |
|
26306
2b4cf8eb3de7
8055069: TSX and RTM should be deprecated more strongly until hardware is corrected
kvn
parents:
25949
diff
changeset
|
889 |
vm_exit_during_initialization("UseRTMLocking is only available as experimental option on this platform. It must be enabled via -XX:+UnlockExperimentalVMOptions flag."); |
2b4cf8eb3de7
8055069: TSX and RTM should be deprecated more strongly until hardware is corrected
kvn
parents:
25949
diff
changeset
|
890 |
} else { |
2b4cf8eb3de7
8055069: TSX and RTM should be deprecated more strongly until hardware is corrected
kvn
parents:
25949
diff
changeset
|
891 |
warning("UseRTMLocking is only available as experimental option on this platform."); |
2b4cf8eb3de7
8055069: TSX and RTM should be deprecated more strongly until hardware is corrected
kvn
parents:
25949
diff
changeset
|
892 |
} |
2b4cf8eb3de7
8055069: TSX and RTM should be deprecated more strongly until hardware is corrected
kvn
parents:
25949
diff
changeset
|
893 |
} |
2b4cf8eb3de7
8055069: TSX and RTM should be deprecated more strongly until hardware is corrected
kvn
parents:
25949
diff
changeset
|
894 |
} |
23491 | 895 |
if (!FLAG_IS_CMDLINE(UseRTMLocking)) { |
896 |
// RTM locking should be used only for applications with |
|
897 |
// high lock contention. For now we do not use it by default. |
|
898 |
vm_exit_during_initialization("UseRTMLocking flag should be only set on command line"); |
|
899 |
} |
|
900 |
if (!is_power_of_2(RTMTotalCountIncrRate)) { |
|
901 |
warning("RTMTotalCountIncrRate must be a power of 2, resetting it to 64"); |
|
902 |
FLAG_SET_DEFAULT(RTMTotalCountIncrRate, 64); |
|
903 |
} |
|
904 |
if (RTMAbortRatio < 0 || RTMAbortRatio > 100) { |
|
905 |
warning("RTMAbortRatio must be in the range 0 to 100, resetting it to 50"); |
|
906 |
FLAG_SET_DEFAULT(RTMAbortRatio, 50); |
|
907 |
} |
|
908 |
} else { // !UseRTMLocking |
|
909 |
if (UseRTMForStackLocks) { |
|
910 |
if (!FLAG_IS_DEFAULT(UseRTMForStackLocks)) { |
|
911 |
warning("UseRTMForStackLocks flag should be off when UseRTMLocking flag is off"); |
|
912 |
} |
|
913 |
FLAG_SET_DEFAULT(UseRTMForStackLocks, false); |
|
914 |
} |
|
915 |
if (UseRTMDeopt) { |
|
916 |
FLAG_SET_DEFAULT(UseRTMDeopt, false); |
|
917 |
} |
|
918 |
if (PrintPreciseRTMLockingStatistics) { |
|
919 |
FLAG_SET_DEFAULT(PrintPreciseRTMLockingStatistics, false); |
|
920 |
} |
|
921 |
} |
|
922 |
#else |
|
923 |
if (UseRTMLocking) { |
|
924 |
// Only C2 does RTM locking optimization. |
|
925 |
// Can't continue because UseRTMLocking affects UseBiasedLocking flag |
|
926 |
// setting during arguments processing. See use_biased_locking(). |
|
927 |
vm_exit_during_initialization("RTM locking optimization is not supported in this VM"); |
|
928 |
} |
|
929 |
#endif |
|
930 |
||
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
931 |
#ifdef COMPILER2 |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
932 |
if (UseFPUForSpilling) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
933 |
if (UseSSE < 2) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
934 |
// Only supported with SSE2+ |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
935 |
FLAG_SET_DEFAULT(UseFPUForSpilling, false); |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
936 |
} |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
937 |
} |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
33066
diff
changeset
|
938 |
#endif |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
33066
diff
changeset
|
939 |
#if defined(COMPILER2) || INCLUDE_JVMCI |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
940 |
if (MaxVectorSize > 0) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
941 |
if (!is_power_of_2(MaxVectorSize)) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
942 |
warning("MaxVectorSize must be a power of 2"); |
30624 | 943 |
FLAG_SET_DEFAULT(MaxVectorSize, 64); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
944 |
} |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
945 |
if (UseSSE < 2) { |
23487
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
946 |
// Vectors (in XMM) are only supported with SSE2+ |
46440
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
947 |
if (MaxVectorSize > 0) { |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
948 |
if (!FLAG_IS_DEFAULT(MaxVectorSize)) |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
949 |
warning("MaxVectorSize must be 0"); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
950 |
FLAG_SET_DEFAULT(MaxVectorSize, 0); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
951 |
} |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
952 |
} |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
953 |
else if (UseAVX == 0 || !os_supports_avx_vectors()) { |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
954 |
// 32 bytes vectors (in YMM) are only supported with AVX+ |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
955 |
if (MaxVectorSize > 16) { |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
956 |
if (!FLAG_IS_DEFAULT(MaxVectorSize)) |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
957 |
warning("MaxVectorSize must be <= 16"); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
958 |
FLAG_SET_DEFAULT(MaxVectorSize, 16); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
959 |
} |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
960 |
} |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
961 |
else if (UseAVX == 1 || UseAVX == 2) { |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
962 |
// 64 bytes vectors (in ZMM) are only supported with AVX 3 |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
963 |
if (MaxVectorSize > 32) { |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
964 |
if (!FLAG_IS_DEFAULT(MaxVectorSize)) |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
965 |
warning("MaxVectorSize must be <= 32"); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
966 |
FLAG_SET_DEFAULT(MaxVectorSize, 32); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
967 |
} |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
968 |
} |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
969 |
else if (UseAVX > 2 ) { |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
970 |
if (MaxVectorSize > 64) { |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
971 |
if (!FLAG_IS_DEFAULT(MaxVectorSize)) |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
972 |
warning("MaxVectorSize must be <= 64"); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
973 |
FLAG_SET_DEFAULT(MaxVectorSize, 64); |
61025eecb743
8178811: Minimize the AVX <-> SSE transition penalty through generation of vzeroupper instruction on x86
vdeshpande
parents:
43936
diff
changeset
|
974 |
} |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
975 |
} |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
33066
diff
changeset
|
976 |
#if defined(COMPILER2) && defined(ASSERT) |
23487
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
977 |
if (supports_avx() && PrintMiscellaneous && Verbose && TraceNewVectors) { |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
978 |
tty->print_cr("State of YMM registers after signal handle:"); |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
979 |
int nreg = 2 LP64_ONLY(+2); |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
980 |
const char* ymm_name[4] = {"0", "7", "8", "15"}; |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
981 |
for (int i = 0; i < nreg; i++) { |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
982 |
tty->print("YMM%s:", ymm_name[i]); |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
983 |
for (int j = 7; j >=0; j--) { |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
984 |
tty->print(" %x", _cpuid_info.ymm_save[i*8 + j]); |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
985 |
} |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
986 |
tty->cr(); |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
987 |
} |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
988 |
} |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
33066
diff
changeset
|
989 |
#endif // COMPILER2 && ASSERT |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
990 |
} |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
33066
diff
changeset
|
991 |
#endif // COMPILER2 || INCLUDE_JVMCI |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
992 |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
33066
diff
changeset
|
993 |
#ifdef COMPILER2 |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
994 |
#ifdef _LP64 |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
995 |
if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) { |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
996 |
UseMultiplyToLenIntrinsic = true; |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
997 |
} |
31129
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
998 |
if (FLAG_IS_DEFAULT(UseSquareToLenIntrinsic)) { |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
999 |
UseSquareToLenIntrinsic = true; |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1000 |
} |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1001 |
if (FLAG_IS_DEFAULT(UseMulAddIntrinsic)) { |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1002 |
UseMulAddIntrinsic = true; |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1003 |
} |
31583
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1004 |
if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) { |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1005 |
UseMontgomeryMultiplyIntrinsic = true; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1006 |
} |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1007 |
if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) { |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1008 |
UseMontgomerySquareIntrinsic = true; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1009 |
} |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1010 |
#else |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1011 |
if (UseMultiplyToLenIntrinsic) { |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1012 |
if (!FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) { |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1013 |
warning("multiplyToLen intrinsic is not available in 32-bit VM"); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1014 |
} |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1015 |
FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, false); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1016 |
} |
31583
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1017 |
if (UseMontgomeryMultiplyIntrinsic) { |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1018 |
if (!FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) { |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1019 |
warning("montgomeryMultiply intrinsic is not available in 32-bit VM"); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1020 |
} |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1021 |
FLAG_SET_DEFAULT(UseMontgomeryMultiplyIntrinsic, false); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1022 |
} |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1023 |
if (UseMontgomerySquareIntrinsic) { |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1024 |
if (!FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) { |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1025 |
warning("montgomerySquare intrinsic is not available in 32-bit VM"); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1026 |
} |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1027 |
FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, false); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1028 |
} |
31129
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1029 |
if (UseSquareToLenIntrinsic) { |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1030 |
if (!FLAG_IS_DEFAULT(UseSquareToLenIntrinsic)) { |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1031 |
warning("squareToLen intrinsic is not available in 32-bit VM"); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1032 |
} |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1033 |
FLAG_SET_DEFAULT(UseSquareToLenIntrinsic, false); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1034 |
} |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1035 |
if (UseMulAddIntrinsic) { |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1036 |
if (!FLAG_IS_DEFAULT(UseMulAddIntrinsic)) { |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1037 |
warning("mulAdd intrinsic is not available in 32-bit VM"); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1038 |
} |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1039 |
FLAG_SET_DEFAULT(UseMulAddIntrinsic, false); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30624
diff
changeset
|
1040 |
} |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
1041 |
#endif |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1042 |
#endif // COMPILER2 |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
1043 |
|
2111 | 1044 |
// On new cpus instructions which update whole XMM register should be used |
1045 |
// to prevent partial register stall due to dependencies on high half. |
|
1046 |
// |
|
1047 |
// UseXmmLoadAndClearUpper == true --> movsd(xmm, mem) |
|
1048 |
// UseXmmLoadAndClearUpper == false --> movlpd(xmm, mem) |
|
1049 |
// UseXmmRegToRegMoveAll == true --> movaps(xmm, xmm), movapd(xmm, xmm). |
|
1050 |
// UseXmmRegToRegMoveAll == false --> movss(xmm, xmm), movsd(xmm, xmm). |
|
1051 |
||
1052 |
if( is_amd() ) { // AMD cpus specific settings |
|
1053 |
if( supports_sse2() && FLAG_IS_DEFAULT(UseAddressNop) ) { |
|
1054 |
// Use it on new AMD cpus starting from Opteron. |
|
1055 |
UseAddressNop = true; |
|
1056 |
} |
|
1057 |
if( supports_sse2() && FLAG_IS_DEFAULT(UseNewLongLShift) ) { |
|
1058 |
// Use it on new AMD cpus starting from Opteron. |
|
1059 |
UseNewLongLShift = true; |
|
1060 |
} |
|
1061 |
if( FLAG_IS_DEFAULT(UseXmmLoadAndClearUpper) ) { |
|
34162 | 1062 |
if (supports_sse4a()) { |
2111 | 1063 |
UseXmmLoadAndClearUpper = true; // use movsd only on '10h' Opteron |
1064 |
} else { |
|
1065 |
UseXmmLoadAndClearUpper = false; |
|
1066 |
} |
|
1067 |
} |
|
1068 |
if( FLAG_IS_DEFAULT(UseXmmRegToRegMoveAll) ) { |
|
1069 |
if( supports_sse4a() ) { |
|
1070 |
UseXmmRegToRegMoveAll = true; // use movaps, movapd only on '10h' |
|
1071 |
} else { |
|
1072 |
UseXmmRegToRegMoveAll = false; |
|
1073 |
} |
|
1074 |
} |
|
1075 |
if( FLAG_IS_DEFAULT(UseXmmI2F) ) { |
|
1076 |
if( supports_sse4a() ) { |
|
1077 |
UseXmmI2F = true; |
|
1078 |
} else { |
|
1079 |
UseXmmI2F = false; |
|
1080 |
} |
|
1081 |
} |
|
1082 |
if( FLAG_IS_DEFAULT(UseXmmI2D) ) { |
|
1083 |
if( supports_sse4a() ) { |
|
1084 |
UseXmmI2D = true; |
|
1085 |
} else { |
|
1086 |
UseXmmI2D = false; |
|
1087 |
} |
|
1088 |
} |
|
39256
ac12f57c6d9c
8158214: Crash with "assert(VM_Version::supports_sse4_1()) failed" if UseSSE < 4 is set
thartmann
parents:
38135
diff
changeset
|
1089 |
if (supports_sse4_2()) { |
34207
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1090 |
if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) { |
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1091 |
FLAG_SET_DEFAULT(UseSSE42Intrinsics, true); |
8873 | 1092 |
} |
34207
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1093 |
} else { |
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1094 |
if (UseSSE42Intrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { |
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1095 |
warning("SSE4.2 intrinsics require SSE4.2 instructions or higher. Intrinsics will be disabled."); |
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1096 |
} |
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1097 |
FLAG_SET_DEFAULT(UseSSE42Intrinsics, false); |
8873 | 1098 |
} |
2862
fad636edf18f
6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents:
2348
diff
changeset
|
1099 |
|
9325
2b95b2b2b60f
7037812: few more defaults changes for new AMD processors
kvn
parents:
9135
diff
changeset
|
1100 |
// some defaults for AMD family 15h |
2b95b2b2b60f
7037812: few more defaults changes for new AMD processors
kvn
parents:
9135
diff
changeset
|
1101 |
if ( cpu_family() == 0x15 ) { |
2b95b2b2b60f
7037812: few more defaults changes for new AMD processors
kvn
parents:
9135
diff
changeset
|
1102 |
// On family 15h processors default is no sw prefetch |
8677 | 1103 |
if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) { |
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1104 |
FLAG_SET_DEFAULT(AllocatePrefetchStyle, 0); |
8677 | 1105 |
} |
9325
2b95b2b2b60f
7037812: few more defaults changes for new AMD processors
kvn
parents:
9135
diff
changeset
|
1106 |
// Also, if some other prefetch style is specified, default instruction type is PREFETCHW |
2b95b2b2b60f
7037812: few more defaults changes for new AMD processors
kvn
parents:
9135
diff
changeset
|
1107 |
if (FLAG_IS_DEFAULT(AllocatePrefetchInstr)) { |
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1108 |
FLAG_SET_DEFAULT(AllocatePrefetchInstr, 3); |
9325
2b95b2b2b60f
7037812: few more defaults changes for new AMD processors
kvn
parents:
9135
diff
changeset
|
1109 |
} |
2b95b2b2b60f
7037812: few more defaults changes for new AMD processors
kvn
parents:
9135
diff
changeset
|
1110 |
// On family 15h processors use XMM and UnalignedLoadStores for Array Copy |
13885 | 1111 |
if (supports_sse2() && FLAG_IS_DEFAULT(UseXMMForArrayCopy)) { |
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1112 |
FLAG_SET_DEFAULT(UseXMMForArrayCopy, true); |
9325
2b95b2b2b60f
7037812: few more defaults changes for new AMD processors
kvn
parents:
9135
diff
changeset
|
1113 |
} |
13885 | 1114 |
if (supports_sse2() && FLAG_IS_DEFAULT(UseUnalignedLoadStores)) { |
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1115 |
FLAG_SET_DEFAULT(UseUnalignedLoadStores, true); |
9325
2b95b2b2b60f
7037812: few more defaults changes for new AMD processors
kvn
parents:
9135
diff
changeset
|
1116 |
} |
8677 | 1117 |
} |
9325
2b95b2b2b60f
7037812: few more defaults changes for new AMD processors
kvn
parents:
9135
diff
changeset
|
1118 |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
1119 |
#ifdef COMPILER2 |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
1120 |
if (MaxVectorSize > 16) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
1121 |
// Limit vectors size to 16 bytes on current AMD cpus. |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
1122 |
FLAG_SET_DEFAULT(MaxVectorSize, 16); |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
1123 |
} |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11881
diff
changeset
|
1124 |
#endif // COMPILER2 |
2111 | 1125 |
} |
1126 |
||
1127 |
if( is_intel() ) { // Intel cpus specific settings |
|
1128 |
if( FLAG_IS_DEFAULT(UseStoreImmI16) ) { |
|
1129 |
UseStoreImmI16 = false; // don't use it on Intel cpus |
|
1130 |
} |
|
1131 |
if( cpu_family() == 6 || cpu_family() == 15 ) { |
|
1132 |
if( FLAG_IS_DEFAULT(UseAddressNop) ) { |
|
1133 |
// Use it on all Intel cpus starting from PentiumPro |
|
1134 |
UseAddressNop = true; |
|
1135 |
} |
|
1136 |
} |
|
1137 |
if( FLAG_IS_DEFAULT(UseXmmLoadAndClearUpper) ) { |
|
1138 |
UseXmmLoadAndClearUpper = true; // use movsd on all Intel cpus |
|
1139 |
} |
|
1140 |
if( FLAG_IS_DEFAULT(UseXmmRegToRegMoveAll) ) { |
|
1141 |
if( supports_sse3() ) { |
|
1142 |
UseXmmRegToRegMoveAll = true; // use movaps, movapd on new Intel cpus |
|
1143 |
} else { |
|
1144 |
UseXmmRegToRegMoveAll = false; |
|
1145 |
} |
|
1146 |
} |
|
1147 |
if( cpu_family() == 6 && supports_sse3() ) { // New Intel cpus |
|
1148 |
#ifdef COMPILER2 |
|
1149 |
if( FLAG_IS_DEFAULT(MaxLoopPad) ) { |
|
1150 |
// For new Intel cpus do the next optimization: |
|
1151 |
// don't align the beginning of a loop if there are enough instructions |
|
1152 |
// left (NumberOfLoopInstrToAlign defined in c2_globals.hpp) |
|
1153 |
// in current fetch line (OptoLoopAlignment) or the padding |
|
1154 |
// is big (> MaxLoopPad). |
|
1155 |
// Set MaxLoopPad to 11 for new Intel cpus to reduce number of |
|
1156 |
// generated NOP instructions. 11 is the largest size of one |
|
1157 |
// address NOP instruction '0F 1F' (see Assembler::nop(i)). |
|
1158 |
MaxLoopPad = 11; |
|
1159 |
} |
|
1160 |
#endif // COMPILER2 |
|
13885 | 1161 |
if (FLAG_IS_DEFAULT(UseXMMForArrayCopy)) { |
2111 | 1162 |
UseXMMForArrayCopy = true; // use SSE2 movq on new Intel cpus |
1163 |
} |
|
13885 | 1164 |
if (supports_sse4_2() && supports_ht()) { // Newest Intel cpus |
1165 |
if (FLAG_IS_DEFAULT(UseUnalignedLoadStores)) { |
|
2111 | 1166 |
UseUnalignedLoadStores = true; // use movdqu on newest Intel cpus |
1167 |
} |
|
1168 |
} |
|
39256
ac12f57c6d9c
8158214: Crash with "assert(VM_Version::supports_sse4_1()) failed" if UseSSE < 4 is set
thartmann
parents:
38135
diff
changeset
|
1169 |
if (supports_sse4_2()) { |
13885 | 1170 |
if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) { |
34207
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1171 |
FLAG_SET_DEFAULT(UseSSE42Intrinsics, true); |
2348 | 1172 |
} |
34207
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1173 |
} else { |
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1174 |
if (UseSSE42Intrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { |
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1175 |
warning("SSE4.2 intrinsics require SSE4.2 instructions or higher. Intrinsics will be disabled."); |
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1176 |
} |
a5f1c458b56e
8143208: compiler/c1/6855215/Test6855215.java supports_sse2() failed
zmajo
parents:
34176
diff
changeset
|
1177 |
FLAG_SET_DEFAULT(UseSSE42Intrinsics, false); |
2348 | 1178 |
} |
2111 | 1179 |
} |
25932
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1180 |
if ((cpu_family() == 0x06) && |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1181 |
((extended_cpu_model() == 0x36) || // Centerton |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1182 |
(extended_cpu_model() == 0x37) || // Silvermont |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1183 |
(extended_cpu_model() == 0x4D))) { |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1184 |
#ifdef COMPILER2 |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1185 |
if (FLAG_IS_DEFAULT(OptoScheduling)) { |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1186 |
OptoScheduling = true; |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1187 |
} |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1188 |
#endif |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1189 |
if (supports_sse4_2()) { // Silvermont |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1190 |
if (FLAG_IS_DEFAULT(UseUnalignedLoadStores)) { |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1191 |
UseUnalignedLoadStores = true; // use movdqu on newest Intel cpus |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1192 |
} |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1193 |
} |
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1194 |
} |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1195 |
if(FLAG_IS_DEFAULT(AllocatePrefetchInstr) && supports_3dnow_prefetch()) { |
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1196 |
FLAG_SET_DEFAULT(AllocatePrefetchInstr, 3); |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1197 |
} |
2111 | 1198 |
} |
1199 |
||
35110
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1200 |
#ifdef _LP64 |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1201 |
if (UseSSE42Intrinsics) { |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1202 |
if (FLAG_IS_DEFAULT(UseVectorizedMismatchIntrinsic)) { |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1203 |
UseVectorizedMismatchIntrinsic = true; |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1204 |
} |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1205 |
} else if (UseVectorizedMismatchIntrinsic) { |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1206 |
if (!FLAG_IS_DEFAULT(UseVectorizedMismatchIntrinsic)) |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1207 |
warning("vectorizedMismatch intrinsics are not available on this CPU"); |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1208 |
FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false); |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1209 |
} |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1210 |
#else |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1211 |
if (UseVectorizedMismatchIntrinsic) { |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1212 |
if (!FLAG_IS_DEFAULT(UseVectorizedMismatchIntrinsic)) { |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1213 |
warning("vectorizedMismatch intrinsic is not available in 32-bit VM"); |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1214 |
} |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1215 |
FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false); |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1216 |
} |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1217 |
#endif // _LP64 |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34207
diff
changeset
|
1218 |
|
23220
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1219 |
// Use count leading zeros count instruction if available. |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1220 |
if (supports_lzcnt()) { |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1221 |
if (FLAG_IS_DEFAULT(UseCountLeadingZerosInstruction)) { |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1222 |
UseCountLeadingZerosInstruction = true; |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1223 |
} |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1224 |
} else if (UseCountLeadingZerosInstruction) { |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1225 |
warning("lzcnt instruction is not available on this CPU"); |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1226 |
FLAG_SET_DEFAULT(UseCountLeadingZerosInstruction, false); |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1227 |
} |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1228 |
|
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1229 |
// Use count trailing zeros instruction if available |
23220
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1230 |
if (supports_bmi1()) { |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1231 |
// tzcnt does not require VEX prefix |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1232 |
if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstruction)) { |
27414
39d976b80fb4
8059139: It should be possible to explicitly disable usage of TZCNT instr w/ -XX:-UseBMI1Instructions
kvn
parents:
26434
diff
changeset
|
1233 |
if (!UseBMI1Instructions && !FLAG_IS_DEFAULT(UseBMI1Instructions)) { |
39d976b80fb4
8059139: It should be possible to explicitly disable usage of TZCNT instr w/ -XX:-UseBMI1Instructions
kvn
parents:
26434
diff
changeset
|
1234 |
// Don't use tzcnt if BMI1 is switched off on command line. |
39d976b80fb4
8059139: It should be possible to explicitly disable usage of TZCNT instr w/ -XX:-UseBMI1Instructions
kvn
parents:
26434
diff
changeset
|
1235 |
UseCountTrailingZerosInstruction = false; |
39d976b80fb4
8059139: It should be possible to explicitly disable usage of TZCNT instr w/ -XX:-UseBMI1Instructions
kvn
parents:
26434
diff
changeset
|
1236 |
} else { |
39d976b80fb4
8059139: It should be possible to explicitly disable usage of TZCNT instr w/ -XX:-UseBMI1Instructions
kvn
parents:
26434
diff
changeset
|
1237 |
UseCountTrailingZerosInstruction = true; |
39d976b80fb4
8059139: It should be possible to explicitly disable usage of TZCNT instr w/ -XX:-UseBMI1Instructions
kvn
parents:
26434
diff
changeset
|
1238 |
} |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1239 |
} |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1240 |
} else if (UseCountTrailingZerosInstruction) { |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1241 |
warning("tzcnt instruction is not available on this CPU"); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1242 |
FLAG_SET_DEFAULT(UseCountTrailingZerosInstruction, false); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1243 |
} |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1244 |
|
27414
39d976b80fb4
8059139: It should be possible to explicitly disable usage of TZCNT instr w/ -XX:-UseBMI1Instructions
kvn
parents:
26434
diff
changeset
|
1245 |
// BMI instructions (except tzcnt) use an encoding with VEX prefix. |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1246 |
// VEX prefix is generated only when AVX > 0. |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1247 |
if (supports_bmi1() && supports_avx()) { |
23220
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1248 |
if (FLAG_IS_DEFAULT(UseBMI1Instructions)) { |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1249 |
UseBMI1Instructions = true; |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1250 |
} |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1251 |
} else if (UseBMI1Instructions) { |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1252 |
warning("BMI1 instructions are not available on this CPU (AVX is also required)"); |
23220
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1253 |
FLAG_SET_DEFAULT(UseBMI1Instructions, false); |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1254 |
} |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1255 |
|
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1256 |
if (supports_bmi2() && supports_avx()) { |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1257 |
if (FLAG_IS_DEFAULT(UseBMI2Instructions)) { |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1258 |
UseBMI2Instructions = true; |
23220
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1259 |
} |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1260 |
} else if (UseBMI2Instructions) { |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1261 |
warning("BMI2 instructions are not available on this CPU (AVX is also required)"); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
26306
diff
changeset
|
1262 |
FLAG_SET_DEFAULT(UseBMI2Instructions, false); |
23220
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1263 |
} |
fc827339dc37
8031321: Support Intel bit manipulation instructions
iveresov
parents:
18507
diff
changeset
|
1264 |
|
2255
54abdf3e1055
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
2111
diff
changeset
|
1265 |
// Use population count instruction if available. |
54abdf3e1055
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
2111
diff
changeset
|
1266 |
if (supports_popcnt()) { |
54abdf3e1055
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
2111
diff
changeset
|
1267 |
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) { |
54abdf3e1055
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
2111
diff
changeset
|
1268 |
UsePopCountInstruction = true; |
54abdf3e1055
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
2111
diff
changeset
|
1269 |
} |
11427 | 1270 |
} else if (UsePopCountInstruction) { |
1271 |
warning("POPCNT instruction is not available on this CPU"); |
|
1272 |
FLAG_SET_DEFAULT(UsePopCountInstruction, false); |
|
2255
54abdf3e1055
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
2111
diff
changeset
|
1273 |
} |
54abdf3e1055
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
2111
diff
changeset
|
1274 |
|
15114
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
1275 |
// Use fast-string operations if available. |
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
1276 |
if (supports_erms()) { |
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
1277 |
if (FLAG_IS_DEFAULT(UseFastStosb)) { |
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
1278 |
UseFastStosb = true; |
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
1279 |
} |
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
1280 |
} else if (UseFastStosb) { |
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
1281 |
warning("fast-string operations are not available on this CPU"); |
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
1282 |
FLAG_SET_DEFAULT(UseFastStosb, false); |
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
1283 |
} |
4074553c678b
8005522: use fast-string instructions on x86 for zeroing
kvn
parents:
14834
diff
changeset
|
1284 |
|
13885 | 1285 |
#ifdef COMPILER2 |
1286 |
if (FLAG_IS_DEFAULT(AlignVector)) { |
|
1287 |
// Modern processors allow misaligned memory operations for vectors. |
|
1288 |
AlignVector = !UseUnalignedLoadStores; |
|
1289 |
} |
|
1290 |
#endif // COMPILER2 |
|
1291 |
||
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1292 |
if (FLAG_IS_DEFAULT(AllocatePrefetchInstr)) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1293 |
if (AllocatePrefetchInstr == 3 && !supports_3dnow_prefetch()) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1294 |
FLAG_SET_DEFAULT(AllocatePrefetchInstr, 0); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1295 |
} else if (!supports_sse() && supports_3dnow_prefetch()) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1296 |
FLAG_SET_DEFAULT(AllocatePrefetchInstr, 3); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1297 |
} |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1298 |
} |
2111 | 1299 |
|
1300 |
// Allocation prefetch settings |
|
10267 | 1301 |
intx cache_line_size = prefetch_data_size(); |
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1302 |
if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize) && |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1303 |
(cache_line_size > AllocatePrefetchStepSize)) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1304 |
FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1305 |
} |
10267 | 1306 |
|
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1307 |
if ((AllocatePrefetchDistance == 0) && (AllocatePrefetchStyle != 0)) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1308 |
assert(!FLAG_IS_DEFAULT(AllocatePrefetchDistance), "default value should not be 0"); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1309 |
if (!FLAG_IS_DEFAULT(AllocatePrefetchStyle)) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1310 |
warning("AllocatePrefetchDistance is set to 0 which disable prefetching. Ignoring AllocatePrefetchStyle flag."); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1311 |
} |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1312 |
FLAG_SET_DEFAULT(AllocatePrefetchStyle, 0); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1313 |
} |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1314 |
|
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1315 |
if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1316 |
bool use_watermark_prefetch = (AllocatePrefetchStyle == 2); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1317 |
FLAG_SET_DEFAULT(AllocatePrefetchDistance, allocate_prefetch_distance(use_watermark_prefetch)); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1318 |
} |
2111 | 1319 |
|
25932
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1320 |
if (is_intel() && cpu_family() == 6 && supports_sse3()) { |
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1321 |
if (FLAG_IS_DEFAULT(AllocatePrefetchLines) && |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1322 |
supports_sse4_2() && supports_ht()) { // Nehalem based cpus |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1323 |
FLAG_SET_DEFAULT(AllocatePrefetchLines, 4); |
25932
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1324 |
} |
6272
94a20ad0e9de
6978249: spill between cpu and fpu registers when those moves are fast
never
parents:
5902
diff
changeset
|
1325 |
#ifdef COMPILER2 |
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1326 |
if (FLAG_IS_DEFAULT(UseFPUForSpilling) && supports_sse4_2()) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1327 |
FLAG_SET_DEFAULT(UseFPUForSpilling, true); |
25932
15d133edd8f6
8052081: Optimize generated by C2 code for Intel's Atom processor
kvn
parents:
25633
diff
changeset
|
1328 |
} |
6272
94a20ad0e9de
6978249: spill between cpu and fpu registers when those moves are fast
never
parents:
5902
diff
changeset
|
1329 |
#endif |
2111 | 1330 |
} |
1331 |
||
1332 |
#ifdef _LP64 |
|
1333 |
// Prefetch settings |
|
46547
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1334 |
|
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1335 |
// Prefetch interval for gc copy/scan == 9 dcache lines. Derived from |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1336 |
// 50-warehouse specjbb runs on a 2-way 1.8ghz opteron using a 4gb heap. |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1337 |
// Tested intervals from 128 to 2048 in increments of 64 == one cache line. |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1338 |
// 256 bytes (4 dcache lines) was the nearest runner-up to 576. |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1339 |
|
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1340 |
// gc copy/scan is disabled if prefetchw isn't supported, because |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1341 |
// Prefetch::write emits an inlined prefetchw on Linux. |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1342 |
// Do not use the 3dnow prefetchw instruction. It isn't supported on em64t. |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1343 |
// The used prefetcht0 instruction works for both amd64 and em64t. |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1344 |
|
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1345 |
if (FLAG_IS_DEFAULT(PrefetchCopyIntervalInBytes)) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1346 |
FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, 576); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1347 |
} |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1348 |
if (FLAG_IS_DEFAULT(PrefetchScanIntervalInBytes)) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1349 |
FLAG_SET_DEFAULT(PrefetchScanIntervalInBytes, 576); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1350 |
} |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1351 |
if (FLAG_IS_DEFAULT(PrefetchFieldsAhead)) { |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1352 |
FLAG_SET_DEFAULT(PrefetchFieldsAhead, 1); |
e1b926a0b23f
8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents:
46546
diff
changeset
|
1353 |
} |
2111 | 1354 |
#endif |
1355 |
||
15193
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14834
diff
changeset
|
1356 |
if (FLAG_IS_DEFAULT(ContendedPaddingWidth) && |
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14834
diff
changeset
|
1357 |
(cache_line_size > ContendedPaddingWidth)) |
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14834
diff
changeset
|
1358 |
ContendedPaddingWidth = cache_line_size; |
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14834
diff
changeset
|
1359 |
|
30209
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
28954
diff
changeset
|
1360 |
// This machine allows unaligned memory accesses |
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
28954
diff
changeset
|
1361 |
if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) { |
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
28954
diff
changeset
|
1362 |
FLAG_SET_DEFAULT(UseUnalignedAccesses, true); |
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
28954
diff
changeset
|
1363 |
} |
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
28954
diff
changeset
|
1364 |
|
2111 | 1365 |
#ifndef PRODUCT |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1366 |
if (log_is_enabled(Info, os, cpu)) { |
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1367 |
outputStream* log = Log(os, cpu)::info_stream(); |
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1368 |
log->print_cr("Logical CPUs per core: %u", |
2111 | 1369 |
logical_processors_per_package()); |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1370 |
log->print_cr("L1 data cache line size: %u", L1_data_cache_line_size()); |
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1371 |
log->print("UseSSE=%d", (int) UseSSE); |
11427 | 1372 |
if (UseAVX > 0) { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1373 |
log->print(" UseAVX=%d", (int) UseAVX); |
11427 | 1374 |
} |
14132 | 1375 |
if (UseAES) { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1376 |
log->print(" UseAES=1"); |
14132 | 1377 |
} |
23487
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
1378 |
#ifdef COMPILER2 |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
1379 |
if (MaxVectorSize > 0) { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1380 |
log->print(" MaxVectorSize=%d", (int) MaxVectorSize); |
23487
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
1381 |
} |
0f7e268cd9e3
8037226: compiler/7196199/Test7196199.java fails on 32-bit linux with MaxVectorSize > 16
kvn
parents:
23220
diff
changeset
|
1382 |
#endif |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1383 |
log->cr(); |
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1384 |
log->print("Allocation"); |
9135 | 1385 |
if (AllocatePrefetchStyle <= 0 || UseSSE == 0 && !supports_3dnow_prefetch()) { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1386 |
log->print_cr(": no prefetching"); |
2111 | 1387 |
} else { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1388 |
log->print(" prefetching: "); |
9135 | 1389 |
if (UseSSE == 0 && supports_3dnow_prefetch()) { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1390 |
log->print("PREFETCHW"); |
2111 | 1391 |
} else if (UseSSE >= 1) { |
1392 |
if (AllocatePrefetchInstr == 0) { |
|
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1393 |
log->print("PREFETCHNTA"); |
2111 | 1394 |
} else if (AllocatePrefetchInstr == 1) { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1395 |
log->print("PREFETCHT0"); |
2111 | 1396 |
} else if (AllocatePrefetchInstr == 2) { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1397 |
log->print("PREFETCHT2"); |
2111 | 1398 |
} else if (AllocatePrefetchInstr == 3) { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1399 |
log->print("PREFETCHW"); |
2111 | 1400 |
} |
1401 |
} |
|
1402 |
if (AllocatePrefetchLines > 1) { |
|
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1403 |
log->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize); |
2111 | 1404 |
} else { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1405 |
log->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize); |
2111 | 1406 |
} |
1407 |
} |
|
1408 |
||
1409 |
if (PrefetchCopyIntervalInBytes > 0) { |
|
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1410 |
log->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes); |
2111 | 1411 |
} |
1412 |
if (PrefetchScanIntervalInBytes > 0) { |
|
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1413 |
log->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes); |
2111 | 1414 |
} |
1415 |
if (PrefetchFieldsAhead > 0) { |
|
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1416 |
log->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead); |
2111 | 1417 |
} |
15193
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14834
diff
changeset
|
1418 |
if (ContendedPaddingWidth > 0) { |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36561
diff
changeset
|
1419 |
log->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth); |
15193
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14834
diff
changeset
|
1420 |
} |
2111 | 1421 |
} |
1422 |
#endif // !PRODUCT |
|
1423 |
} |
|
1424 |
||
23491 | 1425 |
bool VM_Version::use_biased_locking() { |
1426 |
#if INCLUDE_RTM_OPT |
|
1427 |
// RTM locking is most useful when there is high lock contention and |
|
1428 |
// low data contention. With high lock contention the lock is usually |
|
1429 |
// inflated and biased locking is not suitable for that case. |
|
1430 |
// RTM locking code requires that biased locking is off. |
|
1431 |
// Note: we can't switch off UseBiasedLocking in get_processor_features() |
|
1432 |
// because it is used by Thread::allocate() which is called before |
|
1433 |
// VM_Version::initialize(). |
|
1434 |
if (UseRTMLocking && UseBiasedLocking) { |
|
1435 |
if (FLAG_IS_DEFAULT(UseBiasedLocking)) { |
|
1436 |
FLAG_SET_DEFAULT(UseBiasedLocking, false); |
|
1437 |
} else { |
|
1438 |
warning("Biased locking is not supported with RTM locking; ignoring UseBiasedLocking flag." ); |
|
1439 |
UseBiasedLocking = false; |
|
1440 |
} |
|
1441 |
} |
|
1442 |
#endif |
|
1443 |
return UseBiasedLocking; |
|
1444 |
} |
|
1445 |
||
2111 | 1446 |
void VM_Version::initialize() { |
1447 |
ResourceMark rm; |
|
1448 |
// Making this stub must be FIRST use of assembler |
|
1449 |
||
23527
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
1450 |
stub_blob = BufferBlob::create("get_cpu_info_stub", stub_size); |
2111 | 1451 |
if (stub_blob == NULL) { |
23527
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
1452 |
vm_exit_during_initialization("Unable to allocate get_cpu_info_stub"); |
2111 | 1453 |
} |
6418 | 1454 |
CodeBuffer c(stub_blob); |
2111 | 1455 |
VM_Version_StubGenerator g(&c); |
23527
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
1456 |
get_cpu_info_stub = CAST_TO_FN_PTR(get_cpu_info_stub_t, |
397b6816032d
8038633: crash in VM_Version::get_processor_features() on startup
kvn
parents:
23491
diff
changeset
|
1457 |
g.generate_get_cpu_info()); |
2111 | 1458 |
|
1459 |
get_processor_features(); |
|
1460 |
} |