I'm not an expert with assembly so this may be simple.
If I have an instruction that expects a constant value as a parameter like so:
VQSHRN.U32 d0,q0,#16
How can I replace #16
with a value in a register, eg r0
? This instruction may even allow you to do so, but I haven't found docs on that capability. Is there a normal method of doing this?
In case this matters, I'm writing ARMv7 assembly and putting it inline with c++ code. Thanks.
As @Michael pointed out, VQRSHL
is the appropriate shift-by-register instruction here - fortunately, right happens to be negative left. I'd use a VDUP
to turn r0
into an appropriate vector of shift values first, and a VQMOVN
afterwards for the narrowing. All of these are available as intrinsics to help keep the nastiness of inline assembly at bay, something like this:
vshift = vdupq_n_s32(-shift);
result = vqmovn_u32(vqrshlq_u32(data, vshift));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.