Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
For discussion #1
For discussion #1
Changes from all commits
7a4dcd8
61961a2
7a08ecc
91b0b38
af41d14
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 thought it would be most transparent to future engineers if I just implement the x86 instruction itself so they know what is intended; however, for this to be truly flexible I would like to be able to pass in the
u8
immediate likex86_pshuf.bind_vector(I32, 4).set_immediate(0x...)
in the encodings. Obviouslyset_immediate
does not exist but I see arrr
used to pass in constants to the template; is that only for register addressing?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.
Never mind, I think I see how to do this: add a new operand here based on teh
immediates.by_name("uimm8")
and then inlegalize.rs
do something like:Does that sound right?
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.
Yes indeed. This should also allow to transform pshuf with specific immediates into smaller / faster sequences of instructions, in a (future) pipehole optimizer.
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.
This is a sticking point for me: if I uncomment this the code generation will fail:
The real issue is that I don't really understand how the type system which I observe in
encoding.rs
, e.g.I32
s and my addition ofbind_vector
, ties in with this error. Should I be specifying the types of these variables more explicitly?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.
Note that the variables
a
,x
, andy
refer to variables that might be typed with a type variable; since the build error happens during type inference, that might be it. The error message is very cryptic and could probably be enhanced in any case. I am going to try this locally.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'll rename this recipe to something else... but what? And the
sink.put1(0)
is a hardcoding that would be nice to avoid (see comments onpshuf
above)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.
If this can be reused for all the pshufw/d etc., maybe the name could be
pshuf_base
or something like this? (Or if you understand the preexistent naming scheme withrr
etc, apply the scheme here too? I'm not too sure how this naming scheme works...)