mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-18 11:52:22 -07:00
Add intrinsics.cpu_relax for llvm-api
This commit is contained in:
+11
-2
@@ -7835,8 +7835,17 @@ lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValue const &tv,
|
||||
}
|
||||
|
||||
case BuiltinProc_cpu_relax:
|
||||
// TODO(bill): BuiltinProc_cpu_relax
|
||||
// ir_write_str_lit(f, "call void asm sideeffect \"pause\", \"\"()");
|
||||
{
|
||||
LLVMTypeRef func_type = LLVMFunctionType(LLVMVoidTypeInContext(p->module->ctx), nullptr, 0, false);
|
||||
LLVMValueRef the_asm = LLVMGetInlineAsm(func_type,
|
||||
"pause", 5,
|
||||
"", 0,
|
||||
/*HasSideEffects*/true, /*IsAlignStack*/false,
|
||||
LLVMInlineAsmDialectATT
|
||||
);
|
||||
GB_ASSERT(the_asm != nullptr);
|
||||
LLVMBuildCall2(p->builder, func_type, the_asm, nullptr, 0, "");
|
||||
}
|
||||
return {};
|
||||
|
||||
case BuiltinProc_atomic_fence:
|
||||
|
||||
Reference in New Issue
Block a user