Author: Manuel Jacob
Branch: llvm-translation-backend
Changeset: r69021:4f6f9aee9418
Date: 2014-01-30 12:28 +0100
http://bitbucket.org/pypy/pypy/changeset/4f6f9aee9418/
Log: Support lshift and rshift operations where the RHS has another type
than the LHS.
diff --git a/rpython/translator/llvm/genllvm.py
b/rpython/translator/llvm/genllvm.py
--- a/rpython/translator/llvm/genllvm.py
+++ b/rpython/translator/llvm/genllvm.py
@@ -1007,6 +1007,15 @@
opargs = [get_repr(arg) for arg in op.args]
if opname in OPS:
binary_op = OPS[opname]
+ assert len(opargs) == 2
+ if ((opargs[0].type_ != opargs[1].type_) and
+ (opargs[0].type_.bitwidth != opargs[1].type_.bitwidth) and
+ isinstance(opargs[1], VariableRepr)):
+ assert binary_op in ('shl', 'lshr', 'ashr')
+ t = self._tmp()
+ self.w('{t.V} = sext {opargs[1].TV} to {opargs[0].T}'
+ .format(**locals()))
+ opargs[1] = t
self.w('{opres.V} = {binary_op} {opargs[0].TV}, {opargs[1].V}'
.format(**locals()))
elif opname.startswith('cast_') or opname.startswith('truncate_'):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit