As per #64354 (comment)
For cases when we need to access a field using Store-Release semantic with an offset we can do that in a single instruction stlur/ldur.
Thanks to @neon-sunset for checking it on Apple M1 (arm64 v8.5), e.g.:
class MyClass
{
public:
std::atomic<int> x;
std::atomic<int> y;
};
void Foo(MyClass* cls)
{
cls->x = 42;
cls->y = 42;
}
compiles down to:
Foo(MyClass*):
mov w1, 42
stlr w1, [x0]
stlur w1, [x0, 4]
ret
while we currently emit something like:
mov w1, 42
stlr w1, [x0]
add x0, x0, #4
stlr w1, [x0]
ret
category:cq
theme:basic-cq
skill-level:beginner
cost:small
impact:small
As per #64354 (comment)
For cases when we need to access a field using Store-Release semantic with an offset we can do that in a single instruction stlur/ldur.
Thanks to @neon-sunset for checking it on Apple M1 (arm64 v8.5), e.g.:
compiles down to:
while we currently emit something like:
category:cq
theme:basic-cq
skill-level:beginner
cost:small
impact:small