Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/asm: add VTST instruction on arm64 #59713

Closed
pascaldekloe opened this issue Apr 19, 2023 · 10 comments
Closed

cmd/asm: add VTST instruction on arm64 #59713

pascaldekloe opened this issue Apr 19, 2023 · 10 comments

Comments

@pascaldekloe
Copy link
Contributor

“Vector Test Bits takes each element in a vector, and bitwise ANDs it with the corresponding element of a second vector. If the result is not zero, the corresponding element in the destination vector is set to all ones. Otherwise, it is set to all zeros.”

https://developer.arm.com/documentation/ddi0406/c/Application-Level-Architecture/Instruction-Details/Alphabetical-list-of-instructions/VTST

The instruction would enable parallel zig-zag encoding, as NEON has no arithmetic shift.

@gopherbot gopherbot added this to the Proposal milestone Apr 19, 2023
@pascaldekloe
Copy link
Contributor Author

@zhangfannie

@seankhliao
Copy link
Member

cc @golang/arm @golang/compiler

@cherrymui
Copy link
Member

This doesn't need to be a proposal. Feel free to just send a CL adding the instruction. Thanks.

@cherrymui cherrymui changed the title proposal: arm64: add VTST instruction cmd/asm: add VTST instruction on arm64 Apr 19, 2023
@cherrymui cherrymui modified the milestones: Proposal, Unplanned Apr 19, 2023
@pascaldekloe
Copy link
Contributor Author

If I could, then I would @cherrymui. I would do the entire RISC set and get it over with actually.

@erifan
Copy link

erifan commented Apr 20, 2023

I'm refactoring the arm64 assembler, which is expected to support the vast majority of missing instructions.

By the way, VTST is an Armv7 instruction, not an Arm64 instruction, I want to confirm with you that it is the instruction you want? Armv8 has a similar instruction CMTST, are you looking for it?

@pascaldekloe
Copy link
Contributor Author

I was wondering why none of the opcodes from the "Alphabetical list of A64 Advanced SIMD and floating-point instructions" of the "Arm Architecture Reference Manual for A-profile architecture" match func oprrr. Starting to make sense now—wrong document. 😄

For the zig-zag usecase, I need arithmetic shifts int64(x) >> 63, int32(x) >> 31 and int16(x) >> 15. From the documentation, it seems both CMTST and VTST could achieve the same results, yes. 👍

Also happy to to help with the refactoring. Could start with some basic comments. Refer to the correct manual and such. 🤭 Make func asmout append (the right amount of) bytes perhaps? Let me know if that would be of any use. No is a perfectly fine answer. pascal@quies.net

@erifan
Copy link

erifan commented Apr 20, 2023

For the zig-zag usecase, I need arithmetic shifts int64(x) >> 63, int32(x) >> 31 and int16(x) >> 15. From the documentation, it seems both CMTST and VTST could achieve the same results, yes. 👍

Glad to hear this. CMTST has been supported already, it's called VCMTST in go, here are two use cases:

	VCMTST	V2.B8, V29.B8, V2.B8            // a28f220e
	VCMTST	V2.D2, V23.D2, V3.D2            // e38ee24e

I'll close this issue, feel free to reopen it if there's any further comment, thanks.

@erifan erifan closed this as completed Apr 20, 2023
@pascaldekloe
Copy link
Contributor Author

Any luck with the refactoring yet @erifan?
I managed to produce something consistent now with the right manual 😁 yet something is still missing to come to live. https://go-review.googlesource.com/c/go/+/509575

@erifan
Copy link

erifan commented Jul 17, 2023

@pascaldekloe The refactoring work is still in progress, and I'm sorry that the instructions you want are still not supported yet. If you are eager to use them, I suggest you temporarily use "DWORD <32-bit instruction binary>" to work around, because now it is the release cycle, we can't merge such changes into the master branch.

The refactoring changes are here https://go-review.googlesource.com/c/go/+/424137

@pascaldekloe
Copy link
Contributor Author

I'm not here to put any pressure on you Eric. Better get this right than fast. B.t.w., Go's 0b notation, including _ separation works really nice with opcodes I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants