iarith_divrem_u.c (433B)
1 /* iarith: 32-bit UNSIGNED divide and remainder. 2 * 3 * Unsigned operands select `udiv w` (vs the signed `sdiv w`) plus the 4 * `msub w` for the remainder. volatile defeats folding. 5 * 6 * 4000000000u / 100000000u = 40 7 * 4000000000u % 100000000u = 0 8 * 40 + 2 = 42. */ 9 int test_main(void) { 10 volatile unsigned int a = 4000000000u, b = 100000000u; 11 unsigned int q = a / b; 12 unsigned int r = a % b; 13 return (int)(q + r + 2); 14 }