From 1133308dd5dbf177c8d86e762a2e1a20a9254576 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 8 Sep 2014 18:25:04 +0800 Subject: [PATCH] py2llvm: support 'neg' on VInt --- artiq/py2llvm/base_types.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/artiq/py2llvm/base_types.py b/artiq/py2llvm/base_types.py index cbd6126b5..a922a2d75 100644 --- a/artiq/py2llvm/base_types.py +++ b/artiq/py2llvm/base_types.py @@ -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: