rl78.c (rl78_emit_libcall): New function.
authorSebastian Perta <sebastian.perta@renesas.com>
Sat, 14 Oct 2017 00:33:58 +0000 (00:33 +0000)
committerDJ Delorie <dj@gcc.gnu.org>
Sat, 14 Oct 2017 00:33:58 +0000 (20:33 -0400)
[gcc]
* config/rl78/rl78.c (rl78_emit_libcall): New function.
* config/rl78/rl78-protos.h (rl78_emit_libcall): New function.
* config/rl78/rl78.md: New define_expand "adddi3".
[libgcc]
* config/rl78/adddi3.S: New assembly file.
* config/rl78/t-rl78: Added adddi3.S to LIB2ADD.

From-SVN: r253748

gcc/ChangeLog
gcc/config/rl78/rl78-protos.h
gcc/config/rl78/rl78.c
gcc/config/rl78/rl78.md
libgcc/ChangeLog
libgcc/config/rl78/t-rl78

index 5134120e7f10fe2b63fd7a310b3590c0dbec3035..749b754b49fd81a5416ab726d54f902cce1b7f2f 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-13  Sebastian Perta  <sebastian.perta@renesas.com>
+
+       * config/rl78/rl78.c (rl78_emit_libcall): New function.
+       * config/rl78/rl78-protos.h (rl78_emit_libcall): New function.
+       * config/rl78/rl78.md: New define_expand "adddi3".
+
 2017-10-13  Jan Hubicka  <hubicka@ucw.cz>
 
        * cfghooks.c (verify_flow_info): Disable check that all probabilities
index a155df61b99207c3a76765f9b5b6e613d86bb8ac..976bffa61e7faf37f272aebf2a382fea0b659333 100644 (file)
@@ -54,3 +54,13 @@ void         rl78_output_aligned_common (FILE *, tree, const char *,
                                            int, int, int);
 
 int            rl78_one_far_p (rtx *operands, int num_operands);
+
+#ifdef RTX_CODE
+#ifdef HAVE_MACHINE_MODES
+
+rtx rl78_emit_libcall (const char*, enum rtx_code,
+                       enum machine_mode, enum machine_mode,
+                       int, rtx*);
+
+#endif
+#endif
index 6b13a80a8f3b4ae08cf5e9f335e61b9a7d670a27..c835dc0317bb6b2f7d870e201432e3d9a2225183 100644 (file)
@@ -4791,6 +4791,45 @@ rl78_addsi3_internal (rtx * operands, unsigned int alternative)
     }
 }
 
+rtx
+rl78_emit_libcall (const char *name, enum rtx_code code,
+                   enum machine_mode dmode, enum machine_mode smode,
+                   int noperands, rtx *operands)
+{
+  rtx ret;
+  rtx_insn *insns;
+  rtx libcall;
+  rtx equiv;
+
+  start_sequence ();
+  libcall = gen_rtx_SYMBOL_REF (Pmode, name);
+
+  switch (noperands)
+    {
+    case 2:
+      ret = emit_library_call_value (libcall, NULL_RTX, LCT_CONST,
+                                     dmode, operands[1], smode);
+      equiv = gen_rtx_fmt_e (code, dmode, operands[1]);
+      break;
+
+    case 3:
+      ret = emit_library_call_value (libcall, NULL_RTX,
+                                     LCT_CONST, dmode,
+                                     operands[1], smode, operands[2],
+                                     smode);
+      equiv = gen_rtx_fmt_ee (code, dmode, operands[1], operands[2]);
+      break;
+
+    default:
+      gcc_unreachable ();
+    }
+
+  insns = get_insns ();
+  end_sequence ();
+  emit_libcall_block (insns, operands[0], ret, equiv);
+  return ret;
+}
+
 \f
 #undef  TARGET_PREFERRED_RELOAD_CLASS
 #define TARGET_PREFERRED_RELOAD_CLASS rl78_preferred_reload_class
index 722d98439b2b4344b6c10873f52dd65c8c4fda11..105d9bef360fdc7fb855dca030cb35236f937f94 100644 (file)
    DONE;"
 )
 
+(define_expand "adddi3"
+  [(set (match_operand:DI          0 "nonimmediate_operand" "")
+       (plus:DI (match_operand:DI 1 "general_operand"      "")
+                (match_operand:DI 2 "general_operand"      "")))
+   ]
+  ""
+  "rl78_emit_libcall (\"__adddi3\", PLUS, DImode, DImode, 3, operands);
+   DONE;"
+)
+
 (define_insn "addsi3_internal_virt"
   [(set (match_operand:SI          0 "nonimmediate_operand" "=v,&vm, vm")
        (plus:SI (match_operand:SI 1 "general_operand"      "0, vim, vim")
index 2360b75ac8d13f42c17ac3ab97755cc1e03ca699..932d12d0aae60296df2ee8cd0806a876f2b4919a 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-13  Sebastian Perta  <sebastian.perta@renesas.com>
+
+       * config/rl78/adddi3.S: New assembly file.
+       * config/rl78/t-rl78: Added adddi3.S to LIB2ADD.
+
 2017-10-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/82274
index 6e48a856a7f93d6fd7c49a51e8be05997ccbd8fd..61db78dd326c0ac846be7a73245e7497ab2b0a90 100644 (file)
@@ -30,7 +30,8 @@ LIB2ADD = \
        $(srcdir)/config/rl78/bit-count.S \
        $(srcdir)/config/rl78/fpbit-sf.S \
        $(srcdir)/config/rl78/fpmath-sf.S \
-       $(srcdir)/config/rl78/cmpsi2.S
+       $(srcdir)/config/rl78/cmpsi2.S \
+       $(srcdir)/config/rl78/adddi3.S
 
 LIB2FUNCS_EXCLUDE = _clzhi2 _clzsi2 _ctzhi2 _ctzsi2 \
   _popcounthi2 _popcountsi2 \