Agreed in principle. I would probably use Rexx to create it. The complexity I referred to was the sum of a whole bunch of things that would be necessary:
- linking out to assembler - a 256-byte xlate table and TR - LRVG - FLOGR - dealing somewhere with the zero case Not the most complex thing ever, but a bunch of stuff. As I write mainframe product code these days I always think "one of these days this code may have to be maintained by someone who is a lot more comfortable in C than with assembler." > hours debugging later Or years of wrong results that might have a severe negative business impact that was never detected, or was detected only after years. Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Kenneth Wilkerson Sent: Wednesday, July 24, 2013 9:43 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Is there a "reverse bits" hardware instruction? I can't imagine any instruction sequence in any language performing a "Load Reversed with Mirrored Bytes" more efficiently in the Z/Architecture than a STG, TR for eight bytes and LRVG. Even though, the TR is probably micro-coded (I don't know about the LRVG), I can't see any loop that shifts and manipulates the data and repeats up to 63 times (assuming a very dense register) could outperform this. I wrote an algorithm using a FLOGR but except in the best cases (all 0s or many leading 0s), I can't imagine this running faster. And with negative numbers (-1 being the worst case), you would probably want to exclusive or with foxes before and after the operation to make the value more sparse. However, in your initial post you talked about the above sequence involving the TR being complex. I assume you're talking about the translate table itself. When I need translate tables that are not "simple" and particularly error prone, I write a program to create it. I would quadword align the origin and result tables, do the tests and sets (in this case X'80' to 'X01', ... X'01' to X'80'), load the address of the result table in a register, DC H'0' to get an 0c1. I would set a slip and run the job. I could then format the dump and cut and paste (with a little manipulation) the table into an assembler source. In this case, if the first and last 16 bytes of the table are correct, the its probably 100% correct. I find the half hour I use doing this for "error prone" translate tables can save me hours debugging later. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN