>
> I've posted already a WIP version of atomics-as-support library for amd64.
> Attached it again.
>
This can be implemented for all architectures without writing assembly by
hand for each platform. I actually had such script by the time I started
implementing std atomics; this is basically bunch on Python statements
which generate C wrappers for each function and for each size (8, 16, 32,
64). Then, these wrappers can be converted into assembly with the help of
some compiler which already supports atomics. I can try to find the script,
or re-implement it from scratch. But I still think per-platform code
generation is a better option.

Implementing them as functions does harm performance, but maybe that's not
> a very big problem since the atomic itself incurs a decent performance
> hit?

I'm not sure of which performance hit do you speak; lock impose some
performance degradation, but not all instructions require this (load/store
don't, xchng is locked by design; other architectures do it differently).
Calling a function from another TU involves more overhead, at least for the
first-time call.
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to