goetz@6458: /* gromero@9662: * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. gromero@9662: * Copyright 2012, 2018 SAP AG. All rights reserved. goetz@6458: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. goetz@6458: * goetz@6458: * This code is free software; you can redistribute it and/or modify it goetz@6458: * under the terms of the GNU General Public License version 2 only, as goetz@6458: * published by the Free Software Foundation. goetz@6458: * goetz@6458: * This code is distributed in the hope that it will be useful, but WITHOUT goetz@6458: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or goetz@6458: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License goetz@6458: * version 2 for more details (a copy is included in the LICENSE file that goetz@6458: * accompanied this code). goetz@6458: * goetz@6458: * You should have received a copy of the GNU General Public License version goetz@6458: * 2 along with this work; if not, write to the Free Software Foundation, goetz@6458: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. goetz@6458: * goetz@6458: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA goetz@6458: * or visit www.oracle.com if you need additional information or have any goetz@6458: * questions. goetz@6458: * goetz@6458: */ goetz@6458: goetz@6458: #ifndef CPU_PPC_VM_VM_VERSION_PPC_HPP goetz@6458: #define CPU_PPC_VM_VM_VERSION_PPC_HPP goetz@6458: goetz@6458: #include "runtime/globals_extension.hpp" goetz@6458: #include "runtime/vm_version.hpp" goetz@6458: goetz@6458: class VM_Version: public Abstract_VM_Version { goetz@6458: protected: goetz@6458: enum Feature_Flag { goetz@6458: fsqrt, goetz@6515: fsqrts, goetz@6458: isel, goetz@6458: lxarxeh, goetz@6458: cmpb, goetz@6458: popcntb, goetz@6458: popcntw, goetz@6458: fcfids, goetz@6458: vand, goetz@6458: dcba, gromero@9662: lqarx, simonis@8608: vcipher, mdoerr@9497: vpmsumb, gromero@9662: mfdscr, gromero@9662: vsx, ogatak@9713: vshasig, goetz@6458: num_features // last entry to count features goetz@6458: }; goetz@6458: enum Feature_Flag_Set { goetz@6458: unknown_m = 0, goetz@6458: fsqrt_m = (1 << fsqrt ), goetz@6515: fsqrts_m = (1 << fsqrts ), goetz@6458: isel_m = (1 << isel ), goetz@6458: lxarxeh_m = (1 << lxarxeh), goetz@6458: cmpb_m = (1 << cmpb ), goetz@6458: popcntb_m = (1 << popcntb), goetz@6458: popcntw_m = (1 << popcntw), goetz@6458: fcfids_m = (1 << fcfids ), goetz@6458: vand_m = (1 << vand ), goetz@6458: dcba_m = (1 << dcba ), gromero@9662: lqarx_m = (1 << lqarx ), simonis@8608: vcipher_m = (1 << vcipher), ogatak@9713: vshasig_m = (1 << vshasig), mdoerr@9497: vpmsumb_m = (1 << vpmsumb), gromero@9662: mfdscr_m = (1 << mfdscr ), gromero@9662: vsx_m = (1 << vsx ), goetz@6458: all_features_m = -1 goetz@6458: }; goetz@6458: static int _features; goetz@6458: static int _measured_cache_line_size; goetz@6458: static const char* _features_str; goetz@6458: static bool _is_determine_features_test_running; goetz@6458: goetz@6458: static void print_features(); goetz@6458: static void determine_features(); // also measures cache line size gromero@9662: static void config_dscr(); // Power 8: Configure Data Stream Control Register. goetz@6458: static void determine_section_size(); goetz@6458: static void power6_micro_bench(); goetz@6458: public: goetz@6458: // Initialization goetz@6458: static void initialize(); goetz@6458: goetz@6458: static bool is_determine_features_test_running() { return _is_determine_features_test_running; } goetz@6458: // CPU instruction support goetz@6458: static bool has_fsqrt() { return (_features & fsqrt_m) != 0; } goetz@6515: static bool has_fsqrts() { return (_features & fsqrts_m) != 0; } goetz@6458: static bool has_isel() { return (_features & isel_m) != 0; } goetz@6458: static bool has_lxarxeh() { return (_features & lxarxeh_m) !=0; } goetz@6458: static bool has_cmpb() { return (_features & cmpb_m) != 0; } goetz@6458: static bool has_popcntb() { return (_features & popcntb_m) != 0; } goetz@6458: static bool has_popcntw() { return (_features & popcntw_m) != 0; } goetz@6458: static bool has_fcfids() { return (_features & fcfids_m) != 0; } goetz@6458: static bool has_vand() { return (_features & vand_m) != 0; } goetz@6458: static bool has_dcba() { return (_features & dcba_m) != 0; } gromero@9662: static bool has_lqarx() { return (_features & lqarx_m) != 0; } simonis@8608: static bool has_vcipher() { return (_features & vcipher_m) != 0; } mdoerr@9497: static bool has_vpmsumb() { return (_features & vpmsumb_m) != 0; } gromero@9662: static bool has_mfdscr() { return (_features & mfdscr_m) != 0; } gromero@9662: static bool has_vsx() { return (_features & vsx_m) != 0; } ogatak@9713: static bool has_vshasig() { return (_features & vshasig_m) != 0; } goetz@6458: goetz@6458: static const char* cpu_features() { return _features_str; } goetz@6458: goetz@6458: static int get_cache_line_size() { return _measured_cache_line_size; } goetz@6458: goetz@6458: // Assembler testing goetz@6458: static void allow_all(); goetz@6458: static void revert(); gromero@9662: gromero@9662: // POWER 8: DSCR current value. gromero@9662: static uint64_t _dscr_val; goetz@6458: }; goetz@6458: goetz@6458: #endif // CPU_PPC_VM_VM_VERSION_PPC_HPP