--- old/src/cpu/sparc/vm/sparc.ad 2012-06-25 16:58:15.123467661 +0200 +++ new/src/cpu/sparc/vm/sparc.ad 2012-06-25 16:58:14.912458878 +0200 @@ -1838,6 +1838,12 @@ case Op_PopCountL: if (!UsePopCountInstruction) return false; + case Op_CompareAndSwapL: +#ifdef _LP64 + case Op_CompareAndSwapP: +#endif + if (!VM_Version::supports_cx8()) + return false; break; } @@ -7214,6 +7220,7 @@ // No flag versions for CompareAndSwap{P,I,L} because matcher can't match them instruct compareAndSwapL_bool(iRegP mem_ptr, iRegL oldval, iRegL newval, iRegI res, o7RegI tmp1, flagsReg ccr ) %{ + predicate(VM_Version::supports_cx8()); match(Set res (CompareAndSwapL mem_ptr (Binary oldval newval))); effect( USE mem_ptr, KILL ccr, KILL tmp1); format %{ @@ -7245,6 +7252,9 @@ %} instruct compareAndSwapP_bool(iRegP mem_ptr, iRegP oldval, iRegP newval, iRegI res, o7RegI tmp1, flagsReg ccr ) %{ +#ifdef _LP64 + predicate(VM_Version::supports_cx8()); +#endif match(Set res (CompareAndSwapP mem_ptr (Binary oldval newval))); effect( USE mem_ptr, KILL ccr, KILL tmp1); format %{ @@ -7279,6 +7289,38 @@ ins_pipe( long_memory_op ); %} +instruct xchgI( memory mem, iRegI newval) %{ + match(Set newval (GetAndSetI mem newval)); + format %{ "SWAP [$mem],$newval" %} + size(4); + ins_encode %{ + __ swap($mem$$Address, $newval$$Register); + %} + ins_pipe( long_memory_op ); +%} + +#ifndef _LP64 +instruct xchgP( memory mem, iRegP newval) %{ + match(Set newval (GetAndSetP mem newval)); + format %{ "SWAP [$mem],$newval" %} + size(4); + ins_encode %{ + __ swap($mem$$Address, $newval$$Register); + %} + ins_pipe( long_memory_op ); +%} +#endif + +instruct xchgN( memory mem, iRegN newval) %{ + match(Set newval (GetAndSetN mem newval)); + format %{ "SWAP [$mem],$newval" %} + size(4); + ins_encode %{ + __ swap($mem$$Address, $newval$$Register); + %} + ins_pipe( long_memory_op ); +%} + //--------------------- // Subtraction Instructions // Register Subtraction