[PATCH] D78437: [AVR] Do not use divmod calls for bigger integers

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 15:05:41 PDT 2020


aykevl created this revision.
aykevl added a reviewer: dylanmckay.
Herald added subscribers: Jim, hiraditya.
Herald added a project: LLVM.
aykevl edited the summary of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78437

Files:
  llvm/lib/Target/AVR/AVRISelLowering.cpp
  llvm/test/CodeGen/AVR/div.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78437.258561.patch
Type: text/x-patch
Size: 4762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200418/9325bbcc/attachment.bin>


More information about the llvm-commits mailing list