* Add code to reduce multiplies by constant integers to shifts, adds and
authorDuraid Madina <duraid@octopus.com.au>
Tue, 26 Apr 2005 07:23:02 +0000 (07:23 +0000)
committerDuraid Madina <duraid@octopus.com.au>
Tue, 26 Apr 2005 07:23:02 +0000 (07:23 +0000)
commitb2322561cbc79ff2989dc5622ec3063502472337
tree3717ce32e0ba383c0d79e666f7684fb6bb2661b0
parent912401c3f61a2523b7b6ba1722d115677aedb8d9
* Add code to reduce multiplies by constant integers to shifts, adds and
  subtracts. This is a very rough and nasty implementation of Lefevre's
  "pattern finding" algorithm. With a few small changes though, it should
  end up beating most other methods in common use, regardless of the size
  of the constant (currently, it's often one or two shifts worse)

  TODO: rewrite it so it's not hideously ugly (this is a translation from
        perl, which doesn't help ;)
        bypass most of it for multiplies by 2^n+1
(eventually) teach it that some combinations of shift+add are
cheaper than others (e.g. shladd on ia64, scaled adds on alpha)
get it to try multiple booth encodings in search of the cheapest
routine
make it work for negative constants

  This is hacked up as a DAG->DAG transform, so once I clean it up I hope
  it'll be pulled out of here and put somewhere else. The only thing backends
  should really have to worry about for now is where to draw the line
  between using this code vs. going ahead and doing an integer multiply
  anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21560 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/IA64/IA64ISelPattern.cpp