[LLVMdev] support for division by constant in APInt
clattner at apple.com
Sat Apr 25 13:31:22 CDT 2009
On Apr 23, 2009, at 6:26 AM, Jay Foad wrote:
> 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.
The patch looks fine to me, does it pass regression tests etc? If so,
please apply, or contact me off list if you don't yet have commit
access. Thanks Jay!
More information about the LLVMdev