[Openmp-commits] [PATCH] D137827: [openmp] Use z_Linux_asm.S to provide __kmp_invoke_microtask on mingw aarch64
Martin Storsjö via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Fri Nov 11 04:09:48 PST 2022
mstorsjo created this revision.
mstorsjo added reviewers: AndreyChurbanov, JonChesterfield, natgla, pulidocr, jdoerfert.
Herald added subscribers: guansong, kristof.beyls, yaxunl.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: OpenMP.
When building for Windows aarch64, and not using the actual MSVC,
we can assemble gnu assembly files just fine, and the existing
correct implementation of __kmp_invoke_microtask is fully usable.
(This current patch only uses it when building in mingw mode, but
when building with clang-cl, we could also just as well build and
rely on the assembly file - but that would require a bit more
preprocessor and cmake checks to distinguish that case.)
The C implementation of __kmp_invoke_microtask in
z_Windows_NT-586_util.cpp relies on unguaranteed assumptions about
the compiler behaviour - it might work on MSVC, but doesn't necessarily
on other compilers. That function uses an alloca to pass parameters
on the stack to the called functions.
However, there's no guarantee that the buffer allocated by alloca is
exactly at the bottom of the stack when doing the call; the compiler
might have left space for extra things to save on the stack there.
Additionally, when compiled with Clang with optimization, Clang
optimizes out the alloca and memcpy entirely. On the C language
level, they don't have any visible effect outside of the function
and thus can be omitted entirely.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D137827
Files:
openmp/runtime/src/CMakeLists.txt
openmp/runtime/src/z_Linux_asm.S
openmp/runtime/src/z_Windows_NT-586_util.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137827.474722.patch
Type: text/x-patch
Size: 5424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221111/bdd2a35f/attachment-0001.bin>
More information about the Openmp-commits
mailing list