[VectorAPI] Expose direct move mask operation?
Eric Liu
eric.c.liu at arm.com
Sat Jan 28 02:31:24 UTC 2023
> With current API, it seems that if one want to get the lanes with highest bit set, one can use Vector::compare(LT, 0).
I assume the final goal is to gather the highest bits of each lane to an Integer value, while it’s going to be allocated to a general-purpose register on a certain hardware.
```
long imm = va.compare(LT, 0).toLong();
```
> In the backend, this seems to be translated to something like vpcmpgtb followed by vpmovmskb. However, Gather the highest bit on x86 only need a movemask operation.
I’m not familiar with x86. I assume the input of vpmovmskb is a predicate register, while in your case the original input was a Vector object which should be allocated in vector register.
- Eric
From: panama-dev <panama-dev-retn at openjdk.org> On Behalf Of Zhu, Yifan
Sent: Saturday, January 7, 2023 8:01 AM
To: panama-dev at openjdk.org
Subject: [VectorAPI] Expose direct move mask operation?
Sorry if this was previously discussed. I am new to the list.
With current API, it seems that if one want to get the lanes with highest bit set, one can use Vector::compare(LT, 0). In the backend, this seems to be translated to something like vpcmpgtb followed by vpmovmskb. However, Gather the highest bit on x86 only need a movemask operation.
* I wonder if such operations can be optimized if the given constant is special (such as 0)
* Or if we can finally have a gatherBits() operation. I know that movemask operations are not available on platforms like aarch64, but libraries like SIMDE has given some examples on how to emulate these operations on other platforms.
[cid:image001.png at 01D932FF.02C9D010]
Schrodinger ZHU Yifan, Ph.D. Student
Computer Science Department, University of Rochester
Personal Email: i at zhuyi.fan<mailto:i at zhuyi.fan>
Work Email: yifanzhu at rochester.edu<mailto:yifanzhu at rochester.edu>
Website: https://www.cs.rochester.edu/~yzhu104/Main.html
Github: SchrodingerZhu
GPG Fingerprint: BA02CBEB8CB5D8181E9368304D2CC545A78DBCC3
[cid:image003.png at 01D93303.A857DFF0]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230128/a10dd33e/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 19680 bytes
Desc: image001.png
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230128/a10dd33e/image001-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 187 bytes
Desc: image003.png
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230128/a10dd33e/image003-0001.png>
More information about the panama-dev
mailing list