[LLVMdev] support for division by constant in APInt

Jay Foad jay.foad at gmail.com
Thu Apr 23 06:26:28 PDT 2009


In lib/CodeGen/SelectionDAG/TargetLowering.cpp there are some
functions magic() and magicu() that support optimising division by a
constant. I'd like to use these functions in an LLVM FunctionPass that
I'm working on. The attached patch moves these functions out of
TargetLowering.cpp and into the APInt class, so that I can reuse them
in my pass. What do you think?

It looks to me like these functions were copied straight out of
"Hacker's Delight", Henry S. Warren, Jr., so I added a comment
acknowledging that.

Thanks,
Jay.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.magic
Type: application/octet-stream
Size: 9620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090423/0eea71e5/attachment.obj>


More information about the llvm-dev mailing list