Vector: Remove now unnecessary uses of undefined #552
Merged
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.
A few refactorings to the vector extension:
Sail 0.18 contains the vector_init primitive, to make initialising vectors with defined values easier. We can use this in some places where the vector code was creating an uninitialised vector, only to then initialise it later.
Second, we can remove some uses of undefined by refactoring slightly how
init_masked_result
is used, which has the added benefit of making the mask immutable.Sail's pattern completeness checker is now smarter than before, so some wildcard cases in matches can also be safely removed without causing any warnings.
We can also remove some asserts by adding an overload for the default division operator for the positive cases where truncating division and the SMT solver's euclidian division are the same, so the type system can just infer the facts those assertions were guaranteeing.
One thing I noticed is the
read_vmask_carry
function doesn't seem to be doing anything, as it looks like it is only called withvm=0b0
where it is then the same asread_vmask
. I didn't make any changes to this in this PR however.