Skip to content
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

Implement built-in functions for atomic memory access #19

Closed
dmik opened this issue Dec 10, 2015 · 6 comments
Closed

Implement built-in functions for atomic memory access #19

dmik opened this issue Dec 10, 2015 · 6 comments

Comments

@dmik
Copy link
Collaborator

dmik commented Dec 10, 2015

Somehow our GCC builds lack the built-in __sync functions described there: https://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/Atomic-Builtins.html. We need to implement them as this will save us from doing that again and again in applications.

@dmik
Copy link
Collaborator Author

dmik commented Dec 10, 2015

One of the programs that needs this is fontconfig: http://trac.netlabs.org/ports/ticket/82.

@komh
Copy link
Collaborator

komh commented Dec 13, 2015

You should use '-march=i486' or later. Atomic builtins are not enabled on i386 which is default.

@dmik
Copy link
Collaborator Author

dmik commented Dec 13, 2015

Great! I confirm that it works. I really wonder though why this isn't mentioned in the GCC docs (e.g. the link above). Closing. Thanks @komh.

@dmik dmik closed this as completed Dec 13, 2015
@dmik
Copy link
Collaborator Author

dmik commented Dec 13, 2015

Well, I just found that I already used this switch (-march=i486) in mozilla for exactly the same reason. Fun. Perhaps, we should make our GCC generate i686 code by default.

@dryeo
Copy link

dryeo commented Dec 13, 2015

On 12/13/15 01:09 PM, Dmitriy Kuminov wrote:

Well, I just found that I already used this switch (|-march=i486|) in
mozilla for exactly the same reason. Fun. Perhaps, we should make our
GCC generate i686 code by default.

Possibly just by updating uname, which on mingw and I believe many Linux
dists reports i686 rather then i386.
I also understand that i686 is superiour as some i486s have a broken
CMPXCHG instruction and GCC works around this as well as i686 doing
better alignment (4 byte) and adding more instructions such as cmov
though some processors (P4?) have a crappy slow cmov.

@dmik
Copy link
Collaborator Author

dmik commented Dec 13, 2015

@dryeo These are good points, I created #20 for this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants