From eb440c4d5dc8700eca70f70e4839b8b03cc8624a Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 23 Jul 2015 12:00:13 -0700 Subject: Mention that middle-end optimization can benefit from feature tests. --- FAQ.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'FAQ.md') diff --git a/FAQ.md b/FAQ.md index 127d736..a18d3a6 100644 --- a/FAQ.md +++ b/FAQ.md @@ -220,6 +220,8 @@ WebAssembly implementations run on the user side, so there is no opportunity for * Many of the important fast-math optimizations happen in the mid-level optimizer of a compiler, before WebAssembly code is emitted. For example, loop vectorization that depends on floating point reassociation can still be done at this level if the user applies the appropriate fast-math flags, so WebAssembly programs can still enjoy these benefits. As another example, compilers can replace floating point division with floating point multiplication by a reciprocal in WebAssembly programs just as they do for other platforms. + * Mid-level compiler optimizations may also be augmented by implementing them in a JIT library in WebAssembly. This would allow them to perform optimizations that benefit from having [information about the target](FeatureTest.md) and information about the source program semantics such as fast-math flags at the same time. For example, if SIMD types wider than 128-bit are added, it's expected that there would be feature tests allowing WebAssembly code to determine which SIMD types to use on a given platform. + * When WebAssembly [adds an FMA operation](FutureFeatures.md#additional-floating-point-operations), folding multiply and add sequences into FMA operators will be possible. * WebAssembly doesn't include its own math functions like `sin`, `cos`, `exp`, `pow`, and so on. WebAssembly's strategy for such functions is to allow them to be implemented as library routines in WebAssembly itself (note that x86's `sin` and `cos` instructions are slow and imprecise and are generally avoided these days anyway). Users wishing to use faster and less precise math functions on WebAssembly can simply select a math library implementation which does so. -- cgit v1.2.3