src/cpu/ppc/vm/vm_version_ppc.cpp

changeset 9756
2be326848943
parent 9703
2fdf635bcf28
parent 9730
42118db355f5
child 9806
758c07667682
equal deleted inserted replaced
9707:b87dc103bf45 9756:2be326848943
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();
171 FLAG_SET_DEFAULT(UseCRC32Intrinsics, true); 172 FLAG_SET_DEFAULT(UseCRC32Intrinsics, true);
172 } 173 }
173 } 174 }
174 175
175 // The AES intrinsic stubs require AES instruction support. 176 // The AES intrinsic stubs require AES instruction support.
176 #if defined(VM_LITTLE_ENDIAN)
177 if (has_vcipher()) { 177 if (has_vcipher()) {
178 if (FLAG_IS_DEFAULT(UseAES)) { 178 if (FLAG_IS_DEFAULT(UseAES)) {
179 UseAES = true; 179 UseAES = true;
180 } 180 }
181 } else if (UseAES) { 181 } else if (UseAES) {
192 if (!FLAG_IS_DEFAULT(UseAESIntrinsics)) 192 if (!FLAG_IS_DEFAULT(UseAESIntrinsics))
193 warning("AES intrinsics are not available on this CPU"); 193 warning("AES intrinsics are not available on this CPU");
194 FLAG_SET_DEFAULT(UseAESIntrinsics, false); 194 FLAG_SET_DEFAULT(UseAESIntrinsics, false);
195 } 195 }
196 196
197 #else 197 if (has_vshasig()) {
198 if (UseAES) { 198 if (FLAG_IS_DEFAULT(UseSHA)) {
199 warning("AES instructions are not available on this CPU"); 199 UseSHA = true;
200 FLAG_SET_DEFAULT(UseAES, false); 200 }
201 } 201 } else if (UseSHA) {
202 if (UseAESIntrinsics) { 202 if (!FLAG_IS_DEFAULT(UseSHA))
203 if (!FLAG_IS_DEFAULT(UseAESIntrinsics)) 203 warning("SHA instructions are not available on this CPU");
204 warning("AES intrinsics are not available on this CPU");
205 FLAG_SET_DEFAULT(UseAESIntrinsics, false);
206 }
207 #endif
208
209 if (UseSHA) {
210 warning("SHA instructions are not available on this CPU");
211 FLAG_SET_DEFAULT(UseSHA, false); 204 FLAG_SET_DEFAULT(UseSHA, false);
212 } 205 }
213 if (UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics) { 206
214 warning("SHA intrinsics are not available on this CPU"); 207 if (UseSHA1Intrinsics) {
208 warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU.");
215 FLAG_SET_DEFAULT(UseSHA1Intrinsics, false); 209 FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
210 }
211
212 if (UseSHA && has_vshasig()) {
213 if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
214 FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
215 }
216 } else if (UseSHA256Intrinsics) {
217 warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
216 FLAG_SET_DEFAULT(UseSHA256Intrinsics, false); 218 FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
219 }
220
221 if (UseSHA && has_vshasig()) {
222 if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
223 FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
224 }
225 } else if (UseSHA512Intrinsics) {
226 warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.");
217 FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); 227 FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
228 }
229
230 if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
231 FLAG_SET_DEFAULT(UseSHA, false);
218 } 232 }
219 233
220 if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) { 234 if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
221 UseMontgomeryMultiplyIntrinsic = true; 235 UseMontgomeryMultiplyIntrinsic = true;
222 } 236 }
501 a->lqarx_unchecked(R7, R3_ARG1, R4_ARG2, 1); // code[10] -> lqarx_m 515 a->lqarx_unchecked(R7, R3_ARG1, R4_ARG2, 1); // code[10] -> lqarx_m
502 a->vcipher(VR0, VR1, VR2); // code[11] -> vcipher 516 a->vcipher(VR0, VR1, VR2); // code[11] -> vcipher
503 a->vpmsumb(VR0, VR1, VR2); // code[12] -> vpmsumb 517 a->vpmsumb(VR0, VR1, VR2); // code[12] -> vpmsumb
504 a->mfdscr(R0); // code[13] -> mfdscr 518 a->mfdscr(R0); // code[13] -> mfdscr
505 a->lxvd2x(VSR0, R3_ARG1); // code[14] -> vsx 519 a->lxvd2x(VSR0, R3_ARG1); // code[14] -> vsx
520 a->vshasigmaw(VR0, VR1, 1, 0xF); // code[15] -> vshasig
506 a->blr(); 521 a->blr();
507 522
508 // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it. 523 // 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(); 524 void (*zero_cacheline_func_ptr)(char*) = (void(*)(char*))(void *)a->function_entry();
510 a->dcbz(R3_ARG1); // R3_ARG1 = addr 525 a->dcbz(R3_ARG1); // R3_ARG1 = addr
549 if (code[feature_cntr++]) features |= lqarx_m; 564 if (code[feature_cntr++]) features |= lqarx_m;
550 if (code[feature_cntr++]) features |= vcipher_m; 565 if (code[feature_cntr++]) features |= vcipher_m;
551 if (code[feature_cntr++]) features |= vpmsumb_m; 566 if (code[feature_cntr++]) features |= vpmsumb_m;
552 if (code[feature_cntr++]) features |= mfdscr_m; 567 if (code[feature_cntr++]) features |= mfdscr_m;
553 if (code[feature_cntr++]) features |= vsx_m; 568 if (code[feature_cntr++]) features |= vsx_m;
569 if (code[feature_cntr++]) features |= vshasig_m;
554 570
555 // Print the detection code. 571 // Print the detection code.
556 if (PrintAssembly) { 572 if (PrintAssembly) {
557 ttyLocker ttyl; 573 ttyLocker ttyl;
558 tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " after execution:", p2i(code)); 574 tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " after execution:", p2i(code));

mercurial