1.1 --- a/src/cpu/sparc/vm/sparc.ad Wed Sep 19 16:50:26 2012 -0700 1.2 +++ b/src/cpu/sparc/vm/sparc.ad Thu Sep 20 16:49:17 2012 +0200 1.3 @@ -1838,6 +1838,12 @@ 1.4 case Op_PopCountL: 1.5 if (!UsePopCountInstruction) 1.6 return false; 1.7 + case Op_CompareAndSwapL: 1.8 +#ifdef _LP64 1.9 + case Op_CompareAndSwapP: 1.10 +#endif 1.11 + if (!VM_Version::supports_cx8()) 1.12 + return false; 1.13 break; 1.14 } 1.15 1.16 @@ -7199,6 +7205,7 @@ 1.17 // No flag versions for CompareAndSwap{P,I,L} because matcher can't match them 1.18 1.19 instruct compareAndSwapL_bool(iRegP mem_ptr, iRegL oldval, iRegL newval, iRegI res, o7RegI tmp1, flagsReg ccr ) %{ 1.20 + predicate(VM_Version::supports_cx8()); 1.21 match(Set res (CompareAndSwapL mem_ptr (Binary oldval newval))); 1.22 effect( USE mem_ptr, KILL ccr, KILL tmp1); 1.23 format %{ 1.24 @@ -7230,6 +7237,9 @@ 1.25 %} 1.26 1.27 instruct compareAndSwapP_bool(iRegP mem_ptr, iRegP oldval, iRegP newval, iRegI res, o7RegI tmp1, flagsReg ccr ) %{ 1.28 +#ifdef _LP64 1.29 + predicate(VM_Version::supports_cx8()); 1.30 +#endif 1.31 match(Set res (CompareAndSwapP mem_ptr (Binary oldval newval))); 1.32 effect( USE mem_ptr, KILL ccr, KILL tmp1); 1.33 format %{ 1.34 @@ -7264,6 +7274,38 @@ 1.35 ins_pipe( long_memory_op ); 1.36 %} 1.37 1.38 +instruct xchgI( memory mem, iRegI newval) %{ 1.39 + match(Set newval (GetAndSetI mem newval)); 1.40 + format %{ "SWAP [$mem],$newval" %} 1.41 + size(4); 1.42 + ins_encode %{ 1.43 + __ swap($mem$$Address, $newval$$Register); 1.44 + %} 1.45 + ins_pipe( long_memory_op ); 1.46 +%} 1.47 + 1.48 +#ifndef _LP64 1.49 +instruct xchgP( memory mem, iRegP newval) %{ 1.50 + match(Set newval (GetAndSetP mem newval)); 1.51 + format %{ "SWAP [$mem],$newval" %} 1.52 + size(4); 1.53 + ins_encode %{ 1.54 + __ swap($mem$$Address, $newval$$Register); 1.55 + %} 1.56 + ins_pipe( long_memory_op ); 1.57 +%} 1.58 +#endif 1.59 + 1.60 +instruct xchgN( memory mem, iRegN newval) %{ 1.61 + match(Set newval (GetAndSetN mem newval)); 1.62 + format %{ "SWAP [$mem],$newval" %} 1.63 + size(4); 1.64 + ins_encode %{ 1.65 + __ swap($mem$$Address, $newval$$Register); 1.66 + %} 1.67 + ins_pipe( long_memory_op ); 1.68 +%} 1.69 + 1.70 //--------------------- 1.71 // Subtraction Instructions 1.72 // Register Subtraction