unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: Miles Bader <miles@gnu.org>
Cc: Thien-Thi Nguyen <ttn@gnuvola.org>, emacs-devel@gnu.org
Subject: Re: Untagging by subtraction instead of masking on USE_LSB_TAG
Date: Mon, 28 Jan 2008 14:02:51 +0900	[thread overview]
Message-ID: <wlbq764k5g.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <buoodb6d1ad.fsf@dhapc248.dev.necel.com>

>>>>> On Mon, 28 Jan 2008 13:25:30 +0900, Miles Bader <miles.bader@necel.com> said:

> Miles Bader <miles.bader@necel.com> writes:
>> Note that the important value here is the EA, not the offset.
>> Typically in a LSB tag scheme, the tags are arranged so that after
>> adding these "funny" offsets, the resulting EA is aligned properly.

> BTW, such a method won't work on architectures where offsets are
> inherently aligned -- for instance, doesn't the x86 implicitly scale
> the offset by the size of the value being loaded?  Does anybody know
> what is usually done on such an architecture?

I'm not sure, but there might be.  At least, the result on intel Mac
with gcc -Os was similar to that on PowerPC.

  _cons_to_long:                  _cons_to_long:
	  pushl   %ebp                    pushl   %ebp
	  movl    %esp, %ebp              movl    %esp, %ebp
	  movl    8(%ebp), %eax           movl    8(%ebp), %eax
	  testb   $7, %al                 testb   $7, %al
	  jne     L617                    jne     L617
	  sarl    $3, %eax                sarl    $3, %eax
	  jmp     L619                    jmp     L619
  L617:                           L617:
	  andl    $-8, %eax
	  movl    (%eax), %ecx            movl    -5(%eax), %ecx
	  movl    4(%eax), %edx           movl    -1(%eax), %edx
	  movl    %edx, %eax              movl    %edx, %eax
	  andl    $7, %eax                andl    $7, %eax
	  cmpl    $5, %eax                cmpl    $5, %eax
	  jne     L620                    jne     L620
	  movl    %edx, %eax
	  andl    $-8, %eax
	  movl    (%eax), %edx            movl    -5(%edx), %edx
  L620:                           L620:
	  movl    %ecx, %eax              movl    %ecx, %eax
	  sarl    $3, %eax                sarl    $3, %eax
	  sall    $16, %eax               sall    $16, %eax
	  sarl    $3, %edx                sarl    $3, %edx
	  orl     %edx, %eax              orl     %edx, %eax
  L619:                           L619:
	  popl    %ebp                    popl    %ebp
	  ret                             ret

And Solaris/SPARC with gcc -Os:

  cons_to_long:                   cons_to_long:
	  !#PROLOGUE# 0                   !#PROLOGUE# 0
	  !#PROLOGUE# 1                   !#PROLOGUE# 1
	  and     %o0, -8, %o4            mov     %o0, %o4
	  andcc   %o0, 7, %g0             andcc   %o0, 7, %g0
	  be      .LL952                  be      .LL949
	  sra     %o0, 3, %o0             sra     %o0, 3, %o0
	  ld      [%o4+4], %o5            ld      [%o4-1], %o5
	  and     %o5, 7, %g1             and     %o5, 7, %g1
	  cmp     %g1, 5                  cmp     %g1, 5
	  ld      [%o4], %g1              ld      [%o4-5], %g1
	  sra     %g1, 3, %g1             sra     %g1, 3, %g1
	  and     %o5, -8, %o3
	  bne     .LL954                  bne     .LL951
	  sll     %g1, 16, %o0            sll     %g1, 16, %o0
	  ld      [%o3], %o5              ld      [%o5-5], %o5
  .LL954:                         .LL951:
	  sra     %o5, 3, %g1             sra     %o5, 3, %g1
	  or      %o0, %g1, %o0           or      %o0, %g1, %o0
  .LL952:                         .LL949:
	  retl                            retl
	  nop                             nop

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

  reply	other threads:[~2008-01-28  5:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-28  2:07 Untagging by subtraction instead of masking on USE_LSB_TAG YAMAMOTO Mitsuharu
2008-01-28  3:52 ` Thien-Thi Nguyen
2008-01-28  4:22   ` Miles Bader
2008-01-28  4:25     ` Miles Bader
2008-01-28  5:02       ` YAMAMOTO Mitsuharu [this message]
2008-01-28 15:07 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wlbq764k5g.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    --cc=ttn@gnuvola.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).