Skip to content
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

Implement jl_cpu_pause on PPC64 #49573

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,12 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
ctx.builder.CreateCall(pauseinst);
JL_GC_POP();
return ghostValue(ctx, jl_nothing_type);
} else if (ctx.emission_context.TargetTriple.isPPC64()) {
auto hintinst = InlineAsm::get(FunctionType::get(getVoidTy(ctx.builder.getContext()), false), "or 27,27,27",
"~{memory}", true);
ctx.builder.CreateCall(hintinst);
JL_GC_POP();
return ghostValue(ctx, jl_nothing_type);
} else if (ctx.emission_context.TargetTriple.isAArch64()
|| (ctx.emission_context.TargetTriple.isARM()
&& ctx.emission_context.TargetTriple.getSubArch() != Triple::SubArchType::NoSubArch
Expand Down
4 changes: 4 additions & 0 deletions src/julia_threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ JL_DLLEXPORT void *jl_get_ptls_states(void);
# define jl_cpu_pause() __asm__ volatile ("wfe" ::: "memory")
# define jl_cpu_wake() __asm__ volatile ("sev" ::: "memory")
# define JL_CPU_WAKE_NOOP 0
#elif defined(_CPU_PPC64_)
# define jl_cpu_pause() __asm__ volatile ("or 27,27,27" ::: "memory")
# define jl_cpu_wake() ((void)0)
# define JL_CPU_WAKE_NOOP 1
#else
# define jl_cpu_pause() ((void)0)
# define jl_cpu_wake() ((void)0)
Expand Down