Can the popcnt, bsf, bsr and lzcnt instructions be generated in native OCaml on x86 CPUs?
I have OCaml 4.01.0 sources handy, and for this it's pretty easy to check. If you look for these instructions in the code generation sources, they do not appear.
$ pwd
/home/jeffsco/oc41/asmcomp/i386
$ ls
arch.ml emit_nt.mlp reload.ml selection.ml
emit.mlp proc.ml scheduling.ml
$ grep -w popcnt *
$ grep -w bsf *
$ grep -w bsr *
$ grep -w lzcnt *
If I look for something like movl I get plenty of hits:
$ grep -w movl *
emit.mlp: ` movl {emit_reg src}, {emit_reg dst}\n`
emit.mlp: | _ -> ` movl $0, {emit_reg i.res.(0)}\n`
. . .
So, I strongly suspect the answer is no. Perhaps things have changed for OCaml 4.02, but I doubt it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With