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