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

Add cfg to use __atomic_* builtins #30

Closed
wants to merge 1 commit into from
Closed

Add cfg to use __atomic_* builtins #30

wants to merge 1 commit into from

Conversation

taiki-e
Copy link
Owner

@taiki-e taiki-e commented Aug 10, 2022

  • --cfg portable_atomic_unsafe_atomic_builtins

    Use __atomic_* builtins.

    Combine this with custom atomic logic and you can support CAS on multi-core systems where atomic CAS is not available in the standard library.

    Note: This cfg is unsafe.

    This cfg enables pointer-width and smaller atomic types.

    To enable atomic types grater than pointer-width, you need to enable --cfg portable_atomic_unsafe_atomic_builtins_N cfgs.

  • --cfg portable_atomic_unsafe_atomic_builtins_N

    Similar to --cfg portable_atomic_unsafe_atomic_builtins, but also enables the specified size and smaller atomic types if the pointer width is smaller than the specified size.

    For example, when --cfg portable_atomic_unsafe_atomic_builtins_4 is enabled:

    • On 64-bit platform, Atomic{I,U}{64,32,16,8} will be enabled.
    • On 32-bit and 16-bit platform, Atomic{I,U}{32,16,8} will be enabled.

    N is in bytes and must be 4, 8, or 16. In other words, there are three valid patterns:

    --cfg portable_atomic_unsafe_atomic_builtins_4
    --cfg portable_atomic_unsafe_atomic_builtins_8
    --cfg portable_atomic_unsafe_atomic_builtins_16
    

cc #26, #33

@taiki-e
Copy link
Owner Author

taiki-e commented Jan 5, 2023

Closing in favor of #51 for now.

@taiki-e taiki-e closed this Jan 5, 2023
@taiki-e taiki-e deleted the libcall branch January 5, 2023 16:46
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.

1 participant