[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/02: More thorough lowering of lognot to CPS
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/02: More thorough lowering of lognot to CPS |
Date: |
Tue, 13 Aug 2024 07:44:34 -0400 (EDT) |
wingo pushed a commit to branch main
in repository guile.
commit 7aa4cfa9ded582952e16235d8aa634ada22febf2
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Tue Aug 13 13:40:09 2024 +0200
More thorough lowering of lognot to CPS
* module/language/tree-il/compile-cps.scm (canonicalize): Lower to a
logxor with -1.
---
module/language/tree-il/compile-cps.scm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/module/language/tree-il/compile-cps.scm
b/module/language/tree-il/compile-cps.scm
index e1cf8c297..ea5be8aa8 100644
--- a/module/language/tree-il/compile-cps.scm
+++ b/module/language/tree-il/compile-cps.scm
@@ -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 ())