LA32 atomic instructions support const_imm16_operand, so can't add TARGET_64BIT
for const_imm16_operand constraint.

gcc/ChangeLog:

        * config/loongarch/loongarch.cc (loongarch_valid_offset_p): Disable
        const_imm16_operand on LA32.
---
 gcc/config/loongarch/loongarch.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/loongarch/loongarch.cc 
b/gcc/config/loongarch/loongarch.cc
index adc37b53d48..64acd44ef96 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -2246,7 +2246,9 @@ loongarch_valid_offset_p (rtx x, machine_mode mode)
      or check that X is a signed 16-bit number
      and offset 4 byte aligned.  */
   if (!(const_arith_operand (x, Pmode)
-       || ((mode == E_SImode || mode == E_DImode)
+       /* FIXME: la32 atomic insns support 16-bit imm.  */
+       || (TARGET_64BIT
+           && (mode == E_SImode || mode == E_DImode)
            && const_imm16_operand (x, Pmode)
            && (loongarch_signed_immediate_p (INTVAL (x), 14, 2)))))
     return false;
-- 
2.34.1

Reply via email to