1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/cpu/ppc/vm/vm_version_ppc.hpp Fri Aug 02 16:46:45 2013 +0200 1.3 @@ -0,0 +1,93 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright 2012, 2013 SAP AG. All rights reserved. 1.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 + * 1.9 + * This code is free software; you can redistribute it and/or modify it 1.10 + * under the terms of the GNU General Public License version 2 only, as 1.11 + * published by the Free Software Foundation. 1.12 + * 1.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.16 + * version 2 for more details (a copy is included in the LICENSE file that 1.17 + * accompanied this code). 1.18 + * 1.19 + * You should have received a copy of the GNU General Public License version 1.20 + * 2 along with this work; if not, write to the Free Software Foundation, 1.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.22 + * 1.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.24 + * or visit www.oracle.com if you need additional information or have any 1.25 + * questions. 1.26 + * 1.27 + */ 1.28 + 1.29 +#ifndef CPU_PPC_VM_VM_VERSION_PPC_HPP 1.30 +#define CPU_PPC_VM_VM_VERSION_PPC_HPP 1.31 + 1.32 +#include "runtime/globals_extension.hpp" 1.33 +#include "runtime/vm_version.hpp" 1.34 + 1.35 +class VM_Version: public Abstract_VM_Version { 1.36 +protected: 1.37 + enum Feature_Flag { 1.38 + fsqrt, 1.39 + isel, 1.40 + lxarxeh, 1.41 + cmpb, 1.42 + popcntb, 1.43 + popcntw, 1.44 + fcfids, 1.45 + vand, 1.46 + dcba, 1.47 + num_features // last entry to count features 1.48 + }; 1.49 + enum Feature_Flag_Set { 1.50 + unknown_m = 0, 1.51 + fsqrt_m = (1 << fsqrt ), 1.52 + isel_m = (1 << isel ), 1.53 + lxarxeh_m = (1 << lxarxeh), 1.54 + cmpb_m = (1 << cmpb ), 1.55 + popcntb_m = (1 << popcntb), 1.56 + popcntw_m = (1 << popcntw), 1.57 + fcfids_m = (1 << fcfids ), 1.58 + vand_m = (1 << vand ), 1.59 + dcba_m = (1 << dcba ), 1.60 + all_features_m = -1 1.61 + }; 1.62 + static int _features; 1.63 + static int _measured_cache_line_size; 1.64 + static const char* _features_str; 1.65 + static bool _is_determine_features_test_running; 1.66 + 1.67 + static void print_features(); 1.68 + static void determine_features(); // also measures cache line size 1.69 + static void determine_section_size(); 1.70 + static void power6_micro_bench(); 1.71 +public: 1.72 + // Initialization 1.73 + static void initialize(); 1.74 + 1.75 + static bool is_determine_features_test_running() { return _is_determine_features_test_running; } 1.76 + // CPU instruction support 1.77 + static bool has_fsqrt() { return (_features & fsqrt_m) != 0; } 1.78 + static bool has_isel() { return (_features & isel_m) != 0; } 1.79 + static bool has_lxarxeh() { return (_features & lxarxeh_m) !=0; } 1.80 + static bool has_cmpb() { return (_features & cmpb_m) != 0; } 1.81 + static bool has_popcntb() { return (_features & popcntb_m) != 0; } 1.82 + static bool has_popcntw() { return (_features & popcntw_m) != 0; } 1.83 + static bool has_fcfids() { return (_features & fcfids_m) != 0; } 1.84 + static bool has_vand() { return (_features & vand_m) != 0; } 1.85 + static bool has_dcba() { return (_features & dcba_m) != 0; } 1.86 + 1.87 + static const char* cpu_features() { return _features_str; } 1.88 + 1.89 + static int get_cache_line_size() { return _measured_cache_line_size; } 1.90 + 1.91 + // Assembler testing 1.92 + static void allow_all(); 1.93 + static void revert(); 1.94 +}; 1.95 + 1.96 +#endif // CPU_PPC_VM_VM_VERSION_PPC_HPP