1 /* 2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2012, 2019 SAP SE. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 24 */ 25 26 #ifndef CPU_PPC_VM_VERSION_PPC_HPP 27 #define CPU_PPC_VM_VERSION_PPC_HPP 28 29 #include "runtime/globals_extension.hpp" 30 31 class VM_Version: public Abstract_VM_Version { 32 protected: 33 enum Feature_Flag { 34 fsqrt, 35 fsqrts, 36 isel, 37 lxarxeh, 38 cmpb, 39 popcntb, 40 popcntw, 41 fcfids, 42 vand, 43 lqarx, 44 vcipher, 45 vpmsumb, 46 mfdscr, 47 vsx, 48 ldbrx, 49 stdbrx, 50 vshasig, 51 rtm, 52 darn, 53 num_features // last entry to count features 54 }; 55 enum Feature_Flag_Set { 56 unknown_m = 0, 57 fsqrt_m = (1 << fsqrt ), 58 fsqrts_m = (1 << fsqrts ), 59 isel_m = (1 << isel ), 60 lxarxeh_m = (1 << lxarxeh), 61 cmpb_m = (1 << cmpb ), 62 popcntb_m = (1 << popcntb), 63 popcntw_m = (1 << popcntw), 64 fcfids_m = (1 << fcfids ), 65 vand_m = (1 << vand ), 66 lqarx_m = (1 << lqarx ), 67 vcipher_m = (1 << vcipher), 68 vpmsumb_m = (1 << vpmsumb), 69 mfdscr_m = (1 << mfdscr ), 70 vsx_m = (1 << vsx ), 71 ldbrx_m = (1 << ldbrx ), 72 stdbrx_m = (1 << stdbrx ), 73 vshasig_m = (1 << vshasig), 74 rtm_m = (1 << rtm ), 75 darn_m = (1 << darn ), 76 all_features_m = (unsigned long)-1 77 }; 78 79 static bool _is_determine_features_test_running; 80 81 static void print_features(); 82 static void determine_features(); // also measures cache line size 83 static void config_dscr(); // Power 8: Configure Data Stream Control Register. 84 static void determine_section_size(); 85 static void power6_micro_bench(); 86 public: 87 // Initialization 88 static void initialize(); 89 static void check_virtualizations(); 90 91 // Override Abstract_VM_Version implementation 92 static void print_platform_virtualization_info(outputStream*); 93 94 // Override Abstract_VM_Version implementation 95 static bool use_biased_locking(); 96 97 // PPC64 supports fast class initialization checks for static methods. 98 static bool supports_fast_class_init_checks() { return true; } 99 100 static bool is_determine_features_test_running() { return _is_determine_features_test_running; } 101 // CPU instruction support 102 static bool has_fsqrt() { return (_features & fsqrt_m) != 0; } 103 static bool has_fsqrts() { return (_features & fsqrts_m) != 0; } 104 static bool has_isel() { return (_features & isel_m) != 0; } 105 static bool has_lxarxeh() { return (_features & lxarxeh_m) !=0; } 106 static bool has_cmpb() { return (_features & cmpb_m) != 0; } 107 static bool has_popcntb() { return (_features & popcntb_m) != 0; } 108 static bool has_popcntw() { return (_features & popcntw_m) != 0; } 109 static bool has_fcfids() { return (_features & fcfids_m) != 0; } 110 static bool has_vand() { return (_features & vand_m) != 0; } 111 static bool has_lqarx() { return (_features & lqarx_m) != 0; } 112 static bool has_vcipher() { return (_features & vcipher_m) != 0; } 113 static bool has_vpmsumb() { return (_features & vpmsumb_m) != 0; } 114 static bool has_mfdscr() { return (_features & mfdscr_m) != 0; } 115 static bool has_vsx() { return (_features & vsx_m) != 0; } 116 static bool has_ldbrx() { return (_features & ldbrx_m) != 0; } 117 static bool has_stdbrx() { return (_features & stdbrx_m) != 0; } 118 static bool has_vshasig() { return (_features & vshasig_m) != 0; } 119 static bool has_tm() { return (_features & rtm_m) != 0; } 120 static bool has_darn() { return (_features & darn_m) != 0; } 121 122 static bool has_mtfprd() { return has_vpmsumb(); } // alias for P8 123 124 // Assembler testing 125 static void allow_all(); 126 static void revert(); 127 128 // POWER 8: DSCR current value. 129 static uint64_t _dscr_val; 130 }; 131 132 #endif // CPU_PPC_VM_VERSION_PPC_HPP