[Openmcl-devel] Bug in integer arithmetic (AMD64)
Tom Emerson
tremerson at gmail.com
Wed Jul 20 10:44:13 PDT 2011
FWIW, I haven't updated my trunk in a while:
Welcome to Clozure Common Lisp Version 1.7-dev-r14672M-trunk (DarwinX8664)!
? (let ((a 1)) (* 33554433 -1 a))
-33554433
? (let ((a 1)) (* 144115188075855873 a -1))
-144115188075855873
So whatever happened happened post r14672.
On Wed, Jul 20, 2011 at 1:31 PM, Ron Garret <ron at flownet.com> wrote:
> The analogous bug exists in ccl32 as well:
>
> Welcome to Clozure Common Lisp Version 1.7-dev-r14832M-trunk
> (DarwinX8632)!
> ? (let ((a 1)) (* 33554433 -1 a))
> 33554432
>
> My bet is it's a bug in this assembly code:
>
> (define-x8664-vinsn multiply-fixnums (((dest :imm))
> ((x :imm)
> (y :imm))
> ((unboxed :s64)))
> ((:pred =
> (:apply %hard-regspec-value x)
> (:apply %hard-regspec-value dest))
> (movq (:%q y) (:%q unboxed))
> (sarq (:$ub x8664::fixnumshift) (:%q unboxed))
> (imulq (:%q unboxed) (:%q dest)))
> ((:and (:not (:pred =
> (:apply %hard-regspec-value x)
> (:apply %hard-regspec-value dest)))
> (:pred =
> (:apply %hard-regspec-value y)
> (:apply %hard-regspec-value dest)))
> (movq (:%q x) (:%q unboxed))
> (sarq (:$ub x8664::fixnumshift) (:%q unboxed))
> (imulq (:%q unboxed) (:%q dest)))
> ((:and (:not (:pred =
> (:apply %hard-regspec-value x)
> (:apply %hard-regspec-value dest)))
> (:not (:pred =
> (:apply %hard-regspec-value y)
> (:apply %hard-regspec-value dest))))
> (movq (:%q y) (:%q dest))
> (movq (:%q x) (:%q unboxed))
> (sarq (:$ub x8664::fixnumshift) (:%q unboxed))
> (imulq (:%q unboxed) (:%q dest))))
>
> But this is beyond my ability to decipher.
>
> rg
>
> On Jul 20, 2011, at 3:52 AM, Eric Marsden wrote:
>
> > Surprising!
> >
> > ,----
> > | ? (lisp-implementation-version)
> > | "Version 1.7-dev-r14890M (LinuxX8664)"
> > | ? (let ((a 1)) (* 144115188075855873 a -1))
> > | 144115188075855872
> > `----
> >
> > --
> > Eric Marsden
> >
> > _______________________________________________
> > Openmcl-devel mailing list
> > Openmcl-devel at clozure.com
> > http://clozure.com/mailman/listinfo/openmcl-devel
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
--
Tom Emerson
tremerson at gmail.com
http://treerex.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20110720/88cf8468/attachment.htm>
More information about the Openmcl-devel
mailing list