For ilp32d ABI, word_size is 64 for MODE_FLOAT class mode, word_size is
32 for MODE_INT class mode.

gcc/ChangeLog:

        * config/loongarch/loongarch.cc (loongarch_valid_lo_sum_p): Change
        word_size to 64 for float mode.
---
 gcc/config/loongarch/loongarch.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/config/loongarch/loongarch.cc 
b/gcc/config/loongarch/loongarch.cc
index 5032e0681bb..d3bae16b11d 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -2269,7 +2269,7 @@ static bool
 loongarch_valid_lo_sum_p (enum loongarch_symbol_type symbol_type,
                          machine_mode mode, rtx x)
 {
-  int align, size;
+  int align, size, word_size;
 
   /* Check that symbols of type SYMBOL_TYPE can be used to access values
      of mode MODE.  */
@@ -2310,7 +2310,11 @@ loongarch_valid_lo_sum_p (enum loongarch_symbol_type 
symbol_type,
 
   /* We may need to split multiword moves, so make sure that each word
      can be accessed without inducing a carry.  */
-  if (size > BITS_PER_WORD
+  /* word_size is different when GRLEN != FRLEN.  */
+  word_size = (GET_MODE_CLASS (mode) == MODE_FLOAT
+              ? (UNITS_PER_HWFPVALUE * BITS_PER_UNIT)
+              : BITS_PER_WORD);
+  if (size > word_size
       && (!TARGET_STRICT_ALIGN || size > align))
     return false;
 
-- 
2.34.1

Reply via email to