[PATCH] rs6000: Use rldimi for vec init instead of shift + ior
Kewen.Lin
linkw@linux.ibm.com
Fri Jan 15 06:40:20 GMT 2021
Hi Segher,
on 2021/1/15 上午8:50, Segher Boessenkool wrote:
> Hi!
>
> On Tue, Dec 22, 2020 at 04:08:26PM +0800, Kewen.Lin wrote:
>> This patch is to make unsigned int vector init go with
>> rldimi to merge two integers instead of shift and ior.
>>
>> I tried to use nonzero_bits in md file to make it more
>> general, but the testing shows it isn't doable. The
>> reason is that some passes would replace some pseudos
>> with other pseudos and do the recog again, but at that
>> time the nonzero_bits could get rough information and
>> lead the recog fails unexpectedly.
>
> Aha. So nonzero_bits is unusable for most purposes as well. Great :-/
>
>> btw, the test case would reply on the combine patch[1].
>
> Can you make a different testcase perhaps? This patch looks fine
> otherwise.
>
Thanks! But I'm sorry that there is a typo, it should be "rely on"
rather than "reply on", without the patch[1] "combine: zeroing cost
for new copies", this test case doesn't get the desirable result.
I'll explain it more in that patch's thread. If your uncommitted
patch there with define_split and nonzero_bits works, this patch
can be discarded totally.
[1] https://gcc.gnu.org/pipermail/gcc-patches/2020-December/561413.html
> (Ideally the compiler would just form those insert insns itself, of
> course. Why doesn't that work? This is important for quite a lot of
> code, we really can advantageously use the rl*imi insns often!)
>
The reason why it doesn't work is that the *rotl<mode>3_insert_3
pattern requires one explicit AND (with some masks) there but in
this case the AND is optimized away due to that nonzero_bits
indicates the AND is redundant.
BR,
Kewen
More information about the Gcc-patches
mailing list