Changeset 229988 in webkit for trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
- Timestamp:
- Mar 26, 2018, 2:07:21 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
r229609 r229988 31 31 #include "ProbeContext.h" 32 32 #include <wtf/InlineASM.h> 33 34 #if COMPILER(MSVC) 35 #include <intrin.h> 36 #endif 33 37 34 38 namespace JSC { … … 758 762 #endif // ENABLE(MASM_PROBE) 759 763 760 #if CPU(X86) && !OS(MAC_OS_X) 761 MacroAssemblerX86Common::SSE2CheckState MacroAssemblerX86Common::s_sse2CheckState = NotCheckedSSE2; 764 MacroAssemblerX86Common::CPUID MacroAssemblerX86Common::getCPUID(unsigned level) 765 { 766 return getCPUIDEx(level, 0); 767 } 768 769 MacroAssemblerX86Common::CPUID MacroAssemblerX86Common::getCPUIDEx(unsigned level, unsigned count) 770 { 771 CPUID result { }; 772 #if COMPILER(MSVC) 773 __cpuidex(bitwise_cast<int*>(result.data()), level, count); 774 #else 775 __asm__ ( 776 "cpuid\n" 777 : "=a"(result[0]), "=b"(result[1]), "=c"(result[2]), "=d"(result[3]) 778 : "0"(level), "2"(count) 779 ); 762 780 #endif 763 781 return result; 782 } 783 784 void MacroAssemblerX86Common::collectCPUFeatures() 785 { 786 static std::once_flag onceKey; 787 std::call_once(onceKey, [] { 788 { 789 CPUID cpuid = getCPUID(0x1); 790 s_sse2CheckState = (cpuid[3] & (1 << 26)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear; 791 s_sse4_1CheckState = (cpuid[2] & (1 << 19)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear; 792 s_sse4_2CheckState = (cpuid[2] & (1 << 20)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear; 793 s_popcntCheckState = (cpuid[2] & (1 << 23)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear; 794 s_avxCheckState = (cpuid[2] & (1 << 28)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear; 795 } 796 { 797 CPUID cpuid = getCPUID(0x7); 798 s_bmi1CheckState = (cpuid[2] & (1 << 3)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear; 799 } 800 { 801 CPUID cpuid = getCPUID(0x80000001); 802 s_lzcntCheckState = (cpuid[2] & (1 << 5)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear; 803 } 804 }); 805 } 806 807 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_sse2CheckState = CPUIDCheckState::NotChecked; 764 808 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_sse4_1CheckState = CPUIDCheckState::NotChecked; 809 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_sse4_2CheckState = CPUIDCheckState::NotChecked; 765 810 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_avxCheckState = CPUIDCheckState::NotChecked; 766 811 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_lzcntCheckState = CPUIDCheckState::NotChecked; 767 812 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_bmi1CheckState = CPUIDCheckState::NotChecked; 813 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_popcntCheckState = CPUIDCheckState::NotChecked; 768 814 769 815 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.