-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Correct the simd_masked_{load,store} intrinsic docs #119203
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,12 +243,13 @@ extern "platform-intrinsic" { | |
/// | ||
/// `T` must be a vector. | ||
/// | ||
/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`. | ||
/// `U` must be a pointer to the element type of `T` | ||
/// | ||
/// `V` must be a vector of integers with the same length as `T` (but any element size). | ||
/// | ||
/// For each element, if the corresponding value in `mask` is `!0`, read the corresponding | ||
/// pointer from `ptr`. | ||
/// pointer offset from `ptr`. | ||
/// The first element is loaded from `ptr`, the second from `ptr.wrapping_offset(1)` and so on. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd expect it to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The entire point of this is to be able to mask off loads that would be out-of-bounds. If it used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
no, because
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Even then I couldn't use this to do loads where the first elements are out of bounds. The LLVM docs are unfortunately unclear on whether the pointer arithmetic has "inbounds" semantics or not, but the note about suppressing exceptions seems to indicate that out-of-bounds should be allowed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm proposing to clarify the LangRef: llvm/llvm-project#82469. |
||
/// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from | ||
/// `val`. | ||
/// | ||
|
@@ -264,12 +265,13 @@ extern "platform-intrinsic" { | |
/// | ||
/// `T` must be a vector. | ||
/// | ||
/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`. | ||
/// `U` must be a pointer to the element type of `T` | ||
/// | ||
/// `V` must be a vector of integers with the same length as `T` (but any element size). | ||
/// | ||
/// For each element, if the corresponding value in `mask` is `!0`, write the corresponding | ||
/// value in `val` to the pointer. | ||
/// value in `val` to the pointer offset from `ptr`. | ||
/// The first element is written to `ptr`, the second to `ptr.wrapping_offset(1)` and so on. | ||
/// Otherwise if the corresponding value in `mask` is `0`, do nothing. | ||
/// | ||
/// # Safety | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not make the argument of type
*const U
then? It's not necessary to make it so generic.Same for the store operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good idea. I'll explore this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is left to a future PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think we'll need to change how we validate these monomorphizations and there will be an opportunity when we move these checks out of the codegen crate.