Add missing Neon intrinsics#440
Conversation
These intrinsics are present in LLVM and GCC, but not documented on the ACLE. Add them to close the gap.
| | <code>poly8x16_t <a href="https://developer.arm.com/architectures/instruction-sets/intrinsics/vmovq_n_p8" target="_blank">vmovq_n_p8</a>(poly8_t value)</code> | `value -> rn` | `DUP Vd.16B,rn` | `Vd.16B -> result` | `v7/A32/A64` | | ||
| | <code>poly16x4_t <a href="https://developer.arm.com/architectures/instruction-sets/intrinsics/vmov_n_p16" target="_blank">vmov_n_p16</a>(poly16_t value)</code> | `value -> rn` | `DUP Vd.4H,rn` | `Vd.4H -> result` | `v7/A32/A64` | | ||
| | <code>poly16x8_t <a href="https://developer.arm.com/architectures/instruction-sets/intrinsics/vmovq_n_p16" target="_blank">vmovq_n_p16</a>(poly16_t value)</code> | `value -> rn` | `DUP Vd.8H,rn` | `Vd.8H -> result` | `v7/A32/A64` | | ||
| | <code>poly64x1_t <a href="https://developer.arm.com/architectures/instruction-sets/intrinsics/vmov_n_p64" target="_blank">vmov_n_p64</a>(poly64_t value)</code> | `value -> rn` | `INS Dd.D[0],xn` | `Vd.1D -> result` | `A32/A64` | |
There was a problem hiding this comment.
Is this correct ' INS Dd.D[0],xn`, it is different from the others vmovq with poly types.
There was a problem hiding this comment.
For both GCC and LLVM, the compiler is emitting a fmov in assembly.
Fr other intrinsics fmov is an INS rather than a DUP:
https://godbolt.org/z/WojWWKrss
vmovq on the other hand emits a "real" DUP in assembly.
Compare vdup_n_p64, which is also emitting an INS only.
There was a problem hiding this comment.
This doesn't make sense as is:
INShere implies a partial (merging) write to the destination register but this intrinsic does not specify a destination to merge into (it wouldn't make sense to do so either).INSwith aDd(notVd) destination doesn't exist in AArch64 at least.
So I think this should be FMOV since that is the closest correct interpretation (and that's what compilers currently emit anyway for the GPR->VPR mov).
There was a problem hiding this comment.
INS with a Dd (not Vd) destination doesn't exist in AArch64 at least.
vdup_n_p64 is also wrong then: INS Dd.D[0],xn, so this needs changed.
There is no intrinsic that lists FMOV as AArch64 Instruction. I don't mind changing it, though
There was a problem hiding this comment.
Martin I agree with George and I am in favour to update this to what the compilers are lowering to, which is FMOV
There was a problem hiding this comment.
ah, sorry yes, I updated this in the latest commit:
| <code>poly64x1_t <a href="https://developer.arm.com/architectures/instruction-sets/intrinsics/vmov_n_p64" target="_blank">vmov_n_p64</a>(poly64_t value)</code> | `value -> rn` | `FMOV Dd,rn` | `Vd.1D -> result` | `A32/A64` |
The other INS to FMOV changes are here:
#445
| | <code>poly8x16_t <a href="https://developer.arm.com/architectures/instruction-sets/intrinsics/vmovq_n_p8" target="_blank">vmovq_n_p8</a>(poly8_t value)</code> | `value -> rn` | `DUP Vd.16B,rn` | `Vd.16B -> result` | `v7/A32/A64` | | ||
| | <code>poly16x4_t <a href="https://developer.arm.com/architectures/instruction-sets/intrinsics/vmov_n_p16" target="_blank">vmov_n_p16</a>(poly16_t value)</code> | `value -> rn` | `DUP Vd.4H,rn` | `Vd.4H -> result` | `v7/A32/A64` | | ||
| | <code>poly16x8_t <a href="https://developer.arm.com/architectures/instruction-sets/intrinsics/vmovq_n_p16" target="_blank">vmovq_n_p16</a>(poly16_t value)</code> | `value -> rn` | `DUP Vd.8H,rn` | `Vd.8H -> result` | `v7/A32/A64` | | ||
| | <code>poly64x1_t <a href="https://developer.arm.com/architectures/instruction-sets/intrinsics/vmov_n_p64" target="_blank">vmov_n_p64</a>(poly64_t value)</code> | `value -> rn` | `INS Dd.D[0],xn` | `Vd.1D -> result` | `A32/A64` | |
There was a problem hiding this comment.
Should we change this to also report v7?
There was a problem hiding this comment.
I wish I could give a strong reason why it should be/ shouldn't be v7, but all I can do is base it on patterns:
vmovq_n_p64 also uses A32/A64 only.
Most other _p64intrinsics such as vcombine_p64 are also just A32/A64.
These intrinsics were also present in LLVM/gcc. Inside the LLVM backend they are currently guarded only by A64 flags, but should be A32 probably as well.
Do you think it should be v7 or do you perhaps know how I could definitely say it is/isn't v7?
There was a problem hiding this comment.
The primary use case for 64-bit polynomial types would be to use the PMULL instruction, but that is limited to A32/A64 as well, so I think the restriction makes sense here (but it's not really a problem to have it in v7 either so no strong preference).
Same comment about INS not making sense here.
There was a problem hiding this comment.
Ok, so there is no reason for this to be available in v7. Ok, A32/A64 is ok
| poly8x16_t vmovq_n_p8(poly8_t value) value -> rn DUP Vd.16B,rn Vd.16B -> result v7/A32/A64 | ||
| poly16x4_t vmov_n_p16(poly16_t value) value -> rn DUP Vd.4H,rn Vd.4H -> result v7/A32/A64 | ||
| poly16x8_t vmovq_n_p16(poly16_t value) value -> rn DUP Vd.8H,rn Vd.8H -> result v7/A32/A64 | ||
| poly64x1_t vmov_n_p64(poly64_t value) value -> rn INS Dd.D[0],xn Vd.1D -> result A32/A64 |
There was a problem hiding this comment.
This looks strange too.
There was a problem hiding this comment.
This is the original input file. The md gets generated from the csv, so I set the value here. The strangeness was carried into the md file, so to speak
Change the changes documentation.
These intrinsics are present in LLVM and GCC, but not documented on the ACLE.
Add them to close the gap.
name: Pull request
about: Technical issues, document format problems, bugs in scripts or feature proposal.
Thank you for submitting a pull request!
If this PR is about a bugfix:
Please use the bugfix label and make sure to go through the checklist below.
If this PR is about a proposal:
We are looking forward to evaluate your proposal, and if possible to
make it part of the Arm C Language Extension (ACLE) specifications.
We would like to encourage you reading through the contribution
guidelines, in particular the section on submitting
a proposal.
Please use the proposal label.
As for any pull request, please make sure to go through the below
checklist.
Checklist: (mark with
Xthose which apply)PR (do not bother creating the issue if all you want to do is
fixing the bug yourself).
SPDX-FileCopyrightTextlines on topof any file I have edited. Format is
SPDX-FileCopyrightText: Copyright {year} {entity or name} <{contact informations}>(Please update existing copyright lines if applicable. You can
specify year ranges with hyphen , as in
2017-2019, and usecommas to separate gaps, as in
2018-2020, 2022).Copyrightsection of the sources of thespecification I have edited (this will show up in the text
rendered in the PDF and other output format supported). The
format is the same described in the previous item.
tricky to set up on non-*nix machines). The sequence can be
found in the contribution
guidelines. Don't
worry if you cannot run these scripts on your machine, your
patch will be automatically checked in the Actions of the pull
request.
introduced in this PR in the section Changes for next
release of the section Change Control/Document history
of the document. Create Changes for next release if it does
not exist. Notice that changes that are not modifying the
content and rendering of the specifications (both HTML and PDF)
do not need to be listed.
correctness of the result in the PDF output (please refer to the
instructions on how to build the PDFs
locally).
draftversionis set totruein the YAML headerof the sources of the specifications I have modified.
in the README page of the project.