Have you checked the code to make sure that the Lattice version of the division code is taking the parameters as Lattice passes them, and not as gcc does? It's quite possible that the two compilers generate different code. I seem to recall that gcc generates a non-standard function call for division and multiplication (parameters in d0 and d1 instead of on the stack, for example).