I am trying to use the Intel intrinsic pmullw. Details likely don’t matter. It takes two 64 bit integers and returns a 64 bit integer. I tried calling it as follows:
x=rand(Int64)
y=rand(Int64)
ccall("llvm.x86.pmullw",llvmcall,Int64,(Int64,Int64),x,y)
This gives me an error:
ERROR: llvmcall only supports intrinsic calls
Where did you find this intrinsic name?
The closest I could find is the Clang builtin __builtin_ia32_pmullw
but I am not sure if there is a corresponding intrinsic
The closest I could find is x86_mmx @llvm.x86.mmx.pmull.w(x86_mmx, x86_mmx)
, but that explicit requires x86_mmx
registers.
I think that’s the one. I found it here: https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=pmullw&ig_expand=5099
Is my syntax wrong for trying to call this function? I do have the MMX instruction set on my machine.
We don’t have a representation of x86_mmx
.
So normally you do:
ccall("llvm.ceil", llvmcall, Float64, (Float64,), 1.0)
But
ccall("llvm.x86.mmx.pmull.w", llvmcall,Int64,(Int64,Int64), 1, 0)
(Assuming I got the spelling right) I think we are trying to infer the llvm register from the passed type and this fails here since Int64
maps to i64
not x86_mmx
.
You try and use a full Base.llvmcall
and bitcast from i64
to x86_mmx
That worked. Thanks so much!