The existing code for APFloat mod was incorrect in two ways:
- intermediate rounding gave incorrect results in some cases (e.g. frem double 0.3 0.01)
- the method of integer truncation could cause intermediate overflow
This caused subsequent errors in the constant propagation pass, see https://llvm.org/bugs/show_bug.cgi?id=3316