1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

More thorough lowering of lognot to CPS

* module/language/tree-il/compile-cps.scm (canonicalize): Lower to a
logxor with -1.
This commit is contained in:
Andy Wingo 2024-08-13 13:40:09 +02:00
parent c2e7d834c2
commit 7aa4cfa9de

View file

@ -2385,9 +2385,13 @@ integer."
;; if type folding can't prove Y to be an exact integer, then DCE
;; would have to leave it in the program for its possible
;; effects.
(($ <primcall> src 'logand (x ($ <primcall> _ 'lognot (y))))
(($ <primcall> src 'lognot (x))
(make-primcall src 'logxor (list x (make-const src -1))))
(($ <primcall> src 'logand
(x ($ <primcall> _ 'logxor (y ($ <const> _ -1)))))
(make-primcall src 'logsub (list x y)))
(($ <primcall> src 'logand (($ <primcall> _ 'lognot (y)) x))
(($ <primcall> src 'logand
(($ <primcall> _ 'logxor (y ($ <const> _ -1))) x))
(make-primcall src 'logsub (list x y)))
(($ <primcall> src 'throw ())