Re: How bad is the EX instruction?
On Fri, 13 Jan 2012 18:29:55 -0800, glen herrmannsfeldt wrote: The EX CLC is in fact in loop scanning a linked list for the right entry among 100-200 elements. You could also do binary search, which will find the right entry with about log(n) comparisons. How do you do a binary search on a linked list? -- Tom Marchant
Re: How bad is the EX instruction?
One Assembler trick I have seen in speeding up scanning loops was to use a CLI instruction to check the first byte of a string and then only doing the CLC/CLCL if the CLI matches. This trick even works if doing a binary search. -Original Message- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of Tom Marchant Sent: Monday, January 16, 2012 6:35 AM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: How bad is the EX instruction? On Fri, 13 Jan 2012 18:29:55 -0800, glen herrmannsfeldt wrote: The EX CLC is in fact in loop scanning a linked list for the right entry among 100-200 elements. You could also do binary search, which will find the right entry with about log(n) comparisons. How do you do a binary search on a linked list? -- Tom Marchant
Re: How bad is the EX instruction?
On Sat, Jan 14, 2012 at 3:29 AM, glen herrmannsfeldt g...@ugcs.caltech.edu wrote: I usually use a hash table. Especially if speed is important. You could also do binary search, which will find the right entry with about log(n) comparisons. Yeah, and I prefer to stop the earth rotation when I take a sun bath... ;-) Re-reading, I see I confused you with the right entry where it actually may be more than one so I have to walk the entire list. In fact, each entry has up to 5 possible fields to check like this. In this case the change frequency of the data is more than the reference rate, so on average I would have to build the hash table or search tree on each reference. And I don't really have a context where I could keep it. But if you have an efficient hash function handy for 200 strings of 6-8 (uppercase) characters, I'm game. My ad-hoc tests were a bit disappointing in rehash. Rob
Re: How good is the EX instruction?
From: Dan Skomsky, PSTI poodles...@sbcglobal.net Sent: Monday, 16 January 2012 11:49 PM One Assembler trick I have seen in speeding up scanning loops was to use a CLI instruction to check the first byte of a string and then only doing the CLC/CLCL if the CLI matches. This trick even works if doing a binary search. Marginal savings, I think, compared to EX/CLC or CLCL, for the reason that both CLC and CLCL give up after examining the first character, should they be unequal. Might be more fruitful to compare length of the key with that of an element first, and then carrrying out the compare should those lengths be equal. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Re: How bad is the EX instruction?
On Mon, 16 Jan 2012 06:49:54 -0600, Dan Skomsky, PSTI wrote: One Assembler trick I have seen in speeding up scanning loops was to use a CLI instruction to check the first byte of a string and then only doing the CLC/CLCL if the CLI matches. This trick even works if doing a binary search. I don't know if the cost of EX is high enough that you would benefit from doing a one byte CLC before an EX of a CLC. I don't see how a CLI will help you though. -- Tom Marchant
Re: How bad is the EX instruction?
On Mon, Jan 16, 2012 at 4:13 PM, Tom Marchant m42tom-ibmm...@yahoo.com wrote: On Mon, 16 Jan 2012 06:49:54 -0600, Dan Skomsky, PSTI wrote: One Assembler trick I have seen in speeding up scanning loops was to use a CLI instruction to check the first byte of a string and then only doing the CLC/CLCL if the CLI matches. This trick even works if doing a binary search. I don't know if the cost of EX is high enough that you would benefit from doing a one byte CLC before an EX of a CLC. I don't see how a CLI will help you though. Having the CLC near the EX helps for cache. I also like to assemble it in-line because the right USINGs apply. We noticed that it is attractive to run over the CLC (with the length byte 0 as assembled) and then EX behind your back to do the real thing. More attractive than branch over the target if the instruction lets you. I doubt whether a branch between the CLC and the EX would be advantage. Depending on how often the comparison already fails on the first byte, you trade an untaken branch against an EX CLC that fails on the first byte. Guess I should try that some Friday afternoon... Rob
Re: Enhanced CALL macro?
And YREGS. On 2012-01-12 21:17, Hall, Keven wrote: Have you forgotten about SAVE and RETURN in SYS1.MACLIB? IBM has you covered. Mostly covered, sort of...ish. K3n -Original Message- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of Paul Gilmartin Sent: Thursday, January 12, 2012 10:43 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: Enhanced CALL macro? On Jan 11, 2012, at 07:03, Rob Scott wrote: IMHO the first resource needed by any assembler programmer before writing anything non-trivial is a set of macros that enable subroutine calling, register saving and return that cater for all environments. Why doesn't IBM supply these and spare customers the redundant depletion of resource? -- gil -- M. Ray Mullins Roseville, CA, USA http://www.catherdersoftware.com/ German is essentially a form of assembly language consisting entirely of far calls heavily accented with throaty guttural sounds. ---ilvi French is essentially German with messed-up pronunciation and spelling. --Robert B Wilson English is essentially French converted to 7-bit ASCII. ---Christophe Pierret [for Alain LaBonté]
Re: How bad is the EX instruction?
On 2012-01-13 02:18, Rob van der Heij wrote: On Fri, Jan 13, 2012 at 8:13 AM, Martin Truebnermar...@pi-sysprog.de wrote: Rob, have you tried SRST? I had a hard time getting used to SRSTs way of using/wanting the resgisters- but then... It does an excellent job on searching for one (and only one) character in a string. Martin, Haven't, and probably should for my own education. We restrict our products to older architecture levels for a number of good reasons. Ya-but... SRST came in sometime during the late System/370 era. I have a yellow book with SRST and CLST defined. (I've been burned only once by a non-System/370 instruction (ICM), and that was on a plug-compatible that a Brazilian customer was running in the early 1990s. I have burned myself on using the wrong ARCH option in a C compile when a customer was still running a z900 (ARCH(5)) and I had accidentally left it set to ARCH(6). Later, Ray -- M. Ray Mullins Roseville, CA, USA http://www.catherdersoftware.com/ German is essentially a form of assembly language consisting entirely of far calls heavily accented with throaty guttural sounds. ---ilvi French is essentially German with messed-up pronunciation and spelling. --Robert B Wilson English is essentially French converted to 7-bit ASCII. ---Christophe Pierret [for Alain LaBonté]
Re: How bad is the EX instruction? (correction)
Arrgh. Correction to the below. Not enough caffeine, yet it's late in the morning... Tom Marchant correctly mention that SRST/CLST came in with ESA, not late System/370, as a look at my SEARS card just confirmed. However, the point still applies - SRST/CLST have been around for almost 25 years and I doubt anyone is still running ES 9000 boxes. On 2012-01-16 10:41, Ray Mullins wrote: On 2012-01-13 02:18, Rob van der Heij wrote: On Fri, Jan 13, 2012 at 8:13 AM, Martin Truebnermar...@pi-sysprog.de wrote: Rob, have you tried SRST? I had a hard time getting used to SRSTs way of using/wanting the resgisters- but then... It does an excellent job on searching for one (and only one) character in a string. Martin, Haven't, and probably should for my own education. We restrict our products to older architecture levels for a number of good reasons. Ya-but... SRST came in sometime during the late System/370 era. I have a yellow book with SRST and CLST defined. (I've been burned only once by a non-System/370 instruction (ICM), and that was on a plug-compatible that a Brazilian customer was running in the early 1990s. I have burned myself on using the wrong ARCH option in a C compile when a customer was still running a z900 (ARCH(5)) and I had accidentally left it set to ARCH(6). Later, Ray -- M. Ray Mullins Roseville, CA, USA http://www.catherdersoftware.com/ German is essentially a form of assembly language consisting entirely of far calls heavily accented with throaty guttural sounds. ---ilvi French is essentially German with messed-up pronunciation and spelling. --Robert B Wilson English is essentially French converted to 7-bit ASCII. ---Christophe Pierret [for Alain LaBonté] -- M. Ray Mullins Roseville, CA, USA http://www.catherdersoftware.com/ German is essentially a form of assembly language consisting entirely of far calls heavily accented with throaty guttural sounds. ---ilvi French is essentially German with messed-up pronunciation and spelling. --Robert B Wilson English is essentially French converted to 7-bit ASCII. ---Christophe Pierret [for Alain LaBonté]
Re: How bad is the EX instruction?
On Jan 16, 2012, at 05:35, Tom Marchant wrote: On Fri, 13 Jan 2012 18:29:55 -0800, glen herrmannsfeldt wrote: The EX CLC is in fact in loop scanning a linked list for the right entry among 100-200 elements. You could also do binary search, which will find the right entry with about log(n) comparisons. How do you do a binary search on a linked list? B-tree? -- gil
Re: How good is the EX instruction?
On Jan 16, 2012, at 07:53, robin wrote: From: Dan Skomsky, PSTI poodles...@sbcglobal.net Sent: Monday, 16 January 2012 11:49 PM One Assembler trick I have seen in speeding up scanning loops was to use a CLI instruction to check the first byte of a string and then only doing the CLC/CLCL if the CLI matches. This trick even works if doing a binary search. On the average (FSVO), how does this compare Boyer-Moore? I've seen suggested TRT for the first character, then CLC for the rest. Works much better for strings beginning with Z than for strings beginning with . Marginal savings, I think, compared to EX/CLC or CLCL, for the reason that both CLC and CLCL give up after examining the first character, should they be unequal. Might be more fruitful to compare length of the key with that of an element first, and then carrrying out the compare should those lengths be equal. Gives you =, but not or , so precludes binary search. What was the statement of the problem, anyway? CDC 3600/3800 had a Modify following instruction instruction that met much of the requirement for EX. And pipelining was of little import in that era. -- gil
How do you do a binary search on a linked list?
Binary search of an ORDERED linked list is in fact possible if one knows/keeps track of how many elements the list contains. It may even be be a useful thing to do when pointer-chasing operations are very much faster than key-comparison operations, as they are in, say, C. My gut feeling about doing it in assembly language is is that it would probably not be faster than Knuth's classical scheme of linear search for a glb followed by an additional equality-checking comparison of any bound obtained. Binary search in an explicit binary-search tree is of course easy. John Gilmore, Ashland, MA 01721 - USA
Re: How bad is the EX instruction? (correction)
I doubt anyone is still running ES 9000 boxes. I have paying customers on 9672s, MP2000, MP3000, etc. VSE, not z/OS. Tony Thigpen -Original Message - From: Ray Mullins Sent: 01/16/2012 01:48 PM Arrgh. Correction to the below. Not enough caffeine, yet it's late in the morning... Tom Marchant correctly mention that SRST/CLST came in with ESA, not late System/370, as a look at my SEARS card just confirmed. However, the point still applies - SRST/CLST have been around for almost 25 years and I doubt anyone is still running ES 9000 boxes.
Re: How bad is the EX instruction?
Saying that ... sub-optimizing of this sort is, I think, evidence of a pervasive malaise... is a short sighted generalization. Performance is one of the strongest reasons for coding in assembler and this discussion characterizes some of the low hanging fruit available for the attainment thereof. The timing differences can be quite significant when the code in question is embedded in a routine that is executed 100 billion times. Kerry Tenberg Austin, Tx On Thu, Jan 12, 2012 at 1:23 PM, John Gilmore johnwgilmore0...@gmail.comwrote: My own experience has been much more mixed, but I'd like to accept, in order to address what I take to be a more important issue, that Peter Farley is right when he says begin snippet My prior experiences in replacing MVCL/CLCL's with multiple MVC/CLC's and even MVC/CLC loops for small areas (FSVO small) is that MVCL/CLCL loses almost every time. /end snippet Preoccupation with these issues is, at best, counter-productive. The MVCLE is logically simpler and should be used unless one knows that one has only some fixed, small number n 256 bytes to move. No one has ever claimed that the timing differences here are large, significant ones; and the continuing preoccupation here with suboptimizing of this sort is, I think, evidence of a pervasive malaise, a retreat into the familiar that precludes consideration of more, much more, important design issues. John Gilmore, Ashland, MA 01721 - USA
Re: How good is the EX instruction?
From: Rob van der Heij rvdh...@gmail.com Sent: Tuesday, 17 January 2012 2:37 AM Having the CLC near the EX helps for cache. I also like to assemble it in-line because the right USINGs apply. We noticed that it is attractive to run over the CLC (with the length byte 0 as assembled) and then EX behind your back to do the real thing. More attractive than branch over the target if the instruction lets you. A convenient place for the subject instruction is immediately after a B instruction, thus avoiding the need to execute CLC or MVC twice. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Re: How good is the EX instruction?
From: Paul Gilmartin paulgboul...@aim.com Sent: Tuesday, 17 January 2012 7:33 AM CDC 3600/3800 had a Modify following instruction instruction The S/360 and subsequent machines have one like that also. In the case of MVC/CLC instructions :- stc 1,*+5 mvc a(0),b can be useful. EX does more than just insert length into SS instructions. The ability to OR in bits from the second byte of the subject instruction along with the content of the nominated register is probably rarely used in the case of SS instructions, but can be used to effect with RX instructions, where you might want to retain, say, the existing index field in the subject instruction, yet supply bits for the Register field of the subject instruction. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Re: How good is the EX instruction?
From: McKown, John john.mck...@healthmarkets.com Sent: Friday, 13 January 2012 2:32 AM OK, I hope I'm not becoming wearisome with my yammering. But I am not too busy right now. And I still really like and respect the z architecture (despite its horrendous price). I ask about the CPU cost of an EX because that same program that I'm working on uses the EX a fair amount to move variable length strings into a blank-initialized area for reporting purposes. Instead of EX of an MVC, I could use MVCL or MVCLE. As the task is to move stuff to a buffer for reporting purposes, the cpu time will be negligible compared to I/O time. Confucius say: If it works, don't fix it. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.