Skip to content

Conversation

ricbal02
Copy link

@ricbal02 ricbal02 commented Aug 1, 2025


Hi all,

This is a PR to propose the addition of new intrinsics required as part of FEAT_PCDPHINT.

I'm very open to suggestions on potential improvements and certainly not overly committed to the current name.
This will need approval from LLVM as well.

Quality Level: ALP


  • If an issue reporting the bug exists, I have mentioned it in the
    PR (do not bother creating the issue if all you want to do is
    fixing the bug yourself).
  • I have added/updated the SPDX-FileCopyrightText lines on top
    of 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 use
    commas to separate gaps, as in 2018-2020, 2022).
  • I have updated the Copyright section of the sources of the
    specification 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.
  • I have run the CI scripts (if applicable, as they might be
    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.
  • I have added an item that describes the changes I have
    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.
  • When modifying content and/or its rendering, I have checked the
    correctness of the result in the PDF output (please refer to the
    instructions on how to build the PDFs
    locally
    ).
  • The variable draftversion is set to true in the YAML header
    of the sources of the specifications I have modified.
  • Please DO NOT add my GitHub profile to the list of contributors
    in the README page of the project.

Copy link

@Wilco1 Wilco1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x

Comment on lines +1832 to +1834
`__ARM_FEATURE_PCDPHINT` is defined to `1` if the producer-consumer
data placement hints (FEAT_PCDPHINT) instructions and their associated
intrinsics are available on the target.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO as these are hint instructions the developer may want to use them on older -march targets, so the __ARM_FEATURE_PCDPHINT should only signify whether the compiler version in question supports the intrinsics, but the intrinsics themselves should be always available (presumably the hint instructions execute as NOPs on older HW?)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though reading a bit more, the user may not want to execute a PRFM instruction unless they know FEAT_PCDPHINT is present, so maybe it is prudent to gate these on hardware support. I don't insist on it.

The first argument in these intrinsics is a pointer `ptr` which is the location to store to.
The second argument `data` is the data which is to be stored.
The third argument `mem` can be one of 3 memory ordering variables from the C++11 standard supported by atomic_store:
__ATOMIC_RELAXED, __ATOMIC_SEQ_CST, and __ATOMIC_RELEASE.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these are in the C++11 standard with this spelling, these are GCC builtins. Also, it should probably reference C rather than C++.

``` c
void __arm_atomic_store_with_stshh(type *ptr,
type data,
int mem, /* Memory order */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the type of this be memory_order like in C11?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants