-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Description
This works in Julia 1.12.2 (provided that you have an x86 processor with BMI extension, of course):
julia> const llvm_pext = "llvm.x86.bmi.pext.64";
julia> pext(x::UInt64, y::UInt64) = ccall(llvm_pext, llvmcall, UInt64, (UInt64, UInt64), x, y);
julia> pext(UInt64(1), UInt64(1))
0x0000000000000001
Julia 1.13.0-alpha2 seems to require a literal string:
julia> pext(UInt64(1), UInt64(1))
ERROR: TypeError: in ccall: first argument not a pointer or valid constant expression, expected Ptr, got a value of type String
julia> pext2(x::UInt64, y::UInt64) = ccall("llvm.x86.bmi.pext.64", llvmcall, UInt64, (UInt64, UInt64), x, y);
julia> pext2(UInt64(1), UInt64(1))
0x0000000000000001
Julia Version 1.13.0-alpha2
Commit 7f76b76527d (2025-11-30 19:52 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 4 × Intel(R) Core(TM) i3-10110U CPU @ 2.10GHz
WORD_SIZE: 64
LLVM: libLLVM-20.1.8 (ORCJIT, skylake)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores)
Metadata
Metadata
Assignees
Labels
No labels