Hacker News new | ask | show | jobs
by ryao 496 days ago
For some reason, I feel like this is harder to implement than you expect. The way to find out would be to get a bunch of examples of people doing this “optimizations in shader code, look at the IR generated compared to the optimal version and figure out a set of rules to detect the bad versions and transform it into a good versions. Keep in mind that in the example, the addition operators could be replaced with logical OR operators, so there are definitely multiple variations that need to be detected and corrected.
1 comments

I've checked and on "certain vendors" the mix + step is actually (slightly) better: same temp usage, lower instructions/cycles.