[llvm] [llvm] Add KnownBits implementations for avgFloor and avgCeil (PR #86445)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 1 09:23:25 PDT 2024
goldsteinn wrote:
> @RKSimon RkSim What type of test should I add, should it be similar to this test ?
>
> https://github.com/llvm/llvm-project/blob/ffe41819e58365dfbe85a22556c0d9d284e746b9/llvm/unittests/Support/KnownBitsTest.cpp#L834-L848
Your unit tests should look something like:
```
testBinaryOpExhaustive(KnownBits::abds, APIntOps::abds,
checkCorrectnessOnlyBinary);
```
The first argument is a function pointer to the knownbits function we are testing.
The second argument is a function pointer to the reference implementation on an `APInt`.
The third is optional. If your implementation is complete (i.e proves all knowable bits) you can
drop it, otherwise just use what you see above. We like to strive for exhaustive, so if yours is not,
can you provide a few values that is fails for and explain a bit why its not really feasible?
https://github.com/llvm/llvm-project/pull/86445
More information about the llvm-commits
mailing list