Paul Gilmartin wrote:
In a recent note John Gilmore said:
Date: Mon, 26 Sep 2005 02:18:15 +0000
Meanwhile, I have found the new FLOGR instruction---It finds the leftmost
instance of a '1'b bit in a register doubleword---very convenient indeed for
scanning bit tables; and I have elected to use it when possible asnd to
provide an eponymous macro that does the same thing, albeit much more
slowly, on platforms that do not make FLOGR available.
Ah! The JFFO instruction which appeared on the decsystem KA-10 in
1968 (according to an unscientific Google search). I suppose it's
OK for IBM to use it now, since any patent has presumably expired.
But I'm curious how to do it. Binary search with CLR, shifting a
mask bit around? Novel use of TR and TRT? Alas, it's far easier
to find the rightmost '1'b bit than the leftmost.
We do this today using ALR Rx,Rx in a loop. The routine uses more than
one register, however. FLOGR uses only one (or two).
Can your macro use FLOGR when available, possibly by setting a SPIE
emulating FLOGR when it causes an operation exception?
STFLE.
--
.-----------------------------------------------------------------.
| Edward E. Jaffe | |
| Mgr, Research & Development | [EMAIL PROTECTED] |
| Phoenix Software International | Tel: (310) 338-0400 x318 |
| 5200 W Century Blvd, Suite 800 | Fax: (310) 338-0801 |
| Los Angeles, CA 90045 | http://www.phoenixsoftware.com |
'-----------------------------------------------------------------'
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html