Yes, in the real instruction that gets send down those long multi-stage pipe lines in our multi-core CPUs :) They take the same amount of clock cycles to compare if a 32bit/64 bit value is equal, or not equal. When values are compared it merely sets one of the many flags in the CPU. This binary flag is used to determine if it was equal or not, the only difference in the machine code is whether you perform an action if the flag is true or perform an action if the flag is false. This is as true in RISC processors as it is in CISC.
But yes, this sort of optimisation is rarely needed. In fact, if you were to ever write the code in C/C++ the compiler would automatically optimise the machine code far better than most mere mortals could :) For some reason, you mentioning your teacher made me think of The Story of Mel: http://www.catb.org/jargon/html/story-of-mel.html -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Allen E. Elwood Sent: Thursday, 3 March 2011 3:42 PM To: 'U2 Users List' Subject: Re: [U2] Is this worth rewriting? Oh yeah, assembly - no sweat, you could do that on an old IBM360 along with floating point math and hosts of really awesome and incredibly mind numbing complicated stuff. But non-relocateable machine code? You know, the stuff that's *really* doing the work? I've never seen any that could do a NOT and an = at the same time even on the 360. And with reduced instruction sets being all the rage, it's probably not been added, eh? In any event, it's not a significant enough to have any measurable effect on speed, but is easier to look at. Btw, the rumor was that the teacher that I had for year two of the 360 assembly, who used to write I/O routines in machine code for IBM at the time as his day job, lost his mind and sat in the corner laughing to himself before they finally gave him a padded suit. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Dan McGrath Sent: Wednesday, March 02, 2011 8:00 PM To: U2 Users List Subject: Re: [U2] Is this worth rewriting? #1 In x86 assembly, you use can use JE or JNE. So you do the comparison, then jump. How you jump (or don't jump) determines if it was an = or #. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Allen E. Elwood Sent: Thursday, 3 March 2011 2:49 PM To: 'U2 Users List' Subject: Re: [U2] Is this worth rewriting? #1 In a binary register, in machine code, there is no such thing as #. There is NOT and = which is two comparisons. Now, granted, there have been significant improvements in cpu's since I did machine code in 1975, so maybe that has changed... <snip> _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ ########################################################################################### The information transmitted in this message and attachments (if any) is intended only for the person or entity to which it is addressed. The message may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. The intended recipient of this e-mail may only use, reproduce, disclose or distribute the information contained in this e-mail and any attached files with the permission of IMB. ########################################################################################### _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users
