if_literal

This commit is contained in:
Simon Forman
2019-11-07 16:15:41 -08:00
parent 0ce64f2ec4
commit 7bab15c64a
2 changed files with 10 additions and 3 deletions
+4 -3
View File
@@ -237,9 +237,10 @@ language.
([]) --> [].
([Term|Terms]) --> (Term), (Terms).
(if_literal(Reg, Label)) --> % commands marked by setting high bit.
[and_imm(0, Reg, 0x8000), % 1 << 15
eq_offset(Label)].
(if_literal(Reg, Label)) -->
[ior_imm(0, Reg, -30), % get just the two tag bits.
sub_imm(0, 0, 2), % subtract 2 to check if result is zero.
ne_offset(Label)].
% if reg = 0 jump to label.
(if_zero(Reg, Label)) --> [sub_imm(Reg, Reg, 0), eq_offset(Label)].