|
From: Florian K. <br...@ac...> - 2012-09-06 16:34:51
|
I just ran into this while looking at ppc insn selection for inspiration as to how to handle floating point rounding per FPC bits efficiently. So, in essence, the insn selector remembers the rounding mode of the previous floating point operation in env->previous_rm and if the next floating point operation uses the same rounding mode it does not need to set the FPSCR bits again. This is a neat trick. What puzzled me is that there is only a single previous rounding mode. Wouldn't you want two of them? One for bfp and one for dfp? Consider a sequence of insns where bfp and dfp operations alternate. Assume further that all bfp insns use the same rounding mode and all dfp insns use the same rounding mode. You'd be reloading the FPSCR bits for every such insn because previous_rm would be different with each insn. If you had two of them you would not have to reload ever (for this particular sequence). The current implementation works, it's correct. I think it would be more efficient if you had two previous rounding modes in the env struct. Cheers, Florian |