| ▲ | recursivecaveat 10 hours ago | |||||||
Simultaneous Multi-Threading (hyper-threading as Intel calls it). I'm not a cpu guy, but I think the ALU used for subtraction would be a more valuable resource to leave available to the other thread than whatever implements a xor. Hence you prefer to use the xor for zeroing and conserve the ALU for other threads to use. | ||||||||
| ▲ | tliltocatl 10 hours ago | parent | next [-] | |||||||
I don't think that's how it works. - Normally ALU implements all "light" operations (i. e. add/sub/and/or/xor) in a single block, separating them would result in far more interconnect overhead. Often, CPUs have specialized adder-only units for address generation, but never a xor-specialized block. - All CPUs that implement hyper-threading also optimize a XOR EAX,EAX into MOV EAX,ZERO/SET FLAGS (where ZERO is an invisible zero register just like on Itanium and RISCs). This helps register renaming and eliminates a spurious dependency. - The XOR trick is about as old as 8086 if not older. | ||||||||
| ||||||||
| ▲ | fredoralive 10 hours ago | parent | prev | next [-] | |||||||
By the time you get to a CPU complex enough to be to have SMT it is likely to detect these “clear register” patterns and special case them. XOR would also be handled by the ALU, the L is for logic. | ||||||||
| ▲ | IshKebab 8 hours ago | parent | prev [-] | |||||||
Most CPU use the same ALU for xor and sub. | ||||||||