News for hackers. Stuff that matters.
Re:Popcount CPU instruction by markh1967 on Monday September 09, 2019 @06:30AM (#20916867)
I think the most probable reason for this instruction is for calculating parity bits. This would need to be done fast so it makes sense that there would be a CPU instruction to do most of the work.
Re:Popcount CPU instruction by kps on Monday September 09, 2019 @12:49PM (#20919846)
Parity is much easier than counting. It's so easy that you get it for free in the x86 flags register. (… and because the 8008 was designed to run a terminal.)
Re:Popcount CPU instruction by bogomipz on Monday September 09, 2019 @01:47PM (#20920474)
>"(… and because the 8008 was designed to run a terminal.)"

Could you elaborate on this? How does the 8008 being designed to run a terminal relate to the parity and the flags register?

Re:Popcount CPU instruction by kps on Monday September 09, 2019 @03:34PM (#20921552)
Each iteration from the 8080 through x64 have a parity bit in the flags register for backwards compatibility with the previous generation. The 8008 was a microprocessor implementation of the Datapoint 2200 architecture.
Re:Popcount CPU instruction by bogomipz on Monday September 09, 2019 @04:33PM (#20922167)
Excellent, thanks for the insights. Cheers.
Re:Popcount CPU instruction by ryacko on Monday September 09, 2019 @03:39PM (#20921604)
Early protocols didn’t have error correction in the lower layers. The parity flag was equivalent to a CRC instruction nowadays. Presumably if parity was incorrect, that would mean the byte was transmitted incorrectly.