A common way to implement nearbyint is by fiddling with the floating point environment and calling rint. This is used at least by the BSD libm and musl. As such, canonicalizing the latter to the former will create infinite loops for libm and generally pessimize performance, at least when the generic C versions are used. This patch preserves the rint in the libcall translation and also handle the domain truncation logic, so that rint with float argument will be reduced to rintf etc.
nearbyint( ) is not allowed to raise inexact. rint( ) is. Replacing nearbyint( ) with rint( ) requires that we support the FENV_ACCESS pragma (and only do the transformation when FENV_ACCESS is off).
Also, this is relatively low-value, because on newer platforms there's no difference; e.g. SSE4.1 and armv8 have single instruction implementations for both.