2

I have a 128 bit vector consisting of a comparison mask, eg

ffff 0000 ffff ffff 0000 0000 0000 ffff

My end goal is to transform this into a mask that looks like (one byte, binary)

10110001

I'm trying to do this in ARM assembly.

First thing I want to do is to try and narrow the vector with vqmovn.s16

vqmovn.s16 v0, v0

But the assembler doesn't recognize that instruction.

Error: unknown mnemonic vqmovn.s16

Nate Eldredge
  • 48,811
  • 6
  • 54
  • 82
AnthonyM
  • 1,115
  • 2
  • 10
  • 20
  • 3
    `VQMOVN` appears in the AArch32 section of the ARMv8 architecture reference manual, so I don't think you can use it on arm64. There may be an equivalent called something else. – Nate Eldredge Jan 21 '21 at 23:36
  • 2
    Maybe `SQXTN` is what you want? – Nate Eldredge Jan 21 '21 at 23:38
  • I think so, I'll try it and update. – AnthonyM Jan 21 '21 at 23:49
  • One approach might be `NEG`, `USHL` by `0x00070006000500040003000200010000`, and then `ADDV`. – Nate Eldredge Jan 21 '21 at 23:55
  • 3
    There's a trick to this: load a vector containing a `0x0080 0040 0020 0010 0008 0004 0002 0001` mask, and it with the comparison mask and compute a horizontal sum (I think it's `addhl`?). – fuz Jan 22 '21 at 00:00
  • There are some other Q&As about the problem you're trying to solve, e.g: [SSE \_mm\_movemask\_epi8 equivalent method for ARM NEON](https://stackoverflow.com/q/11870910) (except that's for 8-bit elements) – Peter Cordes Jan 22 '21 at 00:07

0 Answers0