[llvm-commits] [PATCH][Fastmath, Instcombine] Enhancement of Fdiv

Stephen Canon scanon at apple.com
Fri Jan 11 17:14:59 PST 2013


> Does (X / C1) / C2 ==> X / (C1 * C2) preserve more precision than reciprocal? The idea behind UnsafeAlgebra (commonly denoted as "fast") is that if you're allowing unsafe algebraic transformations like reassociation, then you're already throwing a level of caution to the wind, and all other flags should be implied. If allowing reassociation of constants does guarantee more precision, and there are users who would desire that but not reciprocal or other aspects of "fast", then I'm ok with the idea of splitting out another flag. It'd be nice having help/guidance doing so, of course :-)

In general, (X/C1)/C2 --> X/(C1*C2) is not any worse than X/C1 --> X*(1/C1) (in particular, its *much* less offensive than reassociating additions).  It's conceivable that we may really want to have:

	- allow reassociation of multiplication and division, and replacement of division with reciprocal multiply.
	- fast (arbitrary algebraic transforms)

instead of having reciprocal be alone in the first category.

- Steve





More information about the llvm-commits mailing list