Changeset c64e979 for tests/builtins


Ignore:
Timestamp:
Apr 30, 2019, 2:51:11 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
98d4df9
Parents:
986e260
Message:

Added atomic operations on pointers and fixed some mistakes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/builtins/sync.cfa

    r986e260 rc64e979  
    1111        volatile __int128 * vp16 = 0; __int128 * rp16 = 0; __int128 v16 = 0;
    1212        #endif
     13        struct type * volatile * vpp = 0; struct type ** rpp = 0; struct type * vp = 0;
    1314
    1415        { char ret; ret = __sync_fetch_and_add(vp1, v1); }
     
    180181        { _Bool ret; ret = __sync_bool_compare_and_swap_16(vp16, v16,v16); }
    181182        #endif
     183        { _Bool ret; ret = __sync_bool_compare_and_swap(vpp, vp, vp); }
    182184
    183185        { char ret; ret = __sync_val_compare_and_swap(vp1, v1, v1); }
     
    193195        { __int128 ret; ret = __sync_val_compare_and_swap_16(vp16, v16,v16); }
    194196        #endif
     197        { struct type * ret; ret = __sync_val_compare_and_swap(vpp, vp, vp); }
     198
    195199
    196200        { char ret; ret = __sync_lock_test_and_set(vp1, v1); }
     
    230234        { __atomic_clear(vp1, v1); }
    231235
    232         { char ret; ret = __atomic_exchange_n(vp1, &v1, __ATOMIC_SEQ_CST); }
     236        { char ret; ret = __atomic_exchange_n(vp1, v1, __ATOMIC_SEQ_CST); }
    233237        { char ret; ret = __atomic_exchange_1(vp1, v1, __ATOMIC_SEQ_CST); }
    234238        { char ret; __atomic_exchange(vp1, &v1, &ret, __ATOMIC_SEQ_CST); }
    235         { short ret; ret = __atomic_exchange_n(vp2, &v2, __ATOMIC_SEQ_CST); }
     239        { short ret; ret = __atomic_exchange_n(vp2, v2, __ATOMIC_SEQ_CST); }
    236240        { short ret; ret = __atomic_exchange_2(vp2, v2, __ATOMIC_SEQ_CST); }
    237241        { short ret; __atomic_exchange(vp2, &v2, &ret, __ATOMIC_SEQ_CST); }
    238         { int ret; ret = __atomic_exchange_n(vp4, &v4, __ATOMIC_SEQ_CST); }
     242        { int ret; ret = __atomic_exchange_n(vp4, v4, __ATOMIC_SEQ_CST); }
    239243        { int ret; ret = __atomic_exchange_4(vp4, v4, __ATOMIC_SEQ_CST); }
    240244        { int ret; __atomic_exchange(vp4, &v4, &ret, __ATOMIC_SEQ_CST); }
    241         { long long int ret; ret = __atomic_exchange_n(vp8, &v8, __ATOMIC_SEQ_CST); }
     245        { long long int ret; ret = __atomic_exchange_n(vp8, v8, __ATOMIC_SEQ_CST); }
    242246        { long long int ret; ret = __atomic_exchange_8(vp8, v8, __ATOMIC_SEQ_CST); }
    243247        { long long int ret; __atomic_exchange(vp8, &v8, &ret, __ATOMIC_SEQ_CST); }
    244248        #if defined(__SIZEOF_INT128__)
    245         { __int128 ret; ret = __atomic_exchange_n(vp16, &v16, __ATOMIC_SEQ_CST); }
     249        { __int128 ret; ret = __atomic_exchange_n(vp16, v16, __ATOMIC_SEQ_CST); }
    246250        { __int128 ret; ret = __atomic_exchange_16(vp16, v16, __ATOMIC_SEQ_CST); }
    247251        { __int128 ret; __atomic_exchange(vp16, &v16, &ret, __ATOMIC_SEQ_CST); }
    248252        #endif
     253        { struct type * ret; ret = __atomic_exchange_n(vpp, vp, __ATOMIC_SEQ_CST); }
     254        { struct type * ret; __atomic_exchange(vpp, &vp, &ret, __ATOMIC_SEQ_CST); }
    249255
    250256        { char ret; ret = __atomic_load_n(vp1, __ATOMIC_SEQ_CST); }
     
    265271        { __int128 ret; __atomic_load(vp16, &ret, __ATOMIC_SEQ_CST); }
    266272        #endif
     273        { struct type * ret; ret = __atomic_load_n(vpp, __ATOMIC_SEQ_CST); }
     274        { struct type * ret; __atomic_load(vpp, &ret, __ATOMIC_SEQ_CST); }
    267275
    268276        { _Bool ret; ret = __atomic_compare_exchange_n(vp1, rp1, v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     
    283291        { _Bool ret; ret = __atomic_compare_exchange(vp16, rp16, &v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    284292        #endif
     293        { _Bool ret; ret = __atomic_compare_exchange_n(vpp, rpp, vp, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     294        { _Bool ret; ret = __atomic_compare_exchange(vpp, rpp, &vp, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    285295
    286296        { __atomic_store_n(vp1, v1, __ATOMIC_SEQ_CST); }
     
    301311        { __atomic_store(vp16, &v16, __ATOMIC_SEQ_CST); }
    302312        #endif
     313        { __atomic_store_n(vpp, vp, __ATOMIC_SEQ_CST); }
     314        { __atomic_store(vpp, &vp, __ATOMIC_SEQ_CST); }
    303315
    304316        { char ret; ret = __atomic_add_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
Note: See TracChangeset for help on using the changeset viewer.