Refactor reciprocal and reciprocal square root estimate into target-independent funct...
authorSanjay Patel <spatel@rotateright.com>
Fri, 26 Sep 2014 23:01:47 +0000 (23:01 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 26 Sep 2014 23:01:47 +0000 (23:01 +0000)
commit676af35b385f9b39e9e874895a144fcebb1b8cd8
treefba772e353c7947509e5cc3165f6d843366bfd29
parent173573736b9b0c2be3c69848dd918fd051db5d6f
Refactor reciprocal and reciprocal square root estimate into target-independent functions (part 2).

This is purely refactoring. No functional changes intended. PowerPC is the only target
that is currently using this interface.

The ultimate goal is to allow targets other than PowerPC (certainly X86 and Aarch64) to turn this:

z = y / sqrt(x)

into:

z = y * rsqrte(x)

And:

z = y / x

into:

z = y * rcpe(x)

using whatever HW magic they can use. See http://llvm.org/bugs/show_bug.cgi?id=20900 .

There is one hook in TargetLowering to get the target-specific opcode for an estimate instruction
along with the number of refinement steps needed to make the estimate usable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218553 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCISelLowering.h
test/CodeGen/PowerPC/recipest.ll