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

Aaron Puchert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 01:28:43 PDT 2022


aaronpuchert added a comment.

By the way, the original bug for this is #34191 <https://github.com/llvm/llvm-project/issues/34191>.



================
Comment at: llvm/test/CodeGen/X86/peephole-na-phys-copy-folding.ll:376
   %cmp = icmp sgt i32 %val, 0
   %res = tail call i32 asm "bsfl $1,$0", "=r,r,~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %val)
   store i32 %res, ptr %mem, align 4
----------------
Goes a bit too far I think. We can turn a generic builtin into `rep; bsf`, but if the inline assembly explicitly asks for `bsf` I think we should emit that.


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