-
Notifications
You must be signed in to change notification settings - Fork 259
Implement __sync builtins for thumbv6-none-eabi #1050
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
Open
taiki-e
wants to merge
3
commits into
rust-lang:main
Choose a base branch
from
taiki-e:thumbv6k
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| // Used by both arm_linux.rs and thumbv6k.rs. | ||
|
|
||
| atomic_rmw!(@old __sync_fetch_and_add_1, u8, |a: u8, b: u8| a.wrapping_add(b)); | ||
| atomic_rmw!(@old __sync_fetch_and_add_2, u16, |a: u16, b: u16| a | ||
| .wrapping_add(b)); | ||
| atomic_rmw!(@old __sync_fetch_and_add_4, u32, |a: u32, b: u32| a | ||
| .wrapping_add(b)); | ||
|
|
||
| atomic_rmw!(@new __sync_add_and_fetch_1, u8, |a: u8, b: u8| a.wrapping_add(b)); | ||
| atomic_rmw!(@new __sync_add_and_fetch_2, u16, |a: u16, b: u16| a | ||
| .wrapping_add(b)); | ||
| atomic_rmw!(@new __sync_add_and_fetch_4, u32, |a: u32, b: u32| a | ||
| .wrapping_add(b)); | ||
|
|
||
| atomic_rmw!(@old __sync_fetch_and_sub_1, u8, |a: u8, b: u8| a.wrapping_sub(b)); | ||
| atomic_rmw!(@old __sync_fetch_and_sub_2, u16, |a: u16, b: u16| a | ||
| .wrapping_sub(b)); | ||
| atomic_rmw!(@old __sync_fetch_and_sub_4, u32, |a: u32, b: u32| a | ||
| .wrapping_sub(b)); | ||
|
|
||
| atomic_rmw!(@new __sync_sub_and_fetch_1, u8, |a: u8, b: u8| a.wrapping_sub(b)); | ||
| atomic_rmw!(@new __sync_sub_and_fetch_2, u16, |a: u16, b: u16| a | ||
| .wrapping_sub(b)); | ||
| atomic_rmw!(@new __sync_sub_and_fetch_4, u32, |a: u32, b: u32| a | ||
| .wrapping_sub(b)); | ||
|
|
||
| atomic_rmw!(@old __sync_fetch_and_and_1, u8, |a: u8, b: u8| a & b); | ||
| atomic_rmw!(@old __sync_fetch_and_and_2, u16, |a: u16, b: u16| a & b); | ||
| atomic_rmw!(@old __sync_fetch_and_and_4, u32, |a: u32, b: u32| a & b); | ||
|
|
||
| atomic_rmw!(@new __sync_and_and_fetch_1, u8, |a: u8, b: u8| a & b); | ||
| atomic_rmw!(@new __sync_and_and_fetch_2, u16, |a: u16, b: u16| a & b); | ||
| atomic_rmw!(@new __sync_and_and_fetch_4, u32, |a: u32, b: u32| a & b); | ||
|
|
||
| atomic_rmw!(@old __sync_fetch_and_or_1, u8, |a: u8, b: u8| a | b); | ||
| atomic_rmw!(@old __sync_fetch_and_or_2, u16, |a: u16, b: u16| a | b); | ||
| atomic_rmw!(@old __sync_fetch_and_or_4, u32, |a: u32, b: u32| a | b); | ||
|
|
||
| atomic_rmw!(@new __sync_or_and_fetch_1, u8, |a: u8, b: u8| a | b); | ||
| atomic_rmw!(@new __sync_or_and_fetch_2, u16, |a: u16, b: u16| a | b); | ||
| atomic_rmw!(@new __sync_or_and_fetch_4, u32, |a: u32, b: u32| a | b); | ||
|
|
||
| atomic_rmw!(@old __sync_fetch_and_xor_1, u8, |a: u8, b: u8| a ^ b); | ||
| atomic_rmw!(@old __sync_fetch_and_xor_2, u16, |a: u16, b: u16| a ^ b); | ||
| atomic_rmw!(@old __sync_fetch_and_xor_4, u32, |a: u32, b: u32| a ^ b); | ||
|
|
||
| atomic_rmw!(@new __sync_xor_and_fetch_1, u8, |a: u8, b: u8| a ^ b); | ||
| atomic_rmw!(@new __sync_xor_and_fetch_2, u16, |a: u16, b: u16| a ^ b); | ||
| atomic_rmw!(@new __sync_xor_and_fetch_4, u32, |a: u32, b: u32| a ^ b); | ||
|
|
||
| atomic_rmw!(@old __sync_fetch_and_nand_1, u8, |a: u8, b: u8| !(a & b)); | ||
| atomic_rmw!(@old __sync_fetch_and_nand_2, u16, |a: u16, b: u16| !(a & b)); | ||
| atomic_rmw!(@old __sync_fetch_and_nand_4, u32, |a: u32, b: u32| !(a & b)); | ||
|
|
||
| atomic_rmw!(@new __sync_nand_and_fetch_1, u8, |a: u8, b: u8| !(a & b)); | ||
| atomic_rmw!(@new __sync_nand_and_fetch_2, u16, |a: u16, b: u16| !(a & b)); | ||
| atomic_rmw!(@new __sync_nand_and_fetch_4, u32, |a: u32, b: u32| !(a & b)); | ||
|
|
||
| atomic_rmw!(@old __sync_fetch_and_max_1, i8, |a: i8, b: i8| if a > b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
| atomic_rmw!(@old __sync_fetch_and_max_2, i16, |a: i16, b: i16| if a > b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
| atomic_rmw!(@old __sync_fetch_and_max_4, i32, |a: i32, b: i32| if a > b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
|
|
||
| atomic_rmw!(@old __sync_fetch_and_umax_1, u8, |a: u8, b: u8| if a > b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
| atomic_rmw!(@old __sync_fetch_and_umax_2, u16, |a: u16, b: u16| if a > b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
| atomic_rmw!(@old __sync_fetch_and_umax_4, u32, |a: u32, b: u32| if a > b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
|
|
||
| atomic_rmw!(@old __sync_fetch_and_min_1, i8, |a: i8, b: i8| if a < b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
| atomic_rmw!(@old __sync_fetch_and_min_2, i16, |a: i16, b: i16| if a < b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
| atomic_rmw!(@old __sync_fetch_and_min_4, i32, |a: i32, b: i32| if a < b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
|
|
||
| atomic_rmw!(@old __sync_fetch_and_umin_1, u8, |a: u8, b: u8| if a < b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
| atomic_rmw!(@old __sync_fetch_and_umin_2, u16, |a: u16, b: u16| if a < b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
| atomic_rmw!(@old __sync_fetch_and_umin_4, u32, |a: u32, b: u32| if a < b { | ||
| a | ||
| } else { | ||
| b | ||
| }); | ||
|
|
||
| atomic_rmw!(@old __sync_lock_test_and_set_1, u8, |_: u8, b: u8| b); | ||
| atomic_rmw!(@old __sync_lock_test_and_set_2, u16, |_: u16, b: u16| b); | ||
| atomic_rmw!(@old __sync_lock_test_and_set_4, u32, |_: u32, b: u32| b); | ||
|
|
||
| atomic_cmpxchg!(__sync_val_compare_and_swap_1, u8); | ||
| atomic_cmpxchg!(__sync_val_compare_and_swap_2, u16); | ||
| atomic_cmpxchg!(__sync_val_compare_and_swap_4, u32); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could you name this
arm_thumb_sync_builtinsor similar?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think we may as well group this by functionality like we have for other areas, something like:
I'll move the aarch64 builtins there too.