[RFC / CFT] PR c++/66192 - Remove TARGET_RELAXED_ORDERING and use load acquires.
Ramana Radhakrishnan
ramana.radhakrishnan@foss.arm.com
Fri May 22 14:28:00 GMT 2015
On 22/05/15 14:40, Jason Merrill wrote:
> On 05/22/2015 07:23 AM, Ramana Radhakrishnan wrote:
>> + /* Load the guard value only through an atomic acquire load. */
>> + guard = build_atomic_load (guard, MEMMODEL_ACQUIRE);
>> +
>> /* Check to see if the GUARD is zero. */
>> guard = get_guard_bits (guard);
>
> I wonder if these calls should be reversed, to express that we're only
> trying to atomically load a byte (on non-ARM targets)?
>
I'm not sure about the impact on other non-ARM targets without some more
investigation.
>> + tree orig_src = src;
>> + tree t, addr, val;
>> + unsigned int size;
>> + int fncode;
>> +
>> + size = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (src)));
>> +
>> + fncode = BUILT_IN_ATOMIC_LOAD_N + exact_log2 (size) + 1;
>> + t = builtin_decl_implicit ((enum built_in_function) fncode);
>> +
>> + addr = build1 (ADDR_EXPR, ptr_type, src);
>> + val = build_call_expr (t, 2, addr, mem_model);
>> +
>> + /* First reinterpret the loaded bits in the original type of the load,
>> + then convert to the expected result type. */
>> + t = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (src), val);
>> + return convert (TREE_TYPE (orig_src), t);
>
> I don't see anything that changes src here.
Sorry 'bout that. Will fix in the next spin depending on comments from
others.
I take it that you are happy with the patch otherwise ...
regards
Ramana
>
> Jason
>
More information about the Gcc-patches
mailing list