I'm afraid that "sexy" is a personal opinion and doesn't qualify as pedanticism. Which instruction is coolest is highly subjective. I'd probably go foe Execute. Also, some instructions that look prosaic, e.g., BXH, BXLE, lend themselves to cute tricks. So, yes, while obviously R*SBG will get a lot of use, other instructions are contenders.
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Assembler List [ASSEMBLER-LIST@LISTSERV.UGA.EDU] on behalf of Dan Greiner [dan_grei...@att.net] Sent: Thursday, March 3, 2022 5:22 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Fun with RXSBG At the risk of sounding pedantic, it's no secret that I think the ROTATE THEN * SELECTED BITS instructions are the sexiest ops in the architecture. A former colleague (thanks Tim) recently reminded me of a really cool feature of the RXSBG instruction that I used to improve a code fragment I've used for decades. For a long time, I've toyed with the following challenge. Given: ⦁ Register "P" points to the next free location in a buffer, the size and alignment of which are architecturally integral (i.e., a power of two), and ⦁ Static value "C" indicates the size and alignment of the buffer in the form of an characteristic (i.e., 2**C), and ⦁ Register "L" contains the byte length of a prospective object to be added to the buffer, what is the best way to determine whether the object will fit in the buffer. Not counting any branch following the determination, I had previously managed to trim this down to three instructions. For example, to determine if a prospective insertion crosses a 4 K-byte boundary: 1. LAY S,-1(L,P) where "S" is a scratch register. 2. XR S,P determine the difference 3. NILF S,X'FFFFF000' Turn off insignificant bits. If the condition code is zero following the AND (NILF) instruction, the object will fit. Obviously, this needs a little tweaking for 64-bit addressing, and there are other subtleties as to whether the buffer is completely full or there is additional remaining space. The exclusive-or part of a ROTATE THEN EXCLUSIVE OR SELECTED BITS (RXSBG) instruction can be used to determine the difference between the beginning and ending pointers, and the "selected bits" part of RXSBG effectively does the ANDing to determine if overflow occurred. By using the RXSBGT extended mnemonic, the test-results control is set such that the condition code indicates the results. Thus, steps 2 and 3 from above can be combined into: RXSBGT S,P,0,63-C,0 If interested, I have a handy "Will It Fit" macro to accommodate any integral size.