Browse Source

light modification

Nicolas Winkler 7 years ago
parent
commit
ff81669105
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/AssemblyGenerator.cpp

+ 5 - 1
src/AssemblyGenerator.cpp

@@ -167,7 +167,11 @@ void AssemblyGenerator::compileMult(Index index, Cell factor)
     }
     }
     // check if factor is power of two
     // check if factor is power of two
     else if ((factor & (factor - 1)) == 0) {
     else if ((factor & (factor - 1)) == 0) {
-        if (factor <= 8) {
+        if (factor == 2) {
+            write("leal (%rax,%rax), %ecx");
+            write("addb %cl, ", index, ptr());
+        }
+        else if (factor <= 8) {
             write("leal (,%eax,", int(factor), "), %ecx");
             write("leal (,%eax,", int(factor), "), %ecx");
             write("addb %cl, ", index, ptr());
             write("addb %cl, ", index, ptr());
         }
         }