This is an archive of the discontinued LLVM Phabricator instance.

[AVR] Do not use divmod calls for bigger integers
ClosedPublic

Authored by aykevl on Apr 18 2020, 2:57 PM.

Details

Summary

The avr-libc provides *divmodqi4, *divmodhi4, and *divmodsi4 functions, but does not provide a *divmoddi4. Instead it provides regular *divdi3 and *moddi3 functions.

Note that avr-libc doesn't support *divti3 or *modti3 for 128-bit integer manipulation, but because we have to do something with it it seemed most sensible to me to lower these as *divt3/*modt3 too.

Source: https://github.com/gcc-mirror/gcc/blob/releases/gcc-5.4.0/libgcc/config/avr/lib1funcs.S

I suspect that avr-libc uses separate division and modulo functions for 64-bit integers because otherwise the return value would become really big (16 bytes) and would have to be passed on the stack.

Diff Detail

Event Timeline

aykevl created this revision.Apr 18 2020, 2:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2020, 2:57 PM
Herald added subscribers: Jim, hiraditya. · View Herald Transcript
aykevl edited the summary of this revision. (Show Details)Apr 18 2020, 3:00 PM
dylanmckay accepted this revision.Apr 18 2020, 7:58 PM
This revision is now accepted and ready to land.Apr 18 2020, 7:58 PM
This revision was automatically updated to reflect the committed changes.