Tue, 08 Aug 2017 15:57:29 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * Copyright 2012, 2014 SAP AG. All rights reserved. |
aoqi@0 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 5 | * |
aoqi@0 | 6 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 7 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 8 | * published by the Free Software Foundation. |
aoqi@0 | 9 | * |
aoqi@0 | 10 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 13 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 14 | * accompanied this code). |
aoqi@0 | 15 | * |
aoqi@0 | 16 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 17 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 19 | * |
aoqi@0 | 20 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 21 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 22 | * questions. |
aoqi@0 | 23 | * |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | #ifndef CPU_PPC_VM_VM_VERSION_PPC_HPP |
aoqi@0 | 27 | #define CPU_PPC_VM_VM_VERSION_PPC_HPP |
aoqi@0 | 28 | |
aoqi@0 | 29 | #include "runtime/globals_extension.hpp" |
aoqi@0 | 30 | #include "runtime/vm_version.hpp" |
aoqi@0 | 31 | |
aoqi@0 | 32 | class VM_Version: public Abstract_VM_Version { |
aoqi@0 | 33 | protected: |
aoqi@0 | 34 | enum Feature_Flag { |
aoqi@0 | 35 | fsqrt, |
aoqi@0 | 36 | fsqrts, |
aoqi@0 | 37 | isel, |
aoqi@0 | 38 | lxarxeh, |
aoqi@0 | 39 | cmpb, |
aoqi@0 | 40 | popcntb, |
aoqi@0 | 41 | popcntw, |
aoqi@0 | 42 | fcfids, |
aoqi@0 | 43 | vand, |
aoqi@0 | 44 | dcba, |
aoqi@0 | 45 | num_features // last entry to count features |
aoqi@0 | 46 | }; |
aoqi@0 | 47 | enum Feature_Flag_Set { |
aoqi@0 | 48 | unknown_m = 0, |
aoqi@0 | 49 | fsqrt_m = (1 << fsqrt ), |
aoqi@0 | 50 | fsqrts_m = (1 << fsqrts ), |
aoqi@0 | 51 | isel_m = (1 << isel ), |
aoqi@0 | 52 | lxarxeh_m = (1 << lxarxeh), |
aoqi@0 | 53 | cmpb_m = (1 << cmpb ), |
aoqi@0 | 54 | popcntb_m = (1 << popcntb), |
aoqi@0 | 55 | popcntw_m = (1 << popcntw), |
aoqi@0 | 56 | fcfids_m = (1 << fcfids ), |
aoqi@0 | 57 | vand_m = (1 << vand ), |
aoqi@0 | 58 | dcba_m = (1 << dcba ), |
aoqi@0 | 59 | all_features_m = -1 |
aoqi@0 | 60 | }; |
aoqi@0 | 61 | static int _features; |
aoqi@0 | 62 | static int _measured_cache_line_size; |
aoqi@0 | 63 | static const char* _features_str; |
aoqi@0 | 64 | static bool _is_determine_features_test_running; |
aoqi@0 | 65 | |
aoqi@0 | 66 | static void print_features(); |
aoqi@0 | 67 | static void determine_features(); // also measures cache line size |
aoqi@0 | 68 | static void determine_section_size(); |
aoqi@0 | 69 | static void power6_micro_bench(); |
aoqi@0 | 70 | public: |
aoqi@0 | 71 | // Initialization |
aoqi@0 | 72 | static void initialize(); |
aoqi@0 | 73 | |
aoqi@0 | 74 | static bool is_determine_features_test_running() { return _is_determine_features_test_running; } |
aoqi@0 | 75 | // CPU instruction support |
aoqi@0 | 76 | static bool has_fsqrt() { return (_features & fsqrt_m) != 0; } |
aoqi@0 | 77 | static bool has_fsqrts() { return (_features & fsqrts_m) != 0; } |
aoqi@0 | 78 | static bool has_isel() { return (_features & isel_m) != 0; } |
aoqi@0 | 79 | static bool has_lxarxeh() { return (_features & lxarxeh_m) !=0; } |
aoqi@0 | 80 | static bool has_cmpb() { return (_features & cmpb_m) != 0; } |
aoqi@0 | 81 | static bool has_popcntb() { return (_features & popcntb_m) != 0; } |
aoqi@0 | 82 | static bool has_popcntw() { return (_features & popcntw_m) != 0; } |
aoqi@0 | 83 | static bool has_fcfids() { return (_features & fcfids_m) != 0; } |
aoqi@0 | 84 | static bool has_vand() { return (_features & vand_m) != 0; } |
aoqi@0 | 85 | static bool has_dcba() { return (_features & dcba_m) != 0; } |
aoqi@0 | 86 | |
aoqi@0 | 87 | static const char* cpu_features() { return _features_str; } |
aoqi@0 | 88 | |
aoqi@0 | 89 | static int get_cache_line_size() { return _measured_cache_line_size; } |
aoqi@0 | 90 | |
aoqi@0 | 91 | // Assembler testing |
aoqi@0 | 92 | static void allow_all(); |
aoqi@0 | 93 | static void revert(); |
aoqi@0 | 94 | }; |
aoqi@0 | 95 | |
aoqi@0 | 96 | #endif // CPU_PPC_VM_VM_VERSION_PPC_HPP |