Browse Source

+ WebAssembly: use the 64-bit div instruction, instead of an RTL helper for 64-bit division

Nikolay Nikolov 3 years ago
parent
commit
b11434a6f8
2 changed files with 1 additions and 3 deletions
  1. 0 3
      compiler/wasm32/hlcgcpu.pas
  2. 1 0
      compiler/wasm32/nwasmmat.pas

+ 0 - 3
compiler/wasm32/hlcgcpu.pas

@@ -578,9 +578,6 @@ implementation
           end;
           end;
         OS_64,OS_S64:
         OS_64,OS_S64:
           begin
           begin
-            { unsigned 64 bit division must be done via a helper }
-            if op=OP_DIV then
-              internalerror(2010120530);
             { boolean not: =0? for boolean }
             { boolean not: =0? for boolean }
             if (op=OP_NOT) and is_pasbool(size) then
             if (op=OP_NOT) and is_pasbool(size) then
               begin
               begin

+ 1 - 0
compiler/wasm32/nwasmmat.pas

@@ -69,6 +69,7 @@ implementation
     function twasmmoddivnode.use_moddiv64bitint_helper: boolean;
     function twasmmoddivnode.use_moddiv64bitint_helper: boolean;
       begin
       begin
         result:=
         result:=
+          (nodetype=modn) and
           (left.resultdef.typ=orddef) and
           (left.resultdef.typ=orddef) and
           (right.resultdef.typ=orddef) and
           (right.resultdef.typ=orddef) and
           ((torddef(left.resultdef).ordtype=u64bit) or
           ((torddef(left.resultdef).ordtype=u64bit) or