Linux PARISC architecture development
 help / color / mirror / Atom feed
From: "Michael S. Zick" <mszick@goquest.com>
To: parisc-linux@lists.parisc-linux.org
Cc: List Parisc <parisc-linux@parisc-linux.org>
Subject: Re: [parisc-linux] Should I read SHR[DW] as SHRP[DW] in parisc2.pdf?
Date: Fri, 13 Aug 2004 17:54:29 -0500	[thread overview]
Message-ID: <200408131754.29746.mszick@goquest.com> (raw)
In-Reply-To: <40FB9ACA0000BB69@ocpmta1.freegates.net>

On Wed August 11 2004 12:35, Joel Soete wrote:
> Hi all,
> 
> About parisc 2.0 insn set at pages 7-49 and 7-51 I read SHRD,S,cond ...
> and SHRW,S,cond ... but I don't find this mnemonic elsewhere in this book;
> should I better read SHRPD and SHRPW respectively (mnemonic well defined)?
> 
Write as 'shd' either parisc-1.x or parisc-2.x for 32-bit operations.
I cut & pasted an example into a test source file, compiled (32 & 64),
objdump'd the *.o, then with the help of a hex-editor and
my Captain Midnight Decoder ring on the results:
	__asm__(
	"	ldi		0,%1\n"

/* compile & objdump the *.o; both 32-bit and 64-bit */
	"	shd		%%r0,%0,16,%2\n"	
	"	extru,=	%2,15,16,%%r0\n"	

/* Yields (see parisc2.0.pdf, appendix 'C'):
32-bit:
major op-code: 34, op-code extension: 011 (3)
  5c:   d2 80 09 f4     shrpw r0,r20,16,r20

major op-code: 34, op-code extension: 111 (7)
  60:   d2 80 39 f0     extrw,u,= r20,15,16,r0

Also on 64-bit, the identical bit pattern:
  80:   d2 80 09 f4     shrpw r0,r20,16,r20
  84:   d2 80 39 f0     extrw,u,= r20,15,16,r0

Then checking chapter 7 on 'shrpw' it very clearly
states that this instruction effects only the right
half of the registers. (no mention of left half)

Then checking chapter 7 on 'extrw' and it states
that the coded bit-position-number is internally
incremented by 32 so that it actually refers to (in
this example) pos=15+32, len=16.
(Claims left half is 'undefined')

Which means that 'int fls(int x)' as written would 
get its bit-position-numbers translated internally.
(and my earlier posting about it scanning the high
32 bits was wrong).

I still haven't figured out how the author gets that
the last bit to test is #0 rather than #31 - but then
that might be a typo in the code or another thinko
in my reasoning.
*/

Mike
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

  parent reply	other threads:[~2004-08-13 22:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-11 17:35 [parisc-linux] Should I read SHR[DW] as SHRP[DW] in parisc2.pdf? Joel Soete
2004-08-12 17:41 ` Jim Hull
2004-08-12 19:33   ` Michael S. Zick
2004-08-13 15:20     ` [parisc-linux] Should I read SHR[DW] as SHRP[DW] in parisc2.p John David Anglin
2004-08-13 17:50       ` Michael S. Zick
2004-08-13 22:54 ` Michael S. Zick [this message]
2004-08-14  0:27   ` John David Anglin
2004-08-14  0:53     ` Michael S. Zick

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

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

  git send-email \
    --in-reply-to=200408131754.29746.mszick@goquest.com \
    --to=mszick@goquest.com \
    --cc=parisc-linux@lists.parisc-linux.org \
    --cc=parisc-linux@parisc-linux.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox