[PATCH] D120327: compiler-rt: Add udivmodei5 to builtins and add bitint library

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 8 12:51:45 PDT 2022


MaskRay added inline comments.


================
Comment at: compiler-rt/lib/builtins/int_lib.h:129
+COMPILER_RT_ABI void __udivmodei5(su_int *quo, su_int *rem, su_int *a,
+                                  su_int *b, unsigned int n);
+
----------------
`unsigned int` => `unsigned`. Some older files use `unsigned int` but the new interface doesn't need to follow them.


================
Comment at: compiler-rt/test/builtins/Unit/divmodei5_test.c:93
+    // 'a' needs to have an extra word, see documentation of __udivmodei5.
+    unsigned int *a_scratch = malloc((nwords + 1) * sizeof(su_int));
+    unsigned int *b_scratch = malloc(nwords * sizeof(su_int));
----------------
These variables are not freed, causing memory leaks.

`unsigned int` => unsigned.

If you intend to use su_int, the type should be `su_int *`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120327/new/

https://reviews.llvm.org/D120327



More information about the llvm-commits mailing list