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

WIP: Support C11 atomics required by dav1d #814

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

thedataking
Copy link
Contributor

No description provided.

@thedataking thedataking marked this pull request as draft February 6, 2023 06:31
As atomics are being implemented, these warnings are becoming wrong.
Any operations on atomics that stay unimplmented will be caught more
precisely at later translation stages.
@thedataking thedataking requested a review from rinon March 6, 2023 22:30
@@ -363,7 +365,7 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> {
}
}();
// All the SVE types present in Clang 10 are 128-bit vectors
// (see `AArch64SVEACLETypes.def`), so we can divide 128
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated formatting change

@@ -403,7 +405,7 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> {
// Constructed as a consequence of the conversion of
// built-in to normal vector types.
case BuiltinType::Float16: return TagHalf;
case BuiltinType::Half: return TagHalf;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated formatting change.

@@ -1756,6 +1766,11 @@ impl ConversionContext {
let typ = node.type_id.expect("Expected expression to have type");
let typ = self.visit_qualified_type(typ);

// Perhaps as an optimization since atomic_init has no order,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should really define a fixed operand ordering here in our interchange format, but this technically works.

"__atomic_compare_exchange" | "__atomic_compare_exchange_n" => {
"__atomic_compare_exchange"
| "__atomic_compare_exchange_n"
| "__c11_atomic_compare_exchange_strong" => {
Copy link
Contributor

Choose a reason for hiding this comment

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

weak?

Comment on lines +213 to +215
// TODO(perl): __c11_atomic_compare_exchange_strong does not
// seem to produce correct code. It produces a deref operation
// on the `src` argument to atomic_cxchg_seqcst_seqcst.
Copy link
Contributor

Choose a reason for hiding this comment

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

If it doesn't produce correct code then why are we handling it at all?

Nugine added a commit to Nugine/c2rust that referenced this pull request Dec 8, 2024
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