Do ARMv7 and/or ARMv8 instruction set provide an instruction similar to PEXT
on x86?
If not, what is the most efficient instructions combination to achieve the same behavior?
Do ARMv7 and/or ARMv8 instruction set provide an instruction similar to PEXT
on x86?
If not, what is the most efficient instructions combination to achieve the same behavior?
This is my implementation
// w14 = pext(val: w13, mask: w15)
// Used Regs x12-x15
// (w13 & w15 will BROKEN after the loop)
mov w14, wzr;
.loop:
cbz w15, .pext_end; // may accelerate by prepare with (w13 & w15)
clz w12, w15
lsl w13, w13, w12
lsl w15, w15, w12
extr w14, w14, w13, #31
bfc w15, #31, #1
b .loop
.pext_end: