llvm/test
Sanjay Patel d8214db086 fold: sqrt(x * x * y) -> fabs(x) * sqrt(y)
If a square root call has an FP multiplication argument that can be reassociated,
then we can hoist a repeated factor out of the square root call and into a fabs().

In the simplest case, this:

   y = sqrt(x * x);

becomes this:

   y = fabs(x);

This patch relies on an earlier optimization in instcombine or reassociate to put the
multiplication tree into a canonical form, so we don't have to search over
every permutation of the multiplication tree.

Because there are no IR-level FastMathFlags for intrinsics (PR21290), we have to
use function-level attributes to do this optimization. This needs to be fixed
for both the intrinsics and in the backend.

Differential Revision: http://reviews.llvm.org/D5787



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219944 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-16 18:48:17 +00:00
..
Analysis [CFL-AA] CFL-AA should not assert on an va_arg instruction 2014-10-14 20:51:26 +00:00
Assembler
Bindings
Bitcode
BugPoint
CodeGen [AArch64] Fix miscompile of sdiv-by-power-of-2. 2014-10-16 16:41:15 +00:00
DebugInfo [dwarfdump] Prettyprint DW_AT_APPLE_property_attribute bitfield values. 2014-10-10 15:51:10 +00:00
ExecutionEngine
Feature
FileCheck
Instrumentation [asan-asm-instrumentation] Fixed memory references which includes %rsp as a base or an index register. 2014-10-13 09:37:47 +00:00
Integer
JitListener
Linker
LTO
MC [mips] Marked the DI/EI instruction aliases as MIPS32r2 2014-10-16 15:23:52 +00:00
Object Suppress llvm-ar's MRI tests for now on win32, since line_iterator is incompatible to CRLF. 2014-10-11 22:21:27 +00:00
Other
TableGen
tools [llvm-objdump] Update error message and add test case for mach-o file with bad library ordinals 2014-10-14 23:29:38 +00:00
Transforms fold: sqrt(x * x * y) -> fabs(x) * sqrt(y) 2014-10-16 18:48:17 +00:00
Unit
Verifier
YAMLParser
.clang-format
CMakeLists.txt
lit.cfg
lit.site.cfg.in
Makefile
Makefile.tests
TestRunner.sh