Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong inline assembly code in nop_putc. #419

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zakk0610
Copy link

We need to add a0 into clobber list.

In clang, the result is incorrect.

c.mv         a1, a0
c.li         a0, -1
c.mv         a0, a1
slli         zero, a0, 0x11
c.jr         ra

we could rewrite it and avoid additional mv instruction.

in clang, the result is
c.mv         a1, a0
c.li         a0, -1
c.mv         a0, a1
slli         zero, a0, 0x11
c.jr         ra

result is incorrect, we need to add a0 into clobber list.
Copy link
Member

@kito-cheng kito-cheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's better and correct way to make sure the value is hold in a0.

Copy link
Contributor

@nick-knight nick-knight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

FWIW, this is how @ericlove implemented this hack more than 15 months ago: 30fd755#diff-bc73b80291779f6c896ddcb3e37b2ed8567475c138048c14f5318e9771340fa3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants