[llvm-commits] [llvm] r136222 - /llvm/trunk/lib/Support/BlockFrequency.cpp
Chris Lattner
clattner at apple.com
Wed Jul 27 09:50:27 PDT 2011
On Jul 27, 2011, at 9:00 AM, Jakub Staszak wrote:
> Author: kuba
> Date: Wed Jul 27 11:00:40 2011
> New Revision: 136222
>
> URL: http://llvm.org/viewvc/llvm-project?rev=136222&view=rev
> Log:
> Optimize 96-bit division a little bit.
How about:
if (top_part1 == 0 && top_part2 == 0)
return low1/low2;
.. slow path..
?
-Chris
>
> Modified:
> llvm/trunk/lib/Support/BlockFrequency.cpp
>
> Modified: llvm/trunk/lib/Support/BlockFrequency.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/BlockFrequency.cpp?rev=136222&r1=136221&r2=136222&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Support/BlockFrequency.cpp (original)
> +++ llvm/trunk/lib/Support/BlockFrequency.cpp Wed Jul 27 11:00:40 2011
> @@ -46,8 +46,9 @@
> uint64_t div96bit(uint64_t W[2], uint32_t D) {
> uint64_t y = W[0];
> uint64_t x = W[1];
> + int i;
>
> - for (int i = 1; i <= 64; ++i) {
> + for (i = 1; i <= 64 && x; ++i) {
> uint32_t t = (int)x >> 31;
> x = (x << 1) | (y >> 63);
> y = y << 1;
> @@ -57,7 +58,7 @@
> }
> }
>
> - return y;
> + return y << (64 - i + 1);
> }
>
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list