<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55192>55192</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[BPF] BPF Assembly Parser missing Instructions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
derkro99
</td>
</tr>
</table>
<pre>
Hello,
Upon trying to assemble an extended version of the code found at https://qmonnet.github.io/whirl-offload/2020/04/12/llvm-ebpf-asm , i encountered:
```
instTest.s:8:8: error: invalid operand for instruction
r1 %=5 #BPF_MOD
^
instTest.s:9:9: error: unexpected token
r1 =~r1 #BPF_NEG
^
```
I assembled the following code with `llvm-mc -triple bpf -filetype=obj -o bpf.o instTest.s`:
```
#file: instTest.s
.text
.globl func # -- Begin function func
.p2align 3
func: # @func
# %bb.0:
r1 = 0
*(u32 *)(r10 - 4) = r1
r1 %=5
r1 =~r1
r0 = r1
exit
# -- End function
r0 = 3
```
I am using Debian LLVM version 13.0.1
Since all the other code i tested follows the contents of the description column at https://www.kernel.org/doc/html/latest/bpf/instruction-set.html i expected these two instruction to be the same.
While looking for solutions to this problem, i noticed, that these two instructions are missing from https://github.com/llvm/llvm-project/blob/09c2b7c35af8c4bad39f03e9f60df8bd07323028/llvm/test/MC/BPF/insn-unit.s#L118
Please correct me if I am wrong, but I think, that the BPF_MOD and BPF_NEG are currently not supported by the instruction Parser.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVduSozYQ_Rr80gUFwszAgx9m1jPJVs0kU5VN8pgC0RithUQkMR7_fVqC9WXXqUooLHTt0326ddzo9rj5GaXUEfsUpdsofZjb30etwJmjUDtwGmprcWgkQq0APxyqFlt4R2MFbdMduB6B6xah05NqoXbQOzfaKH-I2DO9fw9aKXTJTrh-ahJBcM-HXhgZ666Tum5pzFKW0iddU5MxaqR8H2Jsxi6u7QDkIAhAxQ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