2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-24 19:04:02 +08:00

py2llvm: support 'neg' on VInt

This commit is contained in:
Sebastien Bourdeauducq 2014-09-08 18:25:04 +08:00
parent 3d8159ceb5
commit 1133308dd5

View File

@ -74,6 +74,15 @@ class VInt(VGeneric):
def o_not(self, builder):
return self.o_bool(builder, True)
def o_neg(self, builder):
r = VInt(self.nbits)
if builder is not None:
r.set_ssa_value(
builder, builder.mul(
self.get_ssa_value(builder),
lc.Constant.int(self.get_llvm_type(), -1)))
return r
def o_intx(self, target_bits, builder):
r = VInt(target_bits)
if builder is not None: