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

sw: Fix invalid inline assembly in snrt_dma_wait_channel #180

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

zero9178
Copy link
Contributor

The inline assembly uses t1 both as input operand (via the cfg variable) and within the clobber list. This is illegal but due to a bug in clang 12 that has been fixed in clang 14 has gone unnoticed. Quoting from the GCC documentation (https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Clobbers-and-Scratch-Registers-1):

Clobber descriptions may not in any way overlap with an input or output operand. For example, you may not have an operand describing a register class with one member when listing that register in the clobber list. Variables declared to live in specific registers (see Variables in Specified Registers) and used as asm input or output operands must have no part mentioned in the clobber description.

This correctly emits an error if using Clang 14 or any version of GCC: https://godbolt.org/z/17zrdK18e

The fix is to simply remove the clobber of t1 which is safe to do as it is only used as input.

The inline assembly uses `t1` both as input operand (via the `cfg` variable) and within the clobber list. This is illegal but due to a bug in clang 12 that has been fixed in clang 14 has gone unnoticed.
Quoting from the GCC documentation (https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Clobbers-and-Scratch-Registers-1):

> Clobber descriptions may not in any way overlap with an input or output operand. For example, you may not have an operand describing a register class with one member when listing that register in the clobber list. Variables declared to live in specific registers (see Variables in Specified Registers) and used as asm input or output operands must have no part mentioned in the clobber description.

This correctly emits an error if using Clang 14 or any version of GCC: https://godbolt.org/z/17zrdK18e

The fix is to simply remove the clobber of `t1` which is safe to do as it is only used as input.
Copy link
Contributor

@fischeti fischeti left a comment

Choose a reason for hiding this comment

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

Thanks! That went unnoticed since we are still using a very old Clang version😉

Copy link
Collaborator

@colluca colluca left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @zero9178 :)

@colluca colluca merged commit b9f8903 into pulp-platform:main Aug 21, 2024
13 checks passed
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