Assuming that eax holds the value,
compare or eax,eax
and cmp eax,-1
they both execute in one cycle
Name:
Anonymous2011-07-13 14:17
>>2
Isn't the flag already set when the value is assigned to the register? I guess it must be assumed that nothing else overwrites the flag, could the x86 ABIs have some sort of guarantee for this?
Flags Affected: n - - - - - z -
n Set if most significant bit of loaded value is set; else cleared.
z Set if value loaded is zero; else cleared.
At least on the 6502 it does ;_;
>>2
One is 2 bytes, the other is either 3 or 5 depending on how smart the assembler is. In any case, avoid using immediate values in instructions as it can cause an extra cycle under certain conditions. Maybe not noticeable these days with CPUs that gulp down 16+ bytes in a single fetch, but still good to keep in mind.
>>4,8
And for good reason too. The compiler and CPU can reorder data movement instructions around conditional jumps, with the latter possibly executing in parallel with a jump.
Name:
Anonymous2011-07-13 22:50
ASS-emblers are not SMART like CUM-pilers
Name:
Anonymous2011-07-13 23:46
13 July 2011
The US Government is due to establish a Federal Programming Administration (FPA) over the next few weeks. During this time, government officials will be screening individuals for administrative positions and will be laying the groundwork for guidelines which all software companies will soon be required to follow.
Under these guidelines, all computer code will be required to meet a level of quality. "Obviously, there is a lot of code in the market already," explains government technical expert Ryan Jennings. "Thus, the FPA will only screen software by a complaint-by-complaint basis." Jennings goes on to describe a couple of the guidelines. "In the future, programs will have to start up in less than a couple of seconds. The programs themselves have to be programmed in one of the many enterprise languages which are widespread in use, such as Java, VB.NET, and PHP. Remember, a positive user experience is everything here and the FPA will ensure that it happens."
US Congress is due to pass a set of laws in the future which will halt the distribution of computer software deemed "low-quality" by the FPA. According to Jennings, "The goal here is to lower and eventually eliminate the already high amount of poor quality software. Top issues in the agenda include the elimination of functional programming, a sub-par programming practice, and particularly open-source software. Open-source software is seen as destructive to the economy so we already have plans to ban its production." The screening process is estimated to be completed in a few days. "It's only a matter of time, but I'm certain this is going to work out. I really see a bright future in the computer industry."