Skip to content

[avr] Return values are promoted to (unsigned) int for no reason. #58877

Closed
@sprintersb

Description

Compile with --target=avr -mmcu=atmega8 -Os -save-temps the following code:

char func (char c)
{
    return c;
}

The generated assembly reads:

func:
	mov	r25, r24
	lsl	r25
	sbc	r25, r25
	ret

which just wastes 3 cycles and 6 bytes for integer promotion that's not required.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions