News for hackers. Stuff that matters.
Re:Popcount CPU instruction by drfuchs on Sunday September 08, 2019 @11:04PM (#20914899)
I about fell out of my chair when I saw gcc and clang both turn (u>>s)|(u<<(32-s)) into a single "rorl" (rotate right logical) instruction.
Re:Popcount CPU instruction by ncmncm on Monday September 09, 2019 @01:21AM (#20915387)
Even pcc (on version 7 pdp-11 unix) knew that one.
Re:Popcount CPU instruction by neerajsi on Monday September 09, 2019 @01:51AM (#20915519)
That's a really easy one for compilers to detect. They start with the OR as the root and look backward to recognize the shifts and subtract.
Re:Popcount CPU instruction by zzo38computer on Monday September 09, 2019 @02:26AM (#20915658)
That I expected, actually. (It seems common enough to me, that it would be implemented like that.)