Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!world!iecc!compilers-sender From: eb%watergate@lucid.com (Eric Benson) Newsgroups: comp.compilers Subject: Re: SPARC tagged data Keywords: architecture, sparc Message-ID: <9104300702.AA01038@watergate> Date: 30 Apr 91 07:02:38 GMT References: <9104291542.AA11213@flora.techfak.uni-bielefeld.de> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: Eric Benson Organization: Compilers Central Lines: 34 Approved: compilers@iecc.cambridge.ma.us In article <9104291542.AA11213@flora.techfak.uni-bielefeld.de> horst@techfak.uni-bielefeld.de wrote: > Does anyone know what TAGGED DATA instructions are useful for and how to > use them? Tagged data is assumed to be 30 bits wide followed by two bits > set to zero. The SPARC allows add and subtract instructions on tagged data. > > [Most likely it's for immediate integers in a Lisp-like system that uses > tagged pointers, but I hope someone who actually knows will tell us. -John] Yes, the tagged arithmetic instructions were put in the SPARC architecture for Lucid Common Lisp. If the low-order two bits of a Lisp object reference are zero, it is a 30-bit immediate fixnum. If some of those bits are non-zero, it may be a pointer to a floating point number or a bignum (arbitrary-precision integer). Generic arithmetic is generally optimized for the fixnum case, since the overwhelming majority of arithmetic is performed on small integers. On many machines + is compiled inline as Test low order two bits of first operand. If nonzero, use general case. (Operand could be a float or bignum.) Test low order two bits of second operand. If nonzero, use general case. (Operand could be a float or bignum.) Add two operands. If overflow, use general case. (Result is a bignum). On the SPARC this is done as one instruction (TADDCC) followed by a conditional branch rarely taken. eb@lucid.com Eric Benson 415/329-8400 x5523 Lucid, Inc. Telex 3791739 LUCID 707 Laurel Street Fax 415/329-8480 Menlo Park, CA 94025 -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.