Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/x86_64.ad @ 7474:00af3a3a8df4
8005522: use fast-string instructions on x86 for zeroing
Summary: use 'rep stosb' instead of 'rep stosq' when fast-string operations are available.
Reviewed-by: twisti, roland
author | kvn |
---|---|
date | Thu, 03 Jan 2013 15:09:55 -0800 |
parents | f6badecb7ea7 |
children | b30b3c2a0cf2 |
comparison
equal
deleted
inserted
replaced
7473:d092d1b31229 | 7474:00af3a3a8df4 |
---|---|
10372 // ======================================================================= | 10372 // ======================================================================= |
10373 // fast clearing of an array | 10373 // fast clearing of an array |
10374 instruct rep_stos(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy, | 10374 instruct rep_stos(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy, |
10375 rFlagsReg cr) | 10375 rFlagsReg cr) |
10376 %{ | 10376 %{ |
10377 predicate(!UseFastStosb); | |
10377 match(Set dummy (ClearArray cnt base)); | 10378 match(Set dummy (ClearArray cnt base)); |
10378 effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr); | 10379 effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr); |
10379 | 10380 |
10380 format %{ "xorl rax, rax\t# ClearArray:\n\t" | 10381 format %{ "xorq rax, rax\t# ClearArray:\n\t" |
10381 "rep stosq\t# Store rax to *rdi++ while rcx--" %} | 10382 "rep stosq\t# Store rax to *rdi++ while rcx--" %} |
10382 ins_encode(opc_reg_reg(0x33, RAX, RAX), // xorl %eax, %eax | 10383 ins_encode %{ |
10383 Opcode(0xF3), Opcode(0x48), Opcode(0xAB)); // rep REX_W stos | 10384 __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register); |
10385 %} | |
10384 ins_pipe(pipe_slow); | 10386 ins_pipe(pipe_slow); |
10387 %} | |
10388 | |
10389 instruct rep_fast_stosb(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy, | |
10390 rFlagsReg cr) | |
10391 %{ | |
10392 predicate(UseFastStosb); | |
10393 match(Set dummy (ClearArray cnt base)); | |
10394 effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr); | |
10395 format %{ "xorq rax, rax\t# ClearArray:\n\t" | |
10396 "shlq rcx,3\t# Convert doublewords to bytes\n\t" | |
10397 "rep stosb\t# Store rax to *rdi++ while rcx--" %} | |
10398 ins_encode %{ | |
10399 __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register); | |
10400 %} | |
10401 ins_pipe( pipe_slow ); | |
10385 %} | 10402 %} |
10386 | 10403 |
10387 instruct string_compare(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rdx_RegI cnt2, | 10404 instruct string_compare(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rdx_RegI cnt2, |
10388 rax_RegI result, regD tmp1, rFlagsReg cr) | 10405 rax_RegI result, regD tmp1, rFlagsReg cr) |
10389 %{ | 10406 %{ |