LoongArch: Fix bug for tmpdir-g++.dg-struct-layout-1/t033.
authorchenglulu <chenglulu@loongson.cn>
Mon, 28 Mar 2022 09:02:39 +0000 (17:02 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Tue, 12 Apr 2022 01:13:51 +0000 (09:13 +0800)
gcc/ChangeLog:

* config/loongarch/loongarch.cc: Fix bug for
tmpdir-g++.dg-struct-layout-1/t033.

gcc/config/loongarch/loongarch.cc

index 6e24111..f22150a 100644 (file)
@@ -473,13 +473,14 @@ loongarch_pass_aggregate_in_fpr_and_gpr_p (const_tree type,
 
 static rtx
 loongarch_pass_fpr_single (machine_mode type_mode, unsigned regno,
-                          machine_mode value_mode)
+                          machine_mode value_mode,
+                          HOST_WIDE_INT offset)
 {
   rtx x = gen_rtx_REG (value_mode, regno);
 
   if (type_mode != value_mode)
     {
-      x = gen_rtx_EXPR_LIST (VOIDmode, x, const0_rtx);
+      x = gen_rtx_EXPR_LIST (VOIDmode, x, GEN_INT (offset));
       x = gen_rtx_PARALLEL (type_mode, gen_rtvec (1, x));
     }
   return x;
@@ -539,7 +540,8 @@ loongarch_get_arg_info (struct loongarch_arg_info *info,
          {
          case 1:
            return loongarch_pass_fpr_single (mode, fregno,
-                                             TYPE_MODE (fields[0].type));
+                                             TYPE_MODE (fields[0].type),
+                                             fields[0].offset);
 
          case 2:
            return loongarch_pass_fpr_pair (mode, fregno,