1.1 --- a/src/cpu/mips/vm/mips_64.ad Mon Nov 13 15:49:42 2017 +0800 1.2 +++ b/src/cpu/mips/vm/mips_64.ad Mon Nov 13 15:58:57 2017 +0800 1.3 @@ -13125,6 +13125,28 @@ 1.4 match(Set res (CompareAndSwapI mem_ptr (Binary oldval newval))); 1.5 effect(KILL oldval); 1.6 // match(CompareAndSwapI mem_ptr (Binary oldval newval)); 1.7 + format %{ "CMPXCHG $newval, [$mem_ptr], $oldval @ compareAndSwapL\n\t" 1.8 + "MOV $res, 1 @ compareAndSwapI\n\t" 1.9 + "BNE AT, R0 @ compareAndSwapI\n\t" 1.10 + "MOV $res, 0 @ compareAndSwapI\n" 1.11 + "L:" %} 1.12 + ins_encode %{ 1.13 + Register newval = $newval$$Register; 1.14 + Register oldval = $oldval$$Register; 1.15 + Register res = $res$$Register; 1.16 + Address addr($mem_ptr$$Register, 0); 1.17 + Label L; 1.18 + 1.19 + __ cmpxchg32(newval, addr, oldval); 1.20 + __ move(res, AT); 1.21 + %} 1.22 + ins_pipe( long_memory_op ); 1.23 +%} 1.24 + 1.25 +instruct compareAndSwapL( mRegI res, mRegP mem_ptr, s2RegL oldval, mRegL newval) %{ 1.26 + predicate(VM_Version::supports_cx8()); 1.27 + match(Set res (CompareAndSwapL mem_ptr (Binary oldval newval))); 1.28 + effect(KILL oldval); 1.29 format %{ "CMPXCHG $newval, [$mem_ptr], $oldval @ compareAndSwapI\n\t" 1.30 "MOV $res, 1 @ compareAndSwapI\n\t" 1.31 "BNE AT, R0 @ compareAndSwapI\n\t" 1.32 @@ -13137,7 +13159,7 @@ 1.33 Address addr($mem_ptr$$Register, 0); 1.34 Label L; 1.35 1.36 - __ cmpxchg32(newval, addr, oldval); 1.37 + __ cmpxchg(newval, addr, oldval); 1.38 __ move(res, AT); 1.39 %} 1.40 ins_pipe( long_memory_op );