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

第十四题 使用 asm 指定符号名 #331

Merged
merged 2 commits into from
Oct 22, 2024
Merged

Conversation

Matrix-A
Copy link
Contributor

@Matrix-A Matrix-A commented Oct 22, 2024

解释 asm("..")可以手动指定符号名。
使用std::atomic_thread_fence(std::memory_order_acq_rel);是为了禁止将读取ss::a优化到写入 b 之前

不支持msvc,因为msvc x64 不支持 asm 功能

https://gcc.godbolt.org/z/WYqcc56r7

解释 asm("..")可以手动指定符号名。
使用```std::atomic_thread_fence(std::memory_order_acq_rel);```是为了禁止将读取```ss::a```优化到写入 b 之前

https://gcc.godbolt.org/z/WYqcc56r7
@Mq-b Mq-b self-assigned this Oct 22, 2024
@Mq-b Mq-b added the category: homework 卢瑟作业 label Oct 22, 2024
Copy link
Owner

@Mq-b Mq-b left a comment

Choose a reason for hiding this comment

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

这个非常好。

@Mq-b Mq-b merged commit 572337c into Mq-b:main Oct 22, 2024
6 checks passed
@Mq-b
Copy link
Owner

Mq-b commented Oct 22, 2024

@Matrix-A 你把你这个添加到 README 的标准答案和群友提交这两类中吧。记得稍微加结束,介绍 asm,给文档的链接,留 godbolt 。

@Matrix-A
Copy link
Contributor Author

Matrix-A commented Oct 22, 2024

@Matrix-A 你把你这个添加到 README 的标准答案和群友提交这两类中吧。记得稍微加结束,介绍 asm,给文档的链接,留 godbolt 。

嘻嘻,不要

因为我是一知半解

@Mq-b
Copy link
Owner

Mq-b commented Oct 22, 2024

大胆

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

Successfully merging this pull request may close these issues.

2 participants