[ESIMD] Add writeable subsript operator for simd_view #4384
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.
The primary goal for this patch is to allow writing through
simd_view subscript operator, e.g.:
All the other changes are required to make that happen:
One more specialization for nested simd_view class with len=1.
Added explicit definition of BINOP for simd_view_impl with
a scalar value because of the following code:
Here
g.row(1)
return simd_view and(g.row(1))[0]
returnssimd_view of size 1. To use any binops defined in simd_view_impl
before this patch we would need to implicitly convert RHS to
scalar and then convert scalar to vector type. Two implicit
conversions are not allowed according to C++ language rules,
hence new BINOP operator definition for simd_view_impl.
specialization for lenght=1 to support the following code:
This code is OK. The result of bit_cast_view should be mapped
to specialization of simd_view with length 1, so conversion to
scalar is allowed. To enable such mapping, I fixed the definition
of region_base_1. Previously we had zeros for StrideY and StrideX
but in fact, we don't care about their values, they can take any
values.