|
>>Could someone please point to the documentation
>>on the Bitwise MI instructions with perhaps a line
>>or two on how to use them? Thanks.
Thanks to Doug Handy for posting Barbara's MI built-in code (and thanks to
Barbara for writing it!!)
I ran a very quick test between my old way and the MI built-in method. For
5 million iterations, the old way took 1.5 minutes. The MI method took 40
seconds.
h bnddir('QC2LE')
* dbgview(*list)
d operand s 1
* Work fields
d op1 s like(operand)
d op2 s like(operand)
d result s like(operand)
d resultwrk s like(operand)
d length s 10u 0 inz(1)
d limitIn s 15p 5
d limit s 10u 0
d tod s 14s 0
d op1@ s *
d op2@ s *
d resultwrk@ s *
dbitNot pr like(operand)
d op1In like(operand) const
dbitOr pr like(operand)
d op1In like(operand) const
d op2In like(operand) const
dbitAnd pr like(operand)
d op1In like(operand) const
d op2In like(operand) const
dbitXor pr like(operand)
d op1In like(operand) const
d op2In like(operand) const
* MI built-ins
d notstr pr
d resultWrk@ * value
d op1Wrk@ * value
d orstr pr extproc('_ORSTR')
d resultWrk@ * value
d op1Wrk@ * value
d op2Wrk@ * value
d lenWrk@ 10u 0 value
d andstr pr extproc('_ANDSTR')
d resultWrk@ * value
d op1Wrk@ * value
d op2Wrk@ * value
d lenWrk@ 10u 0 value
d xorstr pr extproc('_XORSTR')
d resultWrk@ * value
d op1Wrk@ * value
d op2Wrk@ * value
d lenWrk@ 10u 0 value
c *entry plist
c parm limitIn
c eval limit = limitIn
c eval op1@ = %addr(op1)
c eval op2@ = %addr(op2)
c eval resultWrk@ = %addr(resultWrk)
c eval op1 = x'80'
c eval op2 = x'83'
c time tod
c dump
* Loop to get legitimate timings - hand rolled
c do LIMIT
c eval result = bitNot(op1)
c eval result = bitOr(op1: op2)
c eval result = bitAnd(op1: op2)
c eval result = bitXor(op1: op2)
c enddo
c time tod
c dump
* Loop to get legitimate timings - MI built-ins
c do LIMIT
c callp notstr(resultWrk@: op1@)
c callp orstr(resultWrk@: op1@: op2@: length)
c callp andstr(resultWrk@: op1@: op2@: length)
c callp xorstr(resultWrk@: op1@: op2@: length)
c enddo
c time tod
c dump
c eval *inLr = *on
*------------------------------------
pnotstr b
d notstr pi
d resultWrk@ * value
d op1Wrk@ * value
d hexFF s 1a
d hexFF@ s *
c eval hexFF@ = %addr(hexFF)
c eval hexFF = x'ff'
c callp xorstr(resultWrk@: op1Wrk@: hexFF@:
length)
c return
p e
*------------------------------------
pbitNot b
dbitNot pi like(operand)
d op1In like(operand) const
d result s like(operand)
c eval result = x'ff'
c bitoff op1In result
c return result
p e
*------------------------------------
pbitOr b
dbitOr pi like(operand)
d op1In like(operand) const
d op2In like(operand) const
d result s like(operand)
c eval result = op1In
c biton op2In result
c return result
p e
*------------------------------------
pbitAnd b
dbitAnd pi like(operand)
d op1In like(operand) const
d op2In like(operand) const
d result s like(operand)
d work s like(operand)
c eval result = op1In
c eval work = op1In
c bitoff op2In work
c bitoff work result
c return result
p e
*------------------------------------
pbitXor b
dbitXor pi like(operand)
d op1In like(operand) const
d op2In like(operand) const
d result s like(operand)
d work s like(operand)
c eval result = op1In
c eval work = op2In
c bitoff op1In work
c bitoff op2In result
c biton work result
c return result
p e
Buck Calabro
Aptis; Albany, NY
"Nothing is so firmly believed as
that which we least know" -- Michel Montaigne
Visit the Midrange archives at http://www.midrange.com
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.