Re:Finding a CPU Design Bug in the Xbox 360
by rzzzt on Monday January 08, 2018 @04:45PM
(#16100927)
Would gcc's "__builtin_expect" construct help in these cases?
[ Parent
| on HN ]
Re:Finding a CPU Design Bug in the Xbox 360
by tmandry on Tuesday January 09, 2018 @01:03AM
(#16103966)
In general, no, because branch predictors often ignore or override hints like this. It's hard to say without knowing this architecture specifically, of course.
Keep in mind that it's possible for a branch predictor to predict with "high confidence" a branch it's never seen before, because many branches may overlap into the same memory region of the predictor. The article touches on this.
Re:Finding a CPU Design Bug in the Xbox 360
by syncsynchalt on Monday January 08, 2018 @05:04PM
(#16101127)
Yes, it might have, assuming it's available in the 360 compilation environment.
Another solution would be to split the existing function into safe_function() and unsafe_function(), and remove use of the PREFETCH_EX flag. But then you have to explain to callers that they must not protect calls to unsafe_function() with any kind of conditional statement.
The author hinted at possible solutions but it was probably a case of "twice bitten" by that point.