Skip to content

Fix wrong inline assembly code in nop_putc.#419

Open
zakk0610 wants to merge 1 commit intomasterfrom
dev/zakkc/tune-performance
Open

Fix wrong inline assembly code in nop_putc.#419
zakk0610 wants to merge 1 commit intomasterfrom
dev/zakkc/tune-performance

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

@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.

3 participants