-
Notifications
You must be signed in to change notification settings - Fork 109
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
test_stack fail on E2K in 64-bit mode #59
Comments
На v4 нет 128-bit атомарных операций, для v5 и далее - есть, так в МЦСТ ответили и баг закрыли. Версию архитектуры можно узнать на этапе компиляции по значению макроса |
Tip for me: code of libatomic - https://github.com/OpenE2K/gcc/tree/gcc-runtime-mcst/libatomic |
Got it. Thank you! I will do a compile-time check based on the macro. |
Note: there was also a suggestion to use a runtime check (`__builtin_cpu_arch()') but according to the design of libatomic_ops availability of a particular atomic operation should be detectable thru a macro. |
И еще добавили, что в v4 есть атомарные 128-бит запись/чтение, это для указателей 128-бит режима. Но нет эквивалента exchange/compare_exchange на 128 бит. |
О, спасибо, это понадобится когда буду добавлять поддержку ЗР в libgc. |
Предлагают вместо |
I agree that about gcc your suggestion is good, but not for clang: |
Для Clang-9 на x86_64 это работает (https://godbolt.org/z/P7Gqoa3qM): #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
#error
#endif На 16 байт у x86_64 нет. В Clang от МЦСТ интринсики вроде есть, а макроса нет. На это баг уже завели. Но это был совет от МЦСТ с этим макросом, я бы предпочёл использовать |
Да, интринсик есть для 16 байт а макроса нет. У Clang. |
There 2 extra issues with clang 16-byte compare and exchange (I mean difference from gcc) besides absence of the feature macro:
As a workaround this could be used by client: CFLAGS=-Wno-atomic-alignment LDFLAGS=-latomic |
(supersede commits ca5d76e, e744433) Issue #59 (libatomic_ops) This requires CPU elbrus-v5 or later. * src/atomic_ops/sysdeps/gcc/e2k.h: Replace defined(__ptr32__) to __SIZEOF_SIZE_T__==4. * src/atomic_ops/sysdeps/gcc/e2k.h [__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 && !__clang__]: Define AO_GCC_HAVE_double_SYNC_CAS and include standard_ao_double_t.h. * src/atomic_ops/sysdeps/gcc/e2k.h [!__ptr32__ && AO_PREFER_BUILTIN_ATOMICS]: Define AO_GCC_HAVE_double_SYNC_CAS and include standard_ao_double_t.h only if __clang__ and __iset__>=5; add comment; remove TODO item.
Source: master (30db756)
Host: Linux ... 5.4.0-6.9-e8c #1 SMP ... e2k E8C E8C-SWTX GNU/Linux
Compiler: lcc:1.26.20:Jun--6-2023:e2k-v4-linux (gcc (GCC) 9.3.0 compatible)
How to reproduce: ./autogen.sh && ./configure && make check CFLAGS_EXTRA="-m64 -D AO_PREFER_BUILTIN_ATOMICS" LDFLAGS="-latomic"
Output (tests/test_stack.log):
Failed - nothing to pop
The text was updated successfully, but these errors were encountered: