src/cpu/ppc/vm/vm_version_ppc.cpp

changeset 9713
c4567d28f31f
parent 9684
69f33959c27f
child 9730
42118db355f5
equal deleted inserted replaced
9712:d7e1e002b496 9713:c4567d28f31f
108 #endif 108 #endif
109 109
110 // Create and print feature-string. 110 // Create and print feature-string.
111 char buf[(num_features+1) * 16]; // Max 16 chars per feature. 111 char buf[(num_features+1) * 16]; // Max 16 chars per feature.
112 jio_snprintf(buf, sizeof(buf), 112 jio_snprintf(buf, sizeof(buf),
113 "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s", 113 "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
114 (has_fsqrt() ? " fsqrt" : ""), 114 (has_fsqrt() ? " fsqrt" : ""),
115 (has_isel() ? " isel" : ""), 115 (has_isel() ? " isel" : ""),
116 (has_lxarxeh() ? " lxarxeh" : ""), 116 (has_lxarxeh() ? " lxarxeh" : ""),
117 (has_cmpb() ? " cmpb" : ""), 117 (has_cmpb() ? " cmpb" : ""),
118 //(has_mftgpr()? " mftgpr" : ""), 118 //(has_mftgpr()? " mftgpr" : ""),
122 (has_vand() ? " vand" : ""), 122 (has_vand() ? " vand" : ""),
123 (has_lqarx() ? " lqarx" : ""), 123 (has_lqarx() ? " lqarx" : ""),
124 (has_vcipher() ? " aes" : ""), 124 (has_vcipher() ? " aes" : ""),
125 (has_vpmsumb() ? " vpmsumb" : ""), 125 (has_vpmsumb() ? " vpmsumb" : ""),
126 (has_mfdscr() ? " mfdscr" : ""), 126 (has_mfdscr() ? " mfdscr" : ""),
127 (has_vsx() ? " vsx" : "") 127 (has_vsx() ? " vsx" : ""),
128 (has_vshasig() ? " sha" : "")
128 // Make sure number of %s matches num_features! 129 // Make sure number of %s matches num_features!
129 ); 130 );
130 _features_str = strdup(buf); 131 _features_str = strdup(buf);
131 if (Verbose) { 132 if (Verbose) {
132 print_features(); 133 print_features();
204 warning("AES intrinsics are not available on this CPU"); 205 warning("AES intrinsics are not available on this CPU");
205 FLAG_SET_DEFAULT(UseAESIntrinsics, false); 206 FLAG_SET_DEFAULT(UseAESIntrinsics, false);
206 } 207 }
207 #endif 208 #endif
208 209
209 if (UseSHA) { 210 if (has_vshasig()) {
210 warning("SHA instructions are not available on this CPU"); 211 if (FLAG_IS_DEFAULT(UseSHA)) {
212 UseSHA = true;
213 }
214 } else if (UseSHA) {
215 if (!FLAG_IS_DEFAULT(UseSHA))
216 warning("SHA instructions are not available on this CPU");
211 FLAG_SET_DEFAULT(UseSHA, false); 217 FLAG_SET_DEFAULT(UseSHA, false);
212 } 218 }
213 if (UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics) { 219
214 warning("SHA intrinsics are not available on this CPU"); 220 if (UseSHA1Intrinsics) {
221 warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU.");
215 FLAG_SET_DEFAULT(UseSHA1Intrinsics, false); 222 FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
223 }
224
225 if (UseSHA && has_vshasig()) {
226 if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
227 FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
228 }
229 } else if (UseSHA256Intrinsics) {
230 warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
216 FLAG_SET_DEFAULT(UseSHA256Intrinsics, false); 231 FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
232 }
233
234 if (UseSHA && has_vshasig()) {
235 if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
236 FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
237 }
238 } else if (UseSHA512Intrinsics) {
239 warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.");
217 FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); 240 FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
241 }
242
243 if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
244 FLAG_SET_DEFAULT(UseSHA, false);
218 } 245 }
219 246
220 if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) { 247 if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
221 UseMontgomeryMultiplyIntrinsic = true; 248 UseMontgomeryMultiplyIntrinsic = true;
222 } 249 }
501 a->lqarx_unchecked(R7, R3_ARG1, R4_ARG2, 1); // code[10] -> lqarx_m 528 a->lqarx_unchecked(R7, R3_ARG1, R4_ARG2, 1); // code[10] -> lqarx_m
502 a->vcipher(VR0, VR1, VR2); // code[11] -> vcipher 529 a->vcipher(VR0, VR1, VR2); // code[11] -> vcipher
503 a->vpmsumb(VR0, VR1, VR2); // code[12] -> vpmsumb 530 a->vpmsumb(VR0, VR1, VR2); // code[12] -> vpmsumb
504 a->mfdscr(R0); // code[13] -> mfdscr 531 a->mfdscr(R0); // code[13] -> mfdscr
505 a->lxvd2x(VSR0, R3_ARG1); // code[14] -> vsx 532 a->lxvd2x(VSR0, R3_ARG1); // code[14] -> vsx
533 a->vshasigmaw(VR0, VR1, 1, 0xF); // code[15] -> vshasig
506 a->blr(); 534 a->blr();
507 535
508 // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it. 536 // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it.
509 void (*zero_cacheline_func_ptr)(char*) = (void(*)(char*))(void *)a->function_entry(); 537 void (*zero_cacheline_func_ptr)(char*) = (void(*)(char*))(void *)a->function_entry();
510 a->dcbz(R3_ARG1); // R3_ARG1 = addr 538 a->dcbz(R3_ARG1); // R3_ARG1 = addr
549 if (code[feature_cntr++]) features |= lqarx_m; 577 if (code[feature_cntr++]) features |= lqarx_m;
550 if (code[feature_cntr++]) features |= vcipher_m; 578 if (code[feature_cntr++]) features |= vcipher_m;
551 if (code[feature_cntr++]) features |= vpmsumb_m; 579 if (code[feature_cntr++]) features |= vpmsumb_m;
552 if (code[feature_cntr++]) features |= mfdscr_m; 580 if (code[feature_cntr++]) features |= mfdscr_m;
553 if (code[feature_cntr++]) features |= vsx_m; 581 if (code[feature_cntr++]) features |= vsx_m;
582 if (code[feature_cntr++]) features |= vshasig_m;
554 583
555 // Print the detection code. 584 // Print the detection code.
556 if (PrintAssembly) { 585 if (PrintAssembly) {
557 ttyLocker ttyl; 586 ttyLocker ttyl;
558 tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " after execution:", p2i(code)); 587 tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " after execution:", p2i(code));

mercurial