small arm fixes etc

This commit is contained in:
Torsten Ruger
2018-06-06 00:53:41 +03:00
parent d7b3368b28
commit 4ab6d62acf
8 changed files with 79 additions and 11 deletions

View File

@ -91,10 +91,10 @@ module Arm
if( @left.is_a?(Parfait::Object) or @left.is_a?(Risc::Label) or
(@left.is_a?(Symbol) and !Risc::RiscValue.look_like_reg(@left)))
left = @left
left = @left.address if left.is_a?(Risc::Label)
# do pc relative addressing with the difference to the instuction
# 8 is for the funny pipeline adjustment (ie pointing to fetch and not execute)
right = Risc::Position.get(left) - Risc::Position.get(self) - 8
right = Risc::Position.get(left) - 8
right -= Risc::Position.get(self).at
if( (right < 0) && ((opcode == :add) || (opcode == :sub)) )
right *= -1 # this works as we never issue sub only add
set_opcode :sub # so (as we can't change the sign permanently) we can change the opcode