This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][builtins] Add AVR __mulsi3
AcceptedPublic

Authored by aykevl on Nov 7 2022, 12:59 PM.

Details

Summary

This is the 32x32=32 multiplication function for AVR. I haven't optimized this function, but it should be portable to almost all AVRs (the exception is avrtiny which has a slightly different calling convention).

In my quick test, it's about 100 bytes smaller than an equivalent C (actually: TinyGo) implementation of this function.

Diff Detail

Event Timeline

aykevl created this revision.Nov 7 2022, 12:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 12:59 PM
Herald added subscribers: Enna1, Jim, dberris. · View Herald Transcript
aykevl requested review of this revision.Nov 7 2022, 12:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 12:59 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
benshi001 added a comment.EditedNov 11 2022, 12:40 AM

Could you please make a contrast test between libgcc's and your implementation, as I did in

https://github.com/benshi001/avr-test

I have done a contrast test between libgcc and compiler-rt for

divmod sint16
divmod uint16
divmod sint8
divmod uint8
mul int16
mul int8

could you please also mention implement https://github.com/llvm/llvm-project/issues/55279 in your commit message ?

aykevl updated this revision to Diff 475765.Nov 16 2022, 4:07 AM
  • update comment a bit (to say that I've tested the C function extensively)
benshi001 accepted this revision.Nov 16 2022, 6:20 AM

LGTM. I have merged your test case PR to my repo.

This revision is now accepted and ready to land.Nov 16 2022, 6:20 AM

@compnerd Any thoughts on this patch ?