[committed] Fix rtl check error in pdp11

Message ID 94826AE9-EF80-4E8F-B85B-2E2609475EA7@comcast.net
State New
Headers show
Series
  • [committed] Fix rtl check error in pdp11
Related show

Commit Message

Paul Koning July 14, 2018, 7:16 p.m.
When building with checking enabled, there were check failures in pdp11_rtx_costs.  This patch fixes two errors.

Committed.

	paul

ChangeLog:

2018-07-14  Paul Koning  <ni1d@arrl.net>

	* config/pdp11/pdp11.c (pdp11_rtx_costs): Bugfixes.

Patch

Index: config/pdp11/pdp11.c
===================================================================
--- config/pdp11/pdp11.c	(revision 262604)
+++ config/pdp11/pdp11.c	(working copy)
@@ -1014,6 +1014,7 @@  pdp11_rtx_costs (rtx x, machine_mode mode, int out
   const int code = GET_CODE (x);
   const int asize = (mode == QImode) ? 2 : GET_MODE_SIZE (mode);
   rtx src, dest;
+  const char *fmt;
   
   switch (code)
     {
@@ -1035,6 +1036,14 @@  pdp11_rtx_costs (rtx x, machine_mode mode, int out
       *total = pdp11_addr_cost (x, mode, ADDR_SPACE_GENERIC, speed);
       return true;
     }
+  if (GET_RTX_LENGTH (code) == 0)
+    {
+      if (speed)
+	*total = 0;
+      else
+	*total = 2;
+      return true;
+    }
 
   /* Pick up source and dest.  We don't necessarily use the standard
      recursion in rtx_costs to figure the cost, because that would
@@ -1041,6 +1050,15 @@  pdp11_rtx_costs (rtx x, machine_mode mode, int out
      count the destination operand twice for three-operand insns.
      Also, this way we can catch special cases like move of zero, or
      add one.  */
+  fmt = GET_RTX_FORMAT (code);
+  if (fmt[0] != 'e' || (GET_RTX_LENGTH (code) > 1 && fmt[1] != 'e'))
+    {
+      if (speed)
+	*total = 0;
+      else
+	*total = 2;
+      return true;
+    }
   if (GET_RTX_LENGTH (code) > 1)
     src = XEXP (x, 1);
   dest = XEXP (x, 0);