Hello all,
I am trying to use BUILT_IN_ATOMIC_..., but it does not quite work. I am
calling them as:
tmp = builtin_decl_explicit (BUILT_IN_ATOMIC_LOAD_4);
tmp = build_call_expr_loc (input_location, tmp, 2, atom.expr, ...
That gives the following dump:
__atomic_store_n (&i, 5, 0);
__atomic_store_n (&i, (integer(kind=4)) *k, 0);
j = (integer(kind=4)) __atomic_load_4 (&i, 0);
__atomic_add_fetch (&i, 5, 0);
The "__atomic_load_4" works, but the "__atomic_store_n" and
"__atomic_add_fetch" lead to link-time errors:
fo4o.f90:(.text+0x44): undefined reference to `__atomic_store_n'
fo4o.f90:(.text+0x73): undefined reference to `__atomic_add_fetch'
The issue with `__atomic_store_n', I can solve by replacing it by, e.g.,
BUILT_IN_ATOMIC_STORE_4. However, how does one properly use
__atomic_add_fetch alias BUILT_IN_ATOMIC_ADD_FETCH_N, given that there
is no _4 version of it?
Additionally, if one wants to fetch the old value (e.g. with
__atomic_add_fetch), how does one properly use the function result? The
problem is that TREE_TYPE() doesn't automatically match the type of the
first argument. Ignoring the type issue in the front end and simply
calling MODIFY_EXPR will lead to a gimplify.c ICE.
Tobias