src/cpu/ppc/vm/vm_version_ppc.hpp

Tue, 18 Jun 2019 09:33:34 -0400

author
ogatak
date
Tue, 18 Jun 2019 09:33:34 -0400
changeset 9713
c4567d28f31f
parent 9662
6eedcffa129d
child 9756
2be326848943
permissions
-rw-r--r--

8185979: PPC64: Implement SHA2 intrinsic
Reviewed-by: mdoerr, goetz
Contributed-by: Bruno Rosa <bruno.rosa@eldorado.org.br>, Gustavo Serra Scalet <gustavo.scalet@eldorado.org.br>, Igor Nunes <igor.nunes@eldorado.org.br>, Martin Doerr <martin.doerr@sap.com>

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

mercurial