This is an archive of the discontinued LLVM Phabricator instance.

[clang] Do not extend i8 return values to i16 on AVR.
ClosedPublic

Authored by benshi001 on Dec 12 2022, 8:09 PM.

Diff Detail

Event Timeline

benshi001 created this revision.Dec 12 2022, 8:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2022, 8:09 PM
Herald added a subscriber: Jim. · View Herald Transcript
benshi001 requested review of this revision.Dec 12 2022, 8:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2022, 8:09 PM
benshi001 added a comment.EditedDec 20 2022, 2:26 AM

On 32-bit / 64-bit machines, a function returning lower types (via a register) should an explicit sign/zero extension to full fill the register.

But on AVR, a 8-bit register is used to return 8-bit values, so the sign/zero extension is unnecessary, which leads to extra useless assembly.

Miss_Grape accepted this revision.Dec 20 2022, 2:35 AM
This revision is now accepted and ready to land.Dec 20 2022, 2:35 AM
This revision was automatically updated to reflect the committed changes.