Merge.
authorDavid Given <dg@cowlark.com>
Thu, 30 Aug 2018 21:50:24 +0000 (23:50 +0200)
committerDavid Given <dg@cowlark.com>
Thu, 30 Aug 2018 21:50:24 +0000 (23:50 +0200)
1  2 
build.lua
mach/powerpc/mcg/table
mach/proto/mcg/treebuilder.c
plat/qemuppc/descr
util/mcgg/iburg.c

diff --cc build.lua
+++ b/build.lua
@@@ -11,14 -12,17 +12,17 @@@ vars.plats = 
        "linuxppc",
        "osx386",
        "osxppc",
 ---    --"qemuppc",
 +      "qemuppc",
        "pc86",
        "rpi",
+       "pdpv7",
+       "em22",
  }
  vars.plats_with_tests = {
+       "linux68k",
        "linux386",
        "linuxppc",
      "qemuppc",
--    --"qemuppc",
        "pc86",
  }
  
@@@ -288,8 -309,10 +291,11 @@@ PATTERN
                emit "lwz %out, %addr"
                cost 4;
  
+ #if 0
+     /* FIXME: Doesn't work because %out.0 and %addr might share a
+      * register, so it corrupts %addr before it loads %out.1. */
      out:(long)reg = LOAD.L(addr:address)
 +        with corrupted(%addr)
          emit "lwz %out.0, 4+%addr"
          emit "lwz %out.1, 0+%addr"
          cost 8;
@@@ -1449,100 -1505,27 +1505,29 @@@ static void insn_ivalue(int opcode, ari
          }
  
          case op_blm:
-         {
-             /* Input stack: ( src dest -- ) */
-             struct ir* dest = pop(EM_pointersize);
-             struct ir* src = pop(EM_pointersize);
-             blockmove(dest, src, new_wordir(value));
+             push(new_wordir(value));
+             helper_function(".bls4");
              break;
-         }
  
          case op_bls:
-         {
-             /* Input stack: ( src dest size -- ) */
-             struct ir* dest = pop(EM_pointersize);
-             struct ir* src = pop(EM_pointersize);
-             struct ir* size = pop(EM_wordsize);
-             blockmove(dest, src, size);
+             if (value != EM_wordsize)
+                 fatal("'bls %d' not supported", value);
+             helper_function(".bls4");
              break;
 +        }
  
          case op_los:
-         {
-             /* Copy an arbitrary amount to the stack. */
-             struct ir* bytes = pop(EM_wordsize);
-             struct ir* address = pop(EM_pointersize);
-             materialise_stack();
-             appendir(
-                 new_ir1(
-                     IR_STACKADJUST, EM_pointersize,
-                     new_ir1(
-                         IR_NEG, EM_wordsize,
-                         bytes
-                     )
-                 )
-             );
-             push(
-                 new_ir0(
-                     IR_GETSP, EM_pointersize
-                 )
-             );
-             push(address);
-             push(bytes);
-             materialise_stack();
-             appendir(
-                 new_ir1(
-                     IR_CALL, 0,
-                     new_labelir("memcpy")
-                 )
-             );
-             appendir(
-                 new_ir1(
-                     IR_STACKADJUST, EM_pointersize,
-                     new_wordir(EM_pointersize*2 + EM_wordsize)
-                 )
-             );
+             if (value != EM_wordsize)
+                 fatal("'los %d' not supported", value);
+             helper_function_with_arg(".los4", pop(EM_wordsize));
              break;
 +        }
  
          case op_sts:
-         {
-             /* Copy an arbitrary amount from the stack. */
-             struct ir* bytes = pop(EM_wordsize);
-             struct ir* dest = pop(EM_pointersize);
-             struct ir* src;
-             materialise_stack();
-             src = appendir(
-                     new_ir0(
-                         IR_GETSP, EM_pointersize
-                     )
-                 );
-             push(dest);
-             push(src);
-             push(bytes);
-             materialise_stack();
-             appendir(
-                 new_ir1(
-                     IR_CALL, 0,
-                     new_labelir("memcpy")
-                 )
-             );
-             appendir(
-                 new_ir1(
-                     IR_STACKADJUST, EM_pointersize,
-                     new_ir2(
-                         IR_ADD, EM_wordsize,
-                         new_wordir(EM_pointersize*2 + EM_wordsize),
-                         bytes
-                     )
-                 )
-             );
+             if (value != EM_wordsize)
+                 fatal("'sts %d' not supported", value);
+             helper_function_with_arg(".sts4", pop(EM_wordsize));
              break;
-         }
  
          case op_lin:
          {
Simple merge
Simple merge