summary refs log tree commit diff stats
path: root/compiler/vm.nim
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2019-02-05 09:31:37 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-02-05 09:31:37 +0100
commit824f39b32e04e31514aade50da38516b8fadac12 (patch)
treed35bb7ae0e67c16f9cc5879f99eda7b7c79f59bb /compiler/vm.nim
parentbcb5995ddf1228a53e01c9947e5229994e1bf364 (diff)
downloadNim-824f39b32e04e31514aade50da38516b8fadac12.tar.gz
Vm bitops fixes (#10520)
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r--compiler/vm.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index e95a491fd..71fd2722b 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -1264,6 +1264,11 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
     of opcNarrowU:
       decodeB(rkInt)
       regs[ra].intVal = regs[ra].intVal and ((1'i64 shl rb)-1)
+    of opcSignExtend:
+      # like opcNarrowS, but no out of range possible
+      decodeB(rkInt)
+      let imm = 64 - rb
+      regs[ra].intVal = ashr(regs[ra].intVal shl imm, imm)
     of opcIsNil:
       decodeB(rkInt)
       let node = regs[rb].node