add <= operator for fibo
This commit is contained in:
parent
5c0f62ebb9
commit
4186c9cafe
@ -18,6 +18,10 @@ module Arm
|
|||||||
block << cmp( left , right )
|
block << cmp( left , right )
|
||||||
Vm::BranchCondition.new :le
|
Vm::BranchCondition.new :le
|
||||||
end
|
end
|
||||||
|
def integer_greater_or_equal block , left , right
|
||||||
|
block << cmp( left , right )
|
||||||
|
Vm::BranchCondition.new :ge
|
||||||
|
end
|
||||||
def integer_less_than block , left , right
|
def integer_less_than block , left , right
|
||||||
block << cmp( left , right )
|
block << cmp( left , right )
|
||||||
Vm::BranchCondition.new :lt
|
Vm::BranchCondition.new :lt
|
||||||
|
@ -39,6 +39,10 @@ module Ast
|
|||||||
code = l_val.greater_than into , r_val
|
code = l_val.greater_than into , r_val
|
||||||
when "<"
|
when "<"
|
||||||
code = l_val.less_than into , r_val
|
code = l_val.less_than into , r_val
|
||||||
|
when ">="
|
||||||
|
code = l_val.greater_or_equal into , r_val
|
||||||
|
when "<="
|
||||||
|
code = l_val.less_or_equal into , r_val
|
||||||
when "=="
|
when "=="
|
||||||
code = l_val.equals into , r_val
|
code = l_val.equals into , r_val
|
||||||
when "+"
|
when "+"
|
||||||
|
@ -97,15 +97,18 @@ module Vm
|
|||||||
def less_or_equal block , right
|
def less_or_equal block , right
|
||||||
RegisterMachine.instance.integer_less_or_equal block , self , right
|
RegisterMachine.instance.integer_less_or_equal block , self , right
|
||||||
end
|
end
|
||||||
|
def greater_or_equal block , right
|
||||||
|
RegisterMachine.instance.integer_greater_or_equal block , self , right
|
||||||
|
end
|
||||||
def greater_than block , right
|
def greater_than block , right
|
||||||
RegisterMachine.instance.integer_greater_than block , self , right
|
RegisterMachine.instance.integer_greater_than block , self , right
|
||||||
end
|
end
|
||||||
def equals block , right
|
|
||||||
RegisterMachine.instance.integer_equals block , self , right
|
|
||||||
end
|
|
||||||
def less_than block , right
|
def less_than block , right
|
||||||
RegisterMachine.instance.integer_less_than block , self , right
|
RegisterMachine.instance.integer_less_than block , self , right
|
||||||
end
|
end
|
||||||
|
def equals block , right
|
||||||
|
RegisterMachine.instance.integer_equals block , self , right
|
||||||
|
end
|
||||||
def == other
|
def == other
|
||||||
code = class_for(CompareInstruction).new(self , other , opcode: :cmp)
|
code = class_for(CompareInstruction).new(self , other , opcode: :cmp)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user