# Issue using llvm

**URL:** https://discourse.julialang.org/t/issue-using-llvm/111374
**Category:** General Usage
**Created:** [March 8, 2024, 7:05pm UTC](https://discourse.julialang.org/t/issue-using-llvm/111374 "2024-03-08T19:05:08Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Daniel\_Scheinerman](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@Daniel\_Scheinerman](https://discourse.julialang.org/u/Daniel_Scheinerman)
#### Post date: [March 8, 2024, 7:05pm UTC](https://discourse.julialang.org/t/issue-using-llvm/111374/1 "2024-03-08T19:05:08Z")

</div>

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:

```julia
x=rand(Int64)
y=rand(Int64)
ccall("llvm.x86.pmullw",llvmcall,Int64,(Int64,Int64),x,y)

```

This gives me an error:

```julia
ERROR: llvmcall only supports intrinsic calls

```

---

<div class="post-metadata">

### Author: ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)
#### Post date: [March 8, 2024, 10:33pm UTC](https://discourse.julialang.org/t/issue-using-llvm/111374/2 "2024-03-08T22:33:13Z")

</div>

> [@Daniel\_Scheinerman](#):
>
> I am trying to use the Intel intrinsic pmullw.

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

---

<div class="post-metadata">

### Author: ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)
#### Post date: [March 8, 2024, 10:46pm UTC](https://discourse.julialang.org/t/issue-using-llvm/111374/3 "2024-03-08T22:46:13Z")

</div>

The closest I could find is `x86_mmx @llvm.x86.mmx.pmull.w(x86_mmx, x86_mmx)`, but that explicit requires `x86_mmx` registers.

---

<div class="post-metadata">

### Author: ![Daniel\_Scheinerman](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@Daniel\_Scheinerman](https://discourse.julialang.org/u/Daniel_Scheinerman)
#### Post date: [March 8, 2024, 11:02pm UTC](https://discourse.julialang.org/t/issue-using-llvm/111374/4 "2024-03-08T23:02:58Z")

</div>

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](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.

---

<div class="post-metadata">

### Author: ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)
#### Post date: [March 9, 2024, 4:05am UTC](https://discourse.julialang.org/t/issue-using-llvm/111374/5 "2024-03-09T04:05:47Z")

</div>

We don’t have a representation of `x86_mmx`.

So normally you do:

```julia
 ccall("llvm.ceil", llvmcall, Float64, (Float64,), 1.0)

```

But

```julia
 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`

---

<div class="post-metadata">

### Author: ![Daniel\_Scheinerman](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@Daniel\_Scheinerman](https://discourse.julialang.org/u/Daniel_Scheinerman)
#### Post date: [March 9, 2024, 4:41am UTC](https://discourse.julialang.org/t/issue-using-llvm/111374/6 "2024-03-09T04:41:08Z")

</div>

That worked. Thanks so much!
