According to LangRef, llvm.set.rounding sets rounding mode by integer argument:
0 - toward zero
1 - to nearest, ties to even
2 - toward positive infinity
3 - toward negative infinity
4 - to nearest, ties away from zero
While PowerPC ISA says:
0 - to nearest
1 - toward zero
2 - toward positive infinity
3 - toward negative infinity
This patch maps the argument and write into last two bits of FPSCR (rounding mode).
Why not produce much simpler code when the parameter is constant (using mtfsb[01])?