News for hackers. Stuff that matters.
Re:I Ported SAP to a 1976 CPU. It Wasn't That Slow by yorwba on Monday July 07, 2025 @04:16AM (#44487903)
In this case, the lookup table is used for popcount, and there's a comment in the Z80 assembly that says "One lookup vs eight bit tests." If the code could make use of a hardware popcount instruction, the lookup table would lose, but if that isn't available, a 256-byte lookup table could be faster. So it's less "lookup tables are always faster" and more "lookup tables can be faster, this is one such case."
Re:I Ported SAP to a 1976 CPU. It Wasn't That Slow by ooisee on Monday July 07, 2025 @09:43AM (#44490313)
probably fastest popcount in z80 that does not use aligned table, would be shift A through flag, then conditional INC C, unrolled, still slower than ld l,a: ld b,(hl).