[PATCH] D140087: [X86] Replace (31/63 -/^ X) with (NOT X) and ignore (32/64 ^ X) when computing shift count
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 09:49:09 PST 2022
goldstein.w.n added a comment.
@pengfei Somewhat unrelated so if this is not the right place the ask, can you let me know where is.
I was looking to add a peephole to change something like:
ptr[x / 32] |= (1 << (x % 32))
Currently codegen is something like:
mov $0x1,%gpr1
shlx %cnt,%gpr1,%mask
shr $0x5,%cnt
or %mask, (%ptr, %cnt, 4)
And it could be as simple as:
bts %cnt, (%ptr)
(other pattern with `bt{s|r|c}` could also be improved)
I saw `one_bit_patterns` in `X86InstrCompiler` but don't see a way to extend
the peephole s.t `addr` is a function of the inputs and not just one of the inputs.
Any chance you could direct me as where I should look at add this type of
peephole?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140087/new/
https://reviews.llvm.org/D140087
More information about the llvm-commits
mailing list