mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-25 20:00:44 +01:00
On current targets, popcount is a vector op. By using VPopcount
ourselves when calculating, we can reduce some pointless masking.
Before:
and x22, x4, #0xff
fmov d0, x22
cnt v0.8b, v0.8b
addv b0, v0.8b
umov w22, v0.b[0]
eor x22, x22, #0x1
strb w22, [x28, #706]
After:
eor x22, x4, #0x1
fmov s4, w22
cnt v4.16b, v4.16b
umov w22, v4.b[0]
strb w22, [x28, #706]
llvm-mca before:
Iterations: 100
Instructions: 700
Total Cycles: 2002
Total uOps: 700
Dispatch Width: 2
uOps Per Cycle: 0.35
IPC: 0.35
Block RThroughput: 3.5
llvm-mca after:
Iterations: 100
Instructions: 500
Total Cycles: 1402
Total uOps: 500
Dispatch Width: 2
uOps Per Cycle: 0.36
IPC: 0.36
Block RThroughput: 2.5
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>