-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
#651, for 64 bit type on x86 __iso_volatile_store64 #694
Conversation
without complier barrier for memory_order_relaxed, with complier barrier for memory_order_release, other orders unchanged.
Here's reduced ICE: DevCom-986061 |
Related: I don't get the use of I mean. if |
Totally possible |
ARM and ARM64 have always had the full complement of |
There is a difference in codegen, __ldrexd produces ldrexd, and __iso_volatile_load64 produces ldrd. This program:
Compiled with VS 2019 Preview:
Produces following asm:
|
Regarding everything except |
We talked about this in our weekly meeting, and we believe that waiting for the ICE to be fixed is preferable over using inline assembly (which has been problematic in the past). I'll mark this PR as blocked. |
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.
This looks good to me.
My suggestions are weak suggestions, not strong ones, feel free to resolve if you don't think it's worth the effort.
stl/inc/atomic
Outdated
|
||
#if defined(_M_ARM) || defined(_M_ARM64) | ||
_Memory_barrier(); | ||
#else // ^^^ ARM32/ARM64 hardware / x86/x64 hardware vvv |
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.
Is the implementation for x86/x64
likely safe on any other hypothetical architecture? Assumptions about architecture is what has gotten us into this mess of mediocre ARM support we're in now.
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.
Good question. It is both unsafe, and possibly inefficient where it is safe.
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.
So I've addressed this place.
But there are some places like here:
Lines 489 to 495 in 4deaf6c
#if defined(_M_ARM) || defined(_M_ARM64) | |
_Memory_barrier(); | |
__iso_volatile_store16(_Mem, _As_bytes); | |
_Memory_barrier(); | |
#else // ^^^ ARM32/ARM64 hardware / x86/x64 hardware vvv | |
(void) _InterlockedExchange16(_Mem, _As_bytes); | |
#endif // hardware |
I think any of the implementations looks working (apart from _Memory_barrier()
undefined on x86/x64, but it can be defined). But it still does not make sense to use the wrong implementation for each platform for performance reasons. Should compilation be broken for unknown platform here as well?
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.
I'm more okay with it in this case. _InterlockedExchange16
will likely be defined on future architectures. Also you're not directly touching this so no reason to hold up the PR on that.
Co-authored-by: Curtis J Bezault <[email protected]>
Co-authored-by: Curtis J Bezault <[email protected]>
…into atomic_x86_store # Conflicts: # stl/inc/atomic
stl/inc/atomic
Outdated
|
||
#if defined(_M_ARM) || defined(_M_ARM64) | ||
_Memory_barrier(); | ||
#else // ^^^ ARM32/ARM64 hardware / x86/x64 hardware vvv |
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.
I'm more okay with it in this case. _InterlockedExchange16
will likely be defined on future architectures. Also you're not directly touching this so no reason to hold up the PR on that.
Co-authored-by: Curtis J Bezault <[email protected]>
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.
(@BillyONeal has offered to commit/test these minor changes to the GitHub and MSVC PRs; thanks Billy!)
@AlexGuteniev Thank you for your contribution! |
This was added by microsoft#694 after microsoft#653.
This reverts commit ad1a26a which was later modified by #694. Fixes #971. Co-authored-by: Stephan T. Lavavej <[email protected]>
#651, for 64 bit type on x86 __iso_volatile_store64
without complier barrier for memory_order_relaxed,
with complier barrier for memory_order_release,
other orders unchanged.