On Wed, 2023-03-29 at 10:05 -0700, Nathan Chancellor wrote: > > GCC has optimizations for division by a constant that clang does not > implement, so this issue is not visible when building with GCC. Huh yeah, we did 32-bit builds with gcc ... > Using div_u64() would resolve this issue, but Arnd points out that this > can be quite expensive and the timestamp is being read at nanosecond > granularity. Doesn't matter though, all the calculations are based on just the command response from the firmware, which (tries to) take it in a synchronised fashion. So taking more time here would be fine, as far as I can tell. > Nick pointed out that the result of this division is being > stored to a 32-bit type anyways, so truncate gp2_10ns first then do the > division, which elides the need for libcalls. That loses ~7 top bits though, no? I'd be more worried about that, than the time div_u64() takes. johannes