summary refs log tree commit diff stats
path: root/tests/vm
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2019-02-01 12:12:10 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-02-01 12:12:10 +0100
commitb80dbdb77d373cda27b00a742f17d1c385dc4a46 (patch)
tree4692030a56be6d51afb41757a9898ee790c8a9f6 /tests/vm
parent1d5437e9d2c5800e4b90e87e32acc600c52cf739 (diff)
downloadNim-b80dbdb77d373cda27b00a742f17d1c385dc4a46.tar.gz
Fix vm signed xor (#10519)
* fix #10482

* undo changes

* fix for bitwise not

* remove dead opcode
Diffstat (limited to 'tests/vm')
-rw-r--r--tests/vm/tbitops.nim16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/vm/tbitops.nim b/tests/vm/tbitops.nim
index 3d1a8aa0c..90d463ec9 100644
--- a/tests/vm/tbitops.nim
+++ b/tests/vm/tbitops.nim
@@ -7,25 +7,29 @@ import strutils
 const x  = [1'i32, -1, -10, 10, -10, 10, -20, 30, -40, 50, 7 shl 28, -(7 shl 28), 7 shl 28, -(7 shl 28)]
 const y  = [-1'i32, 1, -10, -10, 10, 10, -20, -30, 40, 50, 1 shl 30, 1 shl 30, -(1 shl 30), -(1 shl 30)]
 
-
 const res_xor = block:
   var tmp: seq[int64]
-  for i in 0..<x.len:
+  for i in 0 ..< x.len:
     tmp.add(int64(x[i] xor y[i]))
   tmp
 
 const res_and = block:
   var tmp: seq[int64]
-  for i in 0..<x.len:
+  for i in 0 ..< x.len:
     tmp.add(int64(x[i] and y[i]))
   tmp
- 
+
 const res_or = block:
   var tmp: seq[int64]
-  for i in 0..<x.len:
+  for i in 0 ..< x.len:
     tmp.add(int64(x[i] or y[i]))
   tmp
 
+const res_not = block:
+  var tmp: seq[int64]
+  for i in 0 ..< x.len:
+    tmp.add(not x[i])
+  tmp
 
 let xx = x
 let yy = y
@@ -34,6 +38,8 @@ for i in 0..<xx.len:
   let z_xor = int64(xx[i] xor yy[i])
   let z_and = int64(xx[i] and yy[i])
   let z_or = int64(xx[i] or yy[i])
+  let z_not = int64(not xx[i])
   doAssert(z_xor == res_xor[i], $i & ": " & $res_xor[i] & "  " & $z_xor)
   doAssert(z_and == res_and[i], $i & ": " & $res_and[i] & "  " & $z_and)
   doAssert(z_or == res_or[i], $i & ": " & $res_or[i] & "  " & $z_or)
+  doAssert(z_not == res_not[i], $i & ": " & $res_not[i] & "  " & $z_not)