I sometimes did a TRT to scan the string for one, or more, characters.
Initialize GPR1 to point to the end of the string. But TRT is
sometimes slow. Looping is not necessarily bad. The following code
will likely run quite fast:

          LA   R3,STRING
          LA   R4,1
          LA   R5,L'STRING(,R3)
          BPRP 8,TEST,LOOP
          BPRP 8,JUMP,TEST
LOOP CLI 0(R3),C'.'
JUMP  JE ELOOP
TEST    BRXLE R3,R4,LOOP
    J NO_PERIOD
ELOOP DS 0H


The BRXLE basically adds R4 (one) to R3, compares it to R5, and loops
if R3 <= R5. If STRING is more than 255 characters, use LAY (20 bit),
or maybe a LFI to initialize R5. The BPRP instructions are likely
overkill. It basically says that the BRXLE is likely to branch and
when it does, it will target the LOOP location. And that the JE is not
likely to branch. This sets up the branch prediction table, assuming
that the JE branch will happen at most once, and the BRXLE branch is
likely to happen often. Feel free to leave them out. They don't affect
the result, I just threw them in for "fun and profit".


On Fri, Mar 13, 2015 at 12:28 PM, Pinnacle <[email protected]> wrote:
> I have a dataset FIRST.SECOND.THIRD, and I want to get SECOND.THIRD.
> Normally I would loop to one character at a time to get to the '.', but I
> need performance here.  I sure some of you assembler gurus could give me
> some inscrutable assembler to get there in like one or two instructions.
> Thanks in advance!
>
> Regards,
> Tom Conley
>
> --
>
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN



-- 
If you sent twitter messages while exploring, are you on a textpedition?

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to