[PATCH] Fix for mov<mode>_internal pattern

Michael Zolotukhin michael.v.zolotukhin@gmail.com
Fri Mar 22 12:50:00 GMT 2013


> Do you have a testcase to show there is a problem?
> The misaligned case should only be generated from
> ix86_avx256_split_vector_move_misalign.
I faced it when playing with optimized expanding of memmov (with
vector instructions). There I generated v2di-move with emit_strmov,
which later used "*movv2di_internal" pattern, and there aligned
version was chosen because (TARGET_AVX) was false. Probably, that's
not how emit_strmov should've been used, but then it'd be cool to have
an assert or an additional check somewhere, which would tell me, that
I'm using some function in a wrong way.
So, I guess it's true that in trunk everything is ok here and the
misaligned case could only come from
ix86_avx256_split_vector_move_misalign - nevertheless, this place
seems to me a bit untidy.


On 21 March 2013 21:27, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Mar 21, 2013 at 9:36 AM, Michael Zolotukhin
> <michael.v.zolotukhin@gmail.com> wrote:
>> Hi,
>> I've found a little bit strange code in "mov<mode>_internal"
>> RTL-pattern from config/i386/sse.md:
>>         case MODE_V2DF:
>>          if (TARGET_AVX
>>              && (misaligned_operand (operands[0], <MODE>mode)
>>                  || misaligned_operand (operands[1], <MODE>mode)))
>>            return "vmovupd\t{%1, %0|%0, %1}";
>>           else
>>             return "%vmovapd\t{%1, %0|%0, %1}";
>>
>> That could lead to generation of vmovapd for misaligned operands. Was
>> there any special intention behind that, or is that just a bug?
>> Attached is a patch that removes TARGET_AVX from the condition, thus
>> preventing generation of movapd for misaligned operands and enabling
>> generation of movupd for them.
>>
>> If the patch is ok, could anyone please commit it? Of course, that
>> could wait until 4.8 is released.
>>
>> Bootstrapped and tested on x86_64-unknown-linux-gnu and i686-linux.
>>
>> Changelog:
>> 2013-03-21  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>
>>
>>         * config/i386/sse.md (*mov<mode>_internal): Fix condition.
>>
>> --
>
> Do you have a testcase to show there is a problem?
> The misaligned case should only be generated from
> ix86_avx256_split_vector_move_misalign.
>
>
> --
> H.J.



-- 
---
Best regards,
Michael V. Zolotukhin,
Software Engineer
Intel Corporation.



More information about the Gcc-patches mailing list