Skip to content

Commit

Permalink
Fix log{and|ior|xor} optimizer bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shirok committed Apr 5, 2021
1 parent 1a76d44 commit 2f6a3bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/compile-i.scm
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
(match (classify-args args)
[(#f) ($const unit)]
[(constval) ($const constval)]
[(#f x) (undefined)]
[(constval x) ($asm src `(,opcode) (list ($const constval) x))]
[(#f x y) ($asm src `(,opcode) (list x y))]
[_ (undefined)])))
Expand Down
4 changes: 4 additions & 0 deletions test/number.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2068,6 +2068,10 @@
(test* "logxor (0arg)" 0 (logxor))
(test* "logxor (1arg)" 1 (logxor 1))
(test* "logxor (1arg)" (test-error) (logxor 3.14))
;; check optimizer
;; http://chaton.practical-scheme.net/gauche/a/2021/04/04#entry-6069b57b-bbbff
(test* "logior (optimizer)" 1 (logior (if #f 0 1)))


(test* "logtest" #t
(logtest #xfeedbabe #x10000000))
Expand Down

0 comments on commit 2f6a3bf

Please sign in to comment.