[llvm] [APInt] Restore multiplicativeInverse with explicit modulus and better testing (PR #87812)
Jeremy Kun via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 7 16:19:25 PDT 2024
================
@@ -3258,6 +3258,54 @@ TEST(APIntTest, MultiplicativeInverseExaustive) {
}
}
+TEST(APIntTest, ModularMultiplicativeInverseSpecific) {
+ // Test a single modulus for all known inverses and non-inverses.
+ int BitWidth = 8;
+ APInt Modulus(BitWidth, 26);
+ int Values[12] = {1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25};
+ int Inverses[12] = {1, 9, 21, 15, 3, 19, 7, 23, 11, 5, 17, 25};
+ int NonInvertibleElements[14] = {0, 2, 4, 6, 8, 10, 12,
+ 13, 14, 16, 18, 20, 22, 24};
+
+ for (size_t i = 0; i < 12; ++i) {
----------------
j2kun wrote:
Done
https://github.com/llvm/llvm-project/pull/87812
More information about the llvm-commits
mailing list