codegen: shift insn
authorBernhard Urban <lewurm@gmail.com>
Sat, 16 Jun 2012 20:15:02 +0000 (22:15 +0200)
committerBernhard Urban <lewurm@gmail.com>
Mon, 18 Jun 2012 16:32:49 +0000 (18:32 +0200)
Mate/X86CodeGen.hs
tests/Shift1.java [new file with mode: 0644]

index e365367619d3c7374fa0927768826d1827479d65..d09304d70428463ddd400351c27fdf234be83bee 100644 (file)
@@ -285,6 +285,7 @@ emitFromBB method sig cls hmap =  do
     emit IDIV = do pop ebx; pop eax; xor edx edx; div ebx; push eax
     emit IREM = do pop ebx; pop eax; xor edx edx; div ebx; push edx
     emit IXOR = do pop ebx; pop eax; xor eax ebx; push eax
+    emit IUSHR = do pop ecx; pop eax; sar eax cl; push eax
     emit INEG = do pop eax; neg eax; push eax
     emit (IINC x imm) =
         add (Disp (cArgs x), ebp) (s8_w32 imm)
diff --git a/tests/Shift1.java b/tests/Shift1.java
new file mode 100644 (file)
index 0000000..8af8804
--- /dev/null
@@ -0,0 +1,8 @@
+package tests;
+
+public class Shift1 {
+       public static void main(String []args) {
+               int s = 0x1000;
+               System.out.printf("shifted: %d\n", s >>> 4);
+       }
+}