[PATCH 2/2] Simplify subreg of vec_merge of vec_duplicate
Richard Sandiford
richard.sandiford@arm.com
Thu Oct 18 11:06:00 GMT 2018
"H.J. Lu" <hjl.tools@gmail.com> writes:
> On 10/18/18, Richard Sandiford <richard.sandiford@arm.com> wrote:
>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>> On 10/17/18, Marc Glisse <marc.glisse@inria.fr> wrote:
>>>> On Wed, 17 Oct 2018, H.J. Lu wrote:
>>>>
>>>>> We may simplify
>>>>>
>>>>> (subreg (vec_merge (vec_duplicate X) (vector) (const_int 1)) 0)
>>>>>
>>>>> to X when mode of X is the same as of mode of subreg.
>>>>
>>>> Hello,
>>>>
>>>> we already have code to simplify vec_select(vec_merge):
>>>>
>>>> /* If we select elements in a vec_merge that all come from the same
>>>> operand, select from that operand directly. */
>>>>
>>>> It would make sense to me to make the subreg transform as similar to it
>>>> as
>>>> possible, in particular you don't need to special case vec_duplicate,
>>>> the
>>>> transformation would see that everything comes from the first vector,
>>>> produce (subreg (vec_duplicate X) 0), and let another transformation
>>>> optimize that.
>>
>> Sorry, didn't see this before the OK.
>>
>>> What do you mean by another transformation? If simplify_subreg doesn't
>>> return X for
>>>
>>> (subreg (vec_merge (vec_duplicate X)
>>> (vector)
>>> (const_int ((1 << N) | M)))
>>> (N * sizeof (X)))
>>>
>>>
>>> no further transformation will be done.
>>
>> I think the point was that we should transform:
>>
>> (subreg (vec_merge X
>> (vector)
>> (const_int ((1 << N) | M)))
>> (N * sizeof (X)))
>>
>> into:
>>
>> simplify_gen_subreg (outermode, X, innermode, byte)
>>
>> which should further simplify when X is a vec_duplicate.
>
> But sizeof (X) is the size of scalar of vec_dup. How do we
> check the mask of vec_merge?
Yeah, should be sizeof (outermode) (which was the same thing
in the original pattern, but not here).
Richard
More information about the Gcc-patches
mailing list