https://gcc.gnu.org/g:6d67bbce340351cfe7f30f1b17cba7635f18c8d5

commit r16-3256-g6d67bbce340351cfe7f30f1b17cba7635f18c8d5
Author: Xi Ruoyao <xry...@xry111.site>
Date:   Sat Mar 1 11:46:49 2025 +0800

    LoongArch: Don't expand atomic_fetch_sub_{hi, qi} to LL-SC loop if -mlam-bh
    
    With -mlam-bh, we should negate the addend first, and use an amadd
    instruction.  Disabling the expander makes the compiler do it correctly.
    
    gcc/ChangeLog:
    
            * config/loongarch/sync.md (atomic_fetch_sub<SHORT:mode>):
            Disable if ISA_HAS_LAM_BH.

Diff:
---
 gcc/config/loongarch/sync.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/loongarch/sync.md b/gcc/config/loongarch/sync.md
index b6acfff3a611..60038258f294 100644
--- a/gcc/config/loongarch/sync.md
+++ b/gcc/config/loongarch/sync.md
@@ -661,7 +661,7 @@
                        (match_operand:SHORT 2 "reg_or_0_operand" "rJ"))
           (match_operand:SI 3 "const_int_operand")] ;; model
         UNSPEC_SYNC_OLD_OP))]
-  ""
+  "!ISA_HAS_LAM_BH"
 {
   union loongarch_gen_fn_ptrs generator;
   generator.fn_7 = gen_atomic_cas_value_sub_7_si;

Reply via email to