On 24 August 2012 14:48, Frank Swarbrick <frank.swarbr...@yahoo.com> wrote: > Assembler newbie here; please be gentle. > > Given the following: > - r7 points to the input parm list > - r2 indexes the input parm list
By fours, I trust... > I want to see if the first byte of the parm I am interested in is x'00'. > > l r3,0(r2,r7) r3 -> current parm > I can do this: > clc 0(1,r3),=x'00' > jne delimited_string The traditional way to do this is to use CLI, i.e. CLI 0(R3),X'00' This is likely to be a bit faster than the CLC, because there is but a single storage reference. With the CLC, in the worst case the literal =X'00' could be in another page, not in the cache, and even paged out. But really there's very little in it for something you don't do very often. Of course with CLC you can later change the program to compare more than one byte, should this be necessary. > Or I can do this: > llc r9,0(,r3) r9 = parm byte 0 > clijne r9,x'00',delimited_string Well... This may be faster, but only trivially so. It may be slower. It uses another register. Is it as clear and readable? I don't know; I haven't got every one of the shiny new instructions memorized, so upon encountering this code I'd have to look it up to be sure of what it's doing. > How do I decide which is better? If your code is not going inside a loop that is executed very frequently, write using instructions and instruction sequences that are clear and well known. Someone will thank you for it later, even if you never meet that someone. Tony H.