]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Avoid bogus atomics match
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 24 Oct 2023 09:58:40 +0000 (10:58 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 24 Oct 2023 09:58:40 +0000 (10:58 +0100)
The non-LSE pattern aarch64_atomic_exchange<mode> comes before the
LSE pattern aarch64_atomic_exchange<mode>_lse.  From a recog
perspective, the only difference between the patterns is that
the non-LSE one clobbers CC and needs a scratch.

However, combine and RTL-SSA can both add clobbers to make a
pattern match.  This means that if they try to rerecognise an
LSE pattern, they could end up turning it into a non-LSE pattern.
This patch adds a !TARGET_LSE test to avoid that.

This is needed to avoid a regression with later patches.

gcc/
* config/aarch64/atomics.md (aarch64_atomic_exchange<mode>): Require
!TARGET_LSE.

gcc/config/aarch64/atomics.md

index 2b6f04efa6c9e8bf714907eedb695702a04e30e7..055a87320caaf2ec47667906f7b1e9fc60b0b3d3 100644 (file)
       UNSPECV_ATOMIC_EXCHG))
    (clobber (reg:CC CC_REGNUM))
    (clobber (match_scratch:SI 4 "=&r"))]
-  ""
+  "!TARGET_LSE"
   "#"
   "&& epilogue_completed"
   [(const_int 0)]