diff options
author | Arne Döring <arne.doering@gmx.net> | 2019-02-05 09:31:37 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-05 09:31:37 +0100 |
commit | 824f39b32e04e31514aade50da38516b8fadac12 (patch) | |
tree | d35bb7ae0e67c16f9cc5879f99eda7b7c79f59bb /compiler/vmgen.nim | |
parent | bcb5995ddf1228a53e01c9947e5229994e1bf364 (diff) | |
download | Nim-824f39b32e04e31514aade50da38516b8fadac12.tar.gz |
Vm bitops fixes (#10520)
Diffstat (limited to 'compiler/vmgen.nim')
-rw-r--r-- | compiler/vmgen.nim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 7f3ca84ae..f513c59a7 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -986,7 +986,14 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) = c.freeTemp(tmp) c.freeTemp(tmp2) - of mShlI: genBinaryABCnarrowU(c, n, dest, opcShlInt) + of mShlI: + genBinaryABC(c, n, dest, opcShlInt) + # genNarrowU modified + let t = skipTypes(n.typ, abstractVar-{tyTypeDesc}) + if t.kind in {tyUInt8..tyUInt32} or (t.kind == tyUInt and t.size < 8): + c.gABC(n, opcNarrowU, dest, TRegister(t.size*8)) + elif t.kind in {tyInt8..tyInt32} or (t.kind == tyInt and t.size < 8): + c.gABC(n, opcSignExtend, dest, TRegister(t.size*8)) of mAshrI: genBinaryABC(c, n, dest, opcAshrInt) of mBitandI: genBinaryABC(c, n, dest, opcBitandInt) of mBitorI: genBinaryABC(c, n, dest, opcBitorInt) |