News for hackers. Stuff that matters.
Re:Do Not Taunt Happy Fun Branch Predictor by Jensson on Wednesday January 25, 2023 @07:01PM (#34526000)
But he didn't set the compiler option, he rewrote it to explicitly use those instructions, that is micro optimization no matter how you look at it. The reason micro optimization is so easy to get better than compiler results is that you know things about the data the compiler doesn't, like in this case you know it is fine to reorder the result while the compiler is too dumb to know that. You need much smarter compilers than we have today in order for such micro optimizations to stop paying dividends.
Re:Do Not Taunt Happy Fun Branch Predictor by lmm on Wednesday January 25, 2023 @07:31PM (#34526252)
Making sure it will behave correctly with that change (which changes the result of the function!) is a macro change - you have to trace the implications all the way through the program.