Closed lrzlin closed 1 year ago
@carenas Thanks for your advice! I have not noticed that the sljit has already introduced SIMD support, in that case I'll add support for LoongArch SX in sljit repo for future changes.
@lrzlin do you have an update on at least adding sljit_has_cpu_feature(SLJIT_HAS_SIMD)
to sljit so it could be used here to avoid unnecessary crashes with old software?
@lrzlin do you have an update on at least adding
sljit_has_cpu_feature(SLJIT_HAS_SIMD)
to sljit so it could be used here to avoid unnecessary crashes with old software?
Added here, however this change will cause the sljit_test in sljit repo failed (because SLJIT_HAS_SIMD implies SIMD support), should I commit this change now or at the time that I have finished all sljit SIMD functions?
however this change will cause the sljit_test in sljit repo failed
usually to avoid those issues, and while the code is still in development, it is just #ifdef out with the test skipping (see test92 for atomics, which are also not yet used by PCRE).
IMHO and since you already have a working "legacy" SIMD implementation it will be better to get this version out first that way.
eitherway, all sljit changes go first to that repository and they are merged back from there.
eitherway, all sljit changes go first to that repository and they are merged back from there.
In that case, I think the best way is putting the LSX detection here, until I have finished all LoongArch sljit SIMD support. Also it would convinent if we need to drop the legacy SIMD support and switch to sljit SIMD implement.
I am ok with this code. I cannot maintain it though. So if no more style issues, I can land it. Moving to sljit simd will take a longer time.
I am ok with this code. I cannot maintain it though. So if no more style issues, I can land it. Moving to sljit simd will take a longer time.
Thanks for that! I think there is no more style issues. Also I'll maintain the LoongArch SIMD code if there are any issues.
It is missing an autoconf/cmake detection for getauxval() and having the code #ifdef around it; presume that the fallback defaulting to 1 would be ok since all internationally available hardware and the latest release of qemu have LSX support.
It is missing an autoconf/cmake detection for getauxval() and having the code #ifdef around it; presume that the fallback defauting to 1 would be ok since all available hardware and the latest release of qemu have LSX support.
@carenas Is the #ifdef __linux__
guard okay? AFAIK, the Linux getauxval
syscall and glibc wrapper are available since day one for LoongArch. Also, some embedded LoongArch SOCs (such as Loongson 2K500) do not support LSX extension, so it would be safer to disable LSX if the detection fails.
Interesting, would require changes later if uclibc (or other libc except musl and bionic) are supported by Linux in LoongArch but should be fine for now.
UPDATE: latest uClibc has also getauxval()
This patch enables SIMD support on LoongArch platform, already tested on real hardware and qemu.