240 //
241 __ xorl(rcx, rcx); // zero for XCR0 register
242 __ xgetbv();
243 __ lea(rsi, Address(rbp, in_bytes(VM_Version::xem_xcr0_offset())));
244 __ movl(Address(rsi, 0), rax);
245 __ movl(Address(rsi, 4), rdx);
246
247 //
248 // cpuid(0x7) Structured Extended Features
249 //
250 __ bind(sef_cpuid);
251 __ movl(rax, 7);
252 __ cmpl(rax, Address(rbp, in_bytes(VM_Version::std_cpuid0_offset()))); // Is cpuid(0x7) supported?
253 __ jccb(Assembler::greater, ext_cpuid);
254
255 __ xorl(rcx, rcx);
256 __ cpuid();
257 __ lea(rsi, Address(rbp, in_bytes(VM_Version::sef_cpuid7_offset())));
258 __ movl(Address(rsi, 0), rax);
259 __ movl(Address(rsi, 4), rbx);
260
261 //
262 // Extended cpuid(0x80000000)
263 //
264 __ bind(ext_cpuid);
265 __ movl(rax, 0x80000000);
266 __ cpuid();
267 __ cmpl(rax, 0x80000000); // Is cpuid(0x80000001) supported?
268 __ jcc(Assembler::belowEqual, done);
269 __ cmpl(rax, 0x80000004); // Is cpuid(0x80000005) supported?
270 __ jcc(Assembler::belowEqual, ext_cpuid1);
271 __ cmpl(rax, 0x80000006); // Is cpuid(0x80000007) supported?
272 __ jccb(Assembler::belowEqual, ext_cpuid5);
273 __ cmpl(rax, 0x80000007); // Is cpuid(0x80000008) supported?
274 __ jccb(Assembler::belowEqual, ext_cpuid7);
275 __ cmpl(rax, 0x80000008); // Is cpuid(0x80000009 and above) supported?
276 __ jccb(Assembler::belowEqual, ext_cpuid8);
277 __ cmpl(rax, 0x8000001E); // Is cpuid(0x8000001E) supported?
278 __ jccb(Assembler::below, ext_cpuid8);
279 //
645 } else {
646 use_avx_limit = 0;
647 }
648 }
649 if (FLAG_IS_DEFAULT(UseAVX)) {
650 FLAG_SET_DEFAULT(UseAVX, use_avx_limit);
651 } else if (UseAVX > use_avx_limit) {
652 warning("UseAVX=%d is not supported on this CPU, setting it to UseAVX=%d", (int) UseAVX, use_avx_limit);
653 FLAG_SET_DEFAULT(UseAVX, use_avx_limit);
654 } else if (UseAVX < 0) {
655 warning("UseAVX=%d is not valid, setting it to UseAVX=0", (int) UseAVX);
656 FLAG_SET_DEFAULT(UseAVX, 0);
657 }
658
659 if (UseAVX < 3) {
660 _features &= ~CPU_AVX512F;
661 _features &= ~CPU_AVX512DQ;
662 _features &= ~CPU_AVX512CD;
663 _features &= ~CPU_AVX512BW;
664 _features &= ~CPU_AVX512VL;
665 }
666
667 if (UseAVX < 2)
668 _features &= ~CPU_AVX2;
669
670 if (UseAVX < 1) {
671 _features &= ~CPU_AVX;
672 _features &= ~CPU_VZEROUPPER;
673 }
674
675 if (logical_processors_per_package() == 1) {
676 // HT processor could be installed on a system which doesn't support HT.
677 _features &= ~CPU_HT;
678 }
679
680 if( is_intel() ) { // Intel cpus specific settings
681 if (is_knights_family()) {
682 _features &= ~CPU_VZEROUPPER;
683 }
684 }
|
240 //
241 __ xorl(rcx, rcx); // zero for XCR0 register
242 __ xgetbv();
243 __ lea(rsi, Address(rbp, in_bytes(VM_Version::xem_xcr0_offset())));
244 __ movl(Address(rsi, 0), rax);
245 __ movl(Address(rsi, 4), rdx);
246
247 //
248 // cpuid(0x7) Structured Extended Features
249 //
250 __ bind(sef_cpuid);
251 __ movl(rax, 7);
252 __ cmpl(rax, Address(rbp, in_bytes(VM_Version::std_cpuid0_offset()))); // Is cpuid(0x7) supported?
253 __ jccb(Assembler::greater, ext_cpuid);
254
255 __ xorl(rcx, rcx);
256 __ cpuid();
257 __ lea(rsi, Address(rbp, in_bytes(VM_Version::sef_cpuid7_offset())));
258 __ movl(Address(rsi, 0), rax);
259 __ movl(Address(rsi, 4), rbx);
260 __ movl(Address(rsi, 8), rcx);
261 __ movl(Address(rsi, 12), rdx);
262
263 //
264 // Extended cpuid(0x80000000)
265 //
266 __ bind(ext_cpuid);
267 __ movl(rax, 0x80000000);
268 __ cpuid();
269 __ cmpl(rax, 0x80000000); // Is cpuid(0x80000001) supported?
270 __ jcc(Assembler::belowEqual, done);
271 __ cmpl(rax, 0x80000004); // Is cpuid(0x80000005) supported?
272 __ jcc(Assembler::belowEqual, ext_cpuid1);
273 __ cmpl(rax, 0x80000006); // Is cpuid(0x80000007) supported?
274 __ jccb(Assembler::belowEqual, ext_cpuid5);
275 __ cmpl(rax, 0x80000007); // Is cpuid(0x80000008) supported?
276 __ jccb(Assembler::belowEqual, ext_cpuid7);
277 __ cmpl(rax, 0x80000008); // Is cpuid(0x80000009 and above) supported?
278 __ jccb(Assembler::belowEqual, ext_cpuid8);
279 __ cmpl(rax, 0x8000001E); // Is cpuid(0x8000001E) supported?
280 __ jccb(Assembler::below, ext_cpuid8);
281 //
647 } else {
648 use_avx_limit = 0;
649 }
650 }
651 if (FLAG_IS_DEFAULT(UseAVX)) {
652 FLAG_SET_DEFAULT(UseAVX, use_avx_limit);
653 } else if (UseAVX > use_avx_limit) {
654 warning("UseAVX=%d is not supported on this CPU, setting it to UseAVX=%d", (int) UseAVX, use_avx_limit);
655 FLAG_SET_DEFAULT(UseAVX, use_avx_limit);
656 } else if (UseAVX < 0) {
657 warning("UseAVX=%d is not valid, setting it to UseAVX=0", (int) UseAVX);
658 FLAG_SET_DEFAULT(UseAVX, 0);
659 }
660
661 if (UseAVX < 3) {
662 _features &= ~CPU_AVX512F;
663 _features &= ~CPU_AVX512DQ;
664 _features &= ~CPU_AVX512CD;
665 _features &= ~CPU_AVX512BW;
666 _features &= ~CPU_AVX512VL;
667 _features &= ~CPU_AVX512_VPOPCNTDQ;
668 }
669
670 if (UseAVX < 2)
671 _features &= ~CPU_AVX2;
672
673 if (UseAVX < 1) {
674 _features &= ~CPU_AVX;
675 _features &= ~CPU_VZEROUPPER;
676 }
677
678 if (logical_processors_per_package() == 1) {
679 // HT processor could be installed on a system which doesn't support HT.
680 _features &= ~CPU_HT;
681 }
682
683 if( is_intel() ) { // Intel cpus specific settings
684 if (is_knights_family()) {
685 _features &= ~CPU_VZEROUPPER;
686 }
687 }
|