8212481: PPC64: Enable POWER9 CPU detection

Reviewed-by: mdoerr, simonis
This commit is contained in:
Gustavo Romero 2018-10-16 16:26:28 -04:00
parent 307ba484e1
commit 84a22b6b36
4 changed files with 30 additions and 10 deletions

View File

@ -535,6 +535,9 @@ class Assembler : public AbstractAssembler {
XVMULSP_OPCODE = (60u << OPCODE_SHIFT | 80u << 3), XVMULSP_OPCODE = (60u << OPCODE_SHIFT | 80u << 3),
XVMULDP_OPCODE = (60u << OPCODE_SHIFT | 112u << 3), XVMULDP_OPCODE = (60u << OPCODE_SHIFT | 112u << 3),
// Deliver A Random Number (introduced with POWER9)
DARN_OPCODE = (31u << OPCODE_SHIFT | 755u << 1),
// Vector Permute and Formatting // Vector Permute and Formatting
VPKPX_OPCODE = (4u << OPCODE_SHIFT | 782u ), VPKPX_OPCODE = (4u << OPCODE_SHIFT | 782u ),
VPKSHSS_OPCODE = (4u << OPCODE_SHIFT | 398u ), VPKSHSS_OPCODE = (4u << OPCODE_SHIFT | 398u ),
@ -1072,6 +1075,7 @@ class Assembler : public AbstractAssembler {
static int frt( int x) { return opp_u_field(x, 10, 6); } static int frt( int x) { return opp_u_field(x, 10, 6); }
static int fxm( int x) { return opp_u_field(x, 19, 12); } static int fxm( int x) { return opp_u_field(x, 19, 12); }
static int l10( int x) { return opp_u_field(x, 10, 10); } static int l10( int x) { return opp_u_field(x, 10, 10); }
static int l14( int x) { return opp_u_field(x, 15, 14); }
static int l15( int x) { return opp_u_field(x, 15, 15); } static int l15( int x) { return opp_u_field(x, 15, 15); }
static int l910( int x) { return opp_u_field(x, 10, 9); } static int l910( int x) { return opp_u_field(x, 10, 9); }
static int e1215( int x) { return opp_u_field(x, 15, 12); } static int e1215( int x) { return opp_u_field(x, 15, 12); }
@ -2220,6 +2224,9 @@ class Assembler : public AbstractAssembler {
inline void mtfprwa( FloatRegister d, Register a); inline void mtfprwa( FloatRegister d, Register a);
inline void mffprd( Register a, FloatRegister d); inline void mffprd( Register a, FloatRegister d);
// Deliver A Random Number (introduced with POWER9)
inline void darn( Register d, int l = 1 /*L=CRN*/);
// AES (introduced with Power 8) // AES (introduced with Power 8)
inline void vcipher( VectorRegister d, VectorRegister a, VectorRegister b); inline void vcipher( VectorRegister d, VectorRegister a, VectorRegister b);
inline void vcipherlast( VectorRegister d, VectorRegister a, VectorRegister b); inline void vcipherlast( VectorRegister d, VectorRegister a, VectorRegister b);

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017 SAP SE. All rights reserved. * Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -979,6 +979,9 @@ inline void Assembler::tsuspend_() { emit_int32( TS
inline void Assembler::tresume_() { emit_int32( TSR_OPCODE | /*L=1*/ 1u << (31-10) | rc(1)); } inline void Assembler::tresume_() { emit_int32( TSR_OPCODE | /*L=1*/ 1u << (31-10) | rc(1)); }
inline void Assembler::tcheck(int f) { emit_int32( TCHECK_OPCODE | bf(f)); } inline void Assembler::tcheck(int f) { emit_int32( TCHECK_OPCODE | bf(f)); }
// Deliver A Random Number (introduced with POWER9)
inline void Assembler::darn(Register d, int l /* =1 */) { emit_int32( DARN_OPCODE | rt(d) | l14(l)); }
// ra0 version // ra0 version
inline void Assembler::lwzx( Register d, Register s2) { emit_int32( LWZX_OPCODE | rt(d) | rb(s2));} inline void Assembler::lwzx( Register d, Register s2) { emit_int32( LWZX_OPCODE | rt(d) | rb(s2));}
inline void Assembler::lwz( Register d, int si16 ) { emit_int32( LWZ_OPCODE | rt(d) | d1(si16));} inline void Assembler::lwz( Register d, int si16 ) { emit_int32( LWZ_OPCODE | rt(d) | d1(si16));}

View File

@ -63,7 +63,9 @@ void VM_Version::initialize() {
// If PowerArchitecturePPC64 hasn't been specified explicitly determine from features. // If PowerArchitecturePPC64 hasn't been specified explicitly determine from features.
if (FLAG_IS_DEFAULT(PowerArchitecturePPC64)) { if (FLAG_IS_DEFAULT(PowerArchitecturePPC64)) {
if (VM_Version::has_lqarx()) { if (VM_Version::has_darn()) {
FLAG_SET_ERGO(uintx, PowerArchitecturePPC64, 9);
} else if (VM_Version::has_lqarx()) {
FLAG_SET_ERGO(uintx, PowerArchitecturePPC64, 8); FLAG_SET_ERGO(uintx, PowerArchitecturePPC64, 8);
} else if (VM_Version::has_popcntw()) { } else if (VM_Version::has_popcntw()) {
FLAG_SET_ERGO(uintx, PowerArchitecturePPC64, 7); FLAG_SET_ERGO(uintx, PowerArchitecturePPC64, 7);
@ -78,6 +80,7 @@ void VM_Version::initialize() {
bool PowerArchitecturePPC64_ok = false; bool PowerArchitecturePPC64_ok = false;
switch (PowerArchitecturePPC64) { switch (PowerArchitecturePPC64) {
case 9: if (!VM_Version::has_darn() ) break;
case 8: if (!VM_Version::has_lqarx() ) break; case 8: if (!VM_Version::has_lqarx() ) break;
case 7: if (!VM_Version::has_popcntw()) break; case 7: if (!VM_Version::has_popcntw()) break;
case 6: if (!VM_Version::has_cmpb() ) break; case 6: if (!VM_Version::has_cmpb() ) break;
@ -131,12 +134,11 @@ void VM_Version::initialize() {
// Create and print feature-string. // Create and print feature-string.
char buf[(num_features+1) * 16]; // Max 16 chars per feature. char buf[(num_features+1) * 16]; // Max 16 chars per feature.
jio_snprintf(buf, sizeof(buf), jio_snprintf(buf, sizeof(buf),
"ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
(has_fsqrt() ? " fsqrt" : ""), (has_fsqrt() ? " fsqrt" : ""),
(has_isel() ? " isel" : ""), (has_isel() ? " isel" : ""),
(has_lxarxeh() ? " lxarxeh" : ""), (has_lxarxeh() ? " lxarxeh" : ""),
(has_cmpb() ? " cmpb" : ""), (has_cmpb() ? " cmpb" : ""),
//(has_mftgpr()? " mftgpr" : ""),
(has_popcntb() ? " popcntb" : ""), (has_popcntb() ? " popcntb" : ""),
(has_popcntw() ? " popcntw" : ""), (has_popcntw() ? " popcntw" : ""),
(has_fcfids() ? " fcfids" : ""), (has_fcfids() ? " fcfids" : ""),
@ -149,7 +151,8 @@ void VM_Version::initialize() {
(has_ldbrx() ? " ldbrx" : ""), (has_ldbrx() ? " ldbrx" : ""),
(has_stdbrx() ? " stdbrx" : ""), (has_stdbrx() ? " stdbrx" : ""),
(has_vshasig() ? " sha" : ""), (has_vshasig() ? " sha" : ""),
(has_tm() ? " rtm" : "") (has_tm() ? " rtm" : ""),
(has_darn() ? " darn" : "")
// Make sure number of %s matches num_features! // Make sure number of %s matches num_features!
); );
_features_string = os::strdup(buf); _features_string = os::strdup(buf);
@ -663,6 +666,8 @@ void VM_Version::determine_features() {
a->ldbrx(R7, R3_ARG1, R4_ARG2); // code[14] -> ldbrx a->ldbrx(R7, R3_ARG1, R4_ARG2); // code[14] -> ldbrx
a->stdbrx(R7, R3_ARG1, R4_ARG2); // code[15] -> stdbrx a->stdbrx(R7, R3_ARG1, R4_ARG2); // code[15] -> stdbrx
a->vshasigmaw(VR0, VR1, 1, 0xF); // code[16] -> vshasig a->vshasigmaw(VR0, VR1, 1, 0xF); // code[16] -> vshasig
// rtm is determined by OS
a->darn(R7); // code[17] -> darn
a->blr(); a->blr();
// Emit function to set one cache line to zero. Emit function descriptor and get pointer to it. // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it.
@ -714,6 +719,8 @@ void VM_Version::determine_features() {
if (code[feature_cntr++]) features |= ldbrx_m; if (code[feature_cntr++]) features |= ldbrx_m;
if (code[feature_cntr++]) features |= stdbrx_m; if (code[feature_cntr++]) features |= stdbrx_m;
if (code[feature_cntr++]) features |= vshasig_m; if (code[feature_cntr++]) features |= vshasig_m;
// feature rtm_m is determined by OS
if (code[feature_cntr++]) features |= darn_m;
// Print the detection code. // Print the detection code.
if (PrintAssembly) { if (PrintAssembly) {

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017 SAP SE. All rights reserved. * Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -50,6 +50,7 @@ protected:
stdbrx, stdbrx,
vshasig, vshasig,
rtm, rtm,
darn,
num_features // last entry to count features num_features // last entry to count features
}; };
enum Feature_Flag_Set { enum Feature_Flag_Set {
@ -72,6 +73,7 @@ protected:
stdbrx_m = (1 << stdbrx ), stdbrx_m = (1 << stdbrx ),
vshasig_m = (1 << vshasig), vshasig_m = (1 << vshasig),
rtm_m = (1 << rtm ), rtm_m = (1 << rtm ),
darn_m = (1 << darn ),
all_features_m = (unsigned long)-1 all_features_m = (unsigned long)-1
}; };
@ -108,9 +110,10 @@ public:
static bool has_ldbrx() { return (_features & ldbrx_m) != 0; } static bool has_ldbrx() { return (_features & ldbrx_m) != 0; }
static bool has_stdbrx() { return (_features & stdbrx_m) != 0; } static bool has_stdbrx() { return (_features & stdbrx_m) != 0; }
static bool has_vshasig() { return (_features & vshasig_m) != 0; } static bool has_vshasig() { return (_features & vshasig_m) != 0; }
static bool has_mtfprd() { return has_vpmsumb(); } // alias for P8
// OS feature support
static bool has_tm() { return (_features & rtm_m) != 0; } static bool has_tm() { return (_features & rtm_m) != 0; }
static bool has_darn() { return (_features & darn_m) != 0; }
static bool has_mtfprd() { return has_vpmsumb(); } // alias for P8
// Assembler testing // Assembler testing
static void allow_all(); static void allow_all();