Re: SPARC tagged data

Eric Benson <eb%watergate@lucid.com>
Tue, 30 Apr 91 00:02:38 PDT

          From comp.compilers

Related articles
SPARC tagged data horst@techfak.uni-bielefeld.de (1991-04-29)
Re: SPARC tagged data eb%watergate@lucid.com (Eric Benson) (1991-04-30)
Re: SPARC tagged data moss@cs.umass.edu (1991-04-30)
Re: SPARC tagged data weitek!weaver@Sun.COM (1991-04-30)
Re: SPARC tagged data kers@otter.hpl.hp.com (1991-05-07)
Re: SPARC tagged data pardo@june.cs.washington.edu (1991-05-08)
Re: SPARC tagged data henry@zoo.toronto.edu (1991-05-09)
Re: SPARC tagged data pardo@june.cs.washington.edu (1991-05-10)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Eric Benson <eb%watergate@lucid.com>
Keywords: architecture, sparc
Organization: Compilers Central
References: <9104291542.AA11213@flora.techfak.uni-bielefeld.de>
Date: Tue, 30 Apr 91 00:02:38 PDT

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
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.