aarch64: Improve cas generation
authorRichard Henderson <richard.henderson@linaro.org>
Wed, 31 Oct 2018 09:42:39 +0000 (09:42 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 31 Oct 2018 09:42:39 +0000 (02:42 -0700)
commitd400fda3a8c3330f77eb9d51874f5482d3819a9f
tree08710f98cae30de9be33b762f03784aa1a42c07b
parent77f33f44baf24c22848197aa80962c003dd7b3e2
aarch64: Improve cas generation

Do not zero-extend the input to the cas for subword operations;
instead, use the appropriate zero-extending compare insns.
Correct the predicates and constraints for immediate expected operand.

* config/aarch64/aarch64.c (aarch64_gen_compare_reg_maybe_ze): New.
(aarch64_split_compare_and_swap): Use it.
(aarch64_expand_compare_and_swap): Likewise.  Remove convert_modes;
test oldval against the proper predicate.
* config/aarch64/atomics.md (@atomic_compare_and_swap<ALLI>):
Use nonmemory_operand for expected.
(cas_short_expected_pred): New.
(@aarch64_compare_and_swap<SHORT>): Use it; use "rn" not "rI" to match.
(@aarch64_compare_and_swap<GPI>): Use "rn" not "rI" for expected.
* config/aarch64/predicates.md (aarch64_plushi_immediate): New.
(aarch64_plushi_operand): New.

From-SVN: r265657
gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/atomics.md
gcc/config/aarch64/predicates.md