[llvm] Bfi precision (PR #66285)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 14:46:39 PDT 2023


MatzeB wrote:

So we probably want something like the following to make this explicit and have a dial between precision and overflow-bug-avoidance:
```
...
uint64_t Slack = 8;   
uint64_t MaxBits = 64 - Slack;   // We leave some "slack" room to avoid accidental overflows
Scaled64 ScalingFactor = Scaled64(1, MaxBits) / Max;
...
```

I'll try how this goes...

https://github.com/llvm/llvm-project/pull/66285


More information about the llvm-commits mailing list