mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
Fix cut-to-width
The logand mask has to be checked to be unsigned Fixes lp#2166725
This commit is contained in:
parent
d79b179ccb
commit
a42c09f297
|
|
@ -200,12 +200,9 @@
|
|||
(unless (cond ((and (vop-existsp :named sb-vm::logand-word-mask)
|
||||
;; logand-word-mask works without inserting additional cuts
|
||||
(combination-match2 ((lvar-dest lvar) :transform nil)
|
||||
((logand a b)
|
||||
(let ((other-type
|
||||
(lvar-type (if (lvar-from-lvar-p b lvar)
|
||||
a
|
||||
b))))
|
||||
(csubtypep other-type type))))))
|
||||
((logand (:type unsigned-byte a) b)
|
||||
(when (lvar-from-lvar-p b lvar)
|
||||
(csubtypep (lvar-type a) type))))))
|
||||
|
||||
(t
|
||||
(combination-match2 ((lvar-dest lvar) :transform nil)
|
||||
|
|
|
|||
|
|
@ -2655,3 +2655,11 @@
|
|||
((5 11) t)
|
||||
((5 10) nil)
|
||||
(((ash 1 (1- sb-vm:n-word-bits)) 0) (condition 'type-error))))
|
||||
|
||||
(with-test (:name :cut-to-width-omit-logand)
|
||||
(checked-compile-and-assert
|
||||
()
|
||||
`(lambda (d)
|
||||
(logand (lognot (logand d -3)) 1))
|
||||
((-7726172277034401953) 0)
|
||||
((0) 1)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue