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>
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! -Chris
> The patch looks fine to me, does it pass regression tests etc?Yes, I've just run a successful "make" in the test-suite module. It took hours! Is there a smaller set of regression tests I could run for changes like this in future? Thanks, Jay.
> 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!Committed here: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090427/076916.html Thanks! Jay.
Maybe Matching Threads
- [LLVMdev] support for division by constant in APInt
- [LLVMdev] support for division by constant in APInt
- [LLVMdev] support for division by constant in APInt
- [LLVMdev] support for division by constant in APInt
- [LLVMdev] [cfe-dev] LLVM 3.0rc3 Testing Beginning