I am writing a bicubic interpolation to perform image rotation, and I am encountering a bug that may be due to the compiler, though I am not sure. Essentially, my routine works fine in debug, and also in release but only if floating-point speculation is off. If it is on, then I start to see artefacts in the image. I am not knowledgeable enough on the topic of fp model and speculation to be sure of what is going on. Can somebody shed some lights on the topic? Any ideas/suggestions/comments more than welcome.
PS: I know IPP has such a routine, but I need to have portable code, plus I can achieve higher speed with a fraction of the memory anyway, so really no point of using IPP.
This doesn't entirely make sense, unless speculation has side effects. Does -fp-model source work? The terminology seems to refer back to a paper for sale on the ACM site. Presumably, it means that some operations may be moved outside your if(), possibly enabling further "optimizations," which, under -fp-model fast, aren't required to conform to C standard.