On 2015-10-04 6:52 AM, Brent Longborough wrote:
Oops!

Clearly it's desirable to step to the next item each time round
the loop. Whether to use AHI or LA is probably not significant
in a modern pipelined engine, but probably has supporters in
both camps.

I would never use JXLE here (or, indeed, anywhere else) for a
number of complementary reasons ...
In your example R4 is loaded with LA. Ignoring subtle performance differences I'd use AHI only if the incr > 4095 . If it were "L R4,TBLADDR" I'd use LA for sure because the address could have the VL-bit set !

For this type of loop I use R0, R1, R14 and R15. Although I still agree about BXLE/BXH. I used to optimize the loop using BASR(/BALR) / BCTR:

         LA    R4,FUNCTBL          Start of table
         USING BTAB,R4
         LHI   R0,TBLENT           Item count
         BASR  R14,0               *** LOOP ENTRY ***
         CLC   FUNC,BFUN           This one?
         JE    FOUND_IT            Yes - handle
         LA    R4,BNXT             No  - try next
         BCTR  R0,R14              *** Loop Until done ***
         J     ENDOFDAYS           Not found

... and on today's processors the (1) extra BASR costs more than 'n' BCTRs 
save. Likely the same also applies to the BXLE / BXH alternative.

Andreas Geissbuehler

Reply via email to