< prev index next >
src/cpu/x86/vm/x86_64.ad
Print this page
@@ -1635,13 +1635,10 @@
}
// The ecx parameter to rep stosq for the ClearArray node is in words.
const bool Matcher::init_array_count_is_in_bytes = false;
-// Threshold size for cleararray.
-const int Matcher::init_array_short_size = 8 * BytesPerLong;
-
// No additional cost for CMOVL.
const int Matcher::long_cmove_cost() { return 0; }
// No CMOVF/CMOVD with SSE2
const int Matcher::float_cmove_cost() { return ConditionalMoveLimit; }
@@ -10458,33 +10455,63 @@
// =======================================================================
// fast clearing of an array
instruct rep_stos(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy,
rFlagsReg cr)
%{
- predicate(!UseFastStosb);
+ predicate(!UseFastStosb && !((ClearArrayNode*)n)->is_large());
+ match(Set dummy (ClearArray cnt base));
+ effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
+
+ format %{ "xorq rax, rax\t# ClearArray:\n\t"
+ "rep stosq\t# Store rax to *rdi++ while rcx--" %}
+ ins_encode %{
+ __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register, false);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct rep_stos_large(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy,
+ rFlagsReg cr)
+%{
+ predicate(!UseFastStosb && ((ClearArrayNode*)n)->is_large());
match(Set dummy (ClearArray cnt base));
effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
format %{ "xorq rax, rax\t# ClearArray:\n\t"
"rep stosq\t# Store rax to *rdi++ while rcx--" %}
ins_encode %{
- __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register);
+ __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register, true);
%}
ins_pipe(pipe_slow);
%}
instruct rep_fast_stosb(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy,
rFlagsReg cr)
%{
- predicate(UseFastStosb);
+ predicate(UseFastStosb && !((ClearArrayNode*)n)->is_large());
+ match(Set dummy (ClearArray cnt base));
+ effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
+ format %{ "xorq rax, rax\t# ClearArray:\n\t"
+ "shlq rcx,3\t# Convert doublewords to bytes\n\t"
+ "rep stosb\t# Store rax to *rdi++ while rcx--" %}
+ ins_encode %{
+ __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register, false);
+ %}
+ ins_pipe( pipe_slow );
+%}
+
+instruct rep_fast_stosb_large(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy,
+ rFlagsReg cr)
+%{
+ predicate(UseFastStosb && ((ClearArrayNode*)n)->is_large());
match(Set dummy (ClearArray cnt base));
effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
format %{ "xorq rax, rax\t# ClearArray:\n\t"
"shlq rcx,3\t# Convert doublewords to bytes\n\t"
"rep stosb\t# Store rax to *rdi++ while rcx--" %}
ins_encode %{
- __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register);
+ __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register, true);
%}
ins_pipe( pipe_slow );
%}
instruct string_compareL(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rdx_RegI cnt2,
< prev index next >