improve gen-condition comparisons codegen for simple 32-bit cases

This commit is contained in:
Jeremy Penner 2021-08-16 22:12:26 -04:00
parent 6eec75d5f2
commit 7caf47ae37
2 changed files with 5 additions and 5 deletions

View file

@ -172,12 +172,13 @@
(let [[lhs rhs] args
ropgen (self:push-opgen rhs)
pre (when ropgen.setup (ropgen.setup))
(left etype) (self:expr-poly lhs)
lopgen (self:expr-opgen lhs)
left (when lopgen.setup (lopgen.setup) (if ropgen.hi :long :word))
truebranch (if ropgen.cleanup (.. :-if-true-cleanup- depth) truelabel)
falsebranch (if ropgen.cleanup (.. :-if-false-cleanup- depth) falselabel)
hibranch (when (= etype :long)
[[:lda self.LONG_HI] (ropgen.hi :cmp) (cmp.hibranch truebranch falsebranch) [:lda self.LONG_LO]])
lobranch [(ropgen.lo :cmp) (cmp.lobranch falsebranch)]
hibranch (when lopgen.hi
[(lopgen.hi :lda) (ropgen.hi :cmp) (cmp.hibranch truebranch falsebranch)])
lobranch [(lopgen.lo :lda) (ropgen.lo :cmp) (cmp.lobranch falsebranch)]
cleanup (when ropgen.cleanup (ropgen.cleanup))
post (if cleanup [truebranch cleanup [:bra truelabel] falsebranch cleanup [:bra falselabel]]
?branch-when-true [[:bra truelabel]])]

View file

@ -1,5 +1,4 @@
full compilation to expr-opgen TODO:
- gen-condition could potentially use it for lhs which is on the stack / in a global
- word! and long! are a mess right now
- I don't think word-at and long-at could use it