Page MenuHomePhabricator

[AVR] Do not clear r0 at interrupt entry
ClosedPublic

Authored by aykevl on Jan 6 2022, 9:29 AM.

Details

Summary

There is no reason to do this: it's a scratch register and can therefore
hold any arbitrary value. And because it is in an interrupt, this code
is performance critical so it should be as short as possible.

I believe r0 was cleared because of the following:

  1. There used to be a bug that the cleared register was r0, not r1 as it should have been.
  2. This was fixed in https://reviews.llvm.org/D99467, but left the code to clear r0.

This patch completes D99467 by removing the clr r0 instruction.

Diff Detail

Event Timeline

aykevl created this revision.Jan 6 2022, 9:29 AM
aykevl requested review of this revision.Jan 6 2022, 9:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2022, 9:29 AM
benshi001 accepted this revision.Jan 6 2022, 3:48 PM
This revision is now accepted and ready to land.Jan 6 2022, 3:48 PM

avr-gcc also does not save/restore R0/__tmp_reg__ in interrupt/signal service function.

This revision was landed with ongoing or failed builds.Jan 19 2022, 5:23 AM
This revision was automatically updated to reflect the committed changes.