summaryrefslogtreecommitdiff
path: root/pp2cc.py
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2011-12-07 09:55:18 +0000
committerPeter Wu <lekensteyn@gmail.com>2011-12-07 09:55:18 +0000
commit14c7b8af3a04f739ebd192b9efd22cd5422525c1 (patch)
tree8b7b92913d73bdf23452f6874bb20dd5e956c392 /pp2cc.py
parent97d67c978678ea6009212ec2b868ebc7bc543585 (diff)
downloadpp2cc-14c7b8af3a04f739ebd192b9efd22cd5422525c1.tar.gz
Fix the result of a >> expression
Diffstat (limited to 'pp2cc.py')
-rwxr-xr-xpp2cc.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pp2cc.py b/pp2cc.py
index b270191..232c581 100755
--- a/pp2cc.py
+++ b/pp2cc.py
@@ -444,6 +444,10 @@ class Parse(object):
# we can safe another NOOP by adding the label here
lines.append(self.asm.branch_op("BGT", lbl_shift,
label=lbl_shift_end))
+ # expression rely on the fact that the result of an expression is
+ # available in the last register. Without the below line, it'd look
+ # in reg_shift
+ lines.append(self.asm.binary_op("LOAD", reg_number, reg_number))
else:
shift_bits = self.convertStrToInteger(operand_shift)
if shift_bits <= 0: