Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCCs atomic builtins - Which processors are supported

Tags:

c++

gcc

atomic

This document says:

Not all operations are supported by all target processors.

Does anybody know, for which processor which operation is supported?

like image 336
Karl von Moor Avatar asked May 31 '10 17:05

Karl von Moor


1 Answers

Not a direct answer, but the following snippet from the linked page gives a clue (emphasis is mine):

Not all operations are supported by all target processors. If a particular operation cannot be implemented on the target processor, a warning will be generated and a call an external function will be generated. The external function will carry the same name as the builtin, with an additional suffix `_n' where n is the size of the data type.

Basically this says that it's safe to use these builtins. They will generate either direct instruction sequence if supported, or a call to an emulation function by the given name.

The compiler will warn you if particular builtin is not supported, so it's easy to experiment.

And since these originally come from Intel specs, it's safe to assume they are there on x86 and x86_64.

like image 178
Nikolai Fetissov Avatar answered Nov 04 '22 11:11

Nikolai Fetissov