[PATCH] D130956: [X86][MC] Always emit `rep` prefix for `bsf`

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 02:00:37 PDT 2022


pengfei added inline comments.


================
Comment at: llvm/test/CodeGen/X86/clz.ll:49
 ; X86:       # %bb.0:
-; X86-NEXT:    bsfw {{[0-9]+}}(%esp), %ax
+; X86-NEXT:    rep bsfw {{[0-9]+}}(%esp), %ax
 ; X86-NEXT:    retl
----------------
craig.topper wrote:
> We need to promote bsrw to bsrl. tzcntl is faster than tzcntw. tzcntw has a false dependency to preserve the upper 48 bits of the result register in Intel CPUs. But separate patch please.
Can we allow to always do that? The result is not equal for tzcnt if we care the src is 0: https://godbolt.org/z/enahabbM7


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130956/new/

https://reviews.llvm.org/D130956



More information about the llvm-commits mailing list