alexcrichton edited PR #3544 from fix-movsd-issue
to main
:
This also fixes a bug where
movsd
was incorrectly used with a memory
operand forinsertlane
, causing it to actually zero the upper bits
instead of preserving them.Note that the insertlane logic still exists in
lower.rs
because it's
used as a helper for a few other instruction lowerings which aren't
migrated to ISLE yet. This commit also adds a helper in ISLE itself for
those other lowerings to use when they get implemented.Closes #3216
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
abrown submitted PR review.
abrown submitted PR review.
abrown created PR review comment:
It occurs to me looking at this that I should have originally put a
debug_assert
in the lowering code to check for correct indexes; I don't really think this PR needs to change but I'm curious--if we did want to check that the index was in range for the type, how would we do so in ISLE?
abrown created PR review comment:
:+1:
alexcrichton submitted PR review.
alexcrichton created PR review comment:
I don't think that a
debug_asert!
would directly translate but what could be done is to have a different extractor here instead ofu8_from_uimm8
but rather something likeu{1,2,3,4}_from_uimm8
where the rule wouldn't get matched if the index was out-of-bounds, and then later we'd have a codegen error of "ISLE didn't match this" and manual inspection would show that the lane index was out-of-bounds. @fitzgen may have other ideas though.
abrown submitted PR review.
abrown created PR review comment:
Ok, cool; thanks, just curious.
cfallin submitted PR review.
cfallin created PR review comment:
The right way would probably be to assert in Rust code called by the rule; either in one of the extractors in the pattern (make a specific
LaneIndex
type then a(lane_index_from_uimm8 idx)
extractor pattern that returns it?) or in the constructor of whatever instruction takes it.We could also have a generic
(assert ...)
constructor that we could invoke in the right-hand side but that seems like a bit of an antipattern; better to just encode the invariant in the types :-)
fitzgen submitted PR review.
fitzgen created PR review comment:
Seconding what @cfallin said :)
alexcrichton updated PR #3544 from fix-movsd-issue
to main
.
alexcrichton merged PR #3544.
Last updated: Nov 22 2024 at 17:03 UTC