On Mon Nov 28 17:56:57 2022 +0000, Francisco Casas wrote:
Mathematically yes, but the native compiler does a `1/(·)` first, and then uses a `mul_sat`. So it made sense to me to leave it as DIV + MUL + SAT, just in case we ever want to merge the MUL and the SAT.
Interesting. sm5 won't optimize a*(1/b) to a/b, or vice versa. I don't know why, but I guess if there's a difference in precision we should probably emulate native...? @Mystral, do you have thoughts on this?
Note that _sat is just a modifier which saturates the destination after performing whatever opcode. I.e. in theory this could be a single div_sat. No idea why native doesn't do that.