[PATCH] D146357: [X86] Alternative algorithm for vector-vector shifts

Ivan Chikish via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 09:05:41 PDT 2023


Nekotekina added a comment.

@LuoYuanke Added some analysis with https://uica.uops.info



================
Comment at: llvm/test/CodeGen/X86/avx2-shift.ll:547
+; X64-NEXT:    vpsllvd %xmm1, %xmm0, %xmm0
+; X64-NEXT:    vpblendw {{.*#+}} xmm0 = xmm0[0],xmm3[1],xmm0[2],xmm3[3],xmm0[4],xmm3[5],xmm0[6],xmm3[7]
 ; X64-NEXT:    retq
----------------
LuoYuanke wrote:
> The instruction count seems to increase from 5 to 7. Could you check if it improves performance with "https://uica.uops.info" or llvm-mca? 
Yes, it looks like an improvement unless I interpret website results wrong:
Left: https://bit.ly/3Vglo5l
Right: https://bit.ly/41ZSmZP



================
Comment at: llvm/test/CodeGen/X86/avx2-shift.ll:575
+; X64-NEXT:    vpsrld $16, %xmm0, %xmm0
+; X64-NEXT:    vpblendw {{.*#+}} xmm0 = xmm0[0],xmm2[1],xmm0[2],xmm2[3],xmm0[4],xmm2[5],xmm0[6],xmm2[7]
 ; X64-NEXT:    retq
----------------
Left: https://bit.ly/3oLtPcP
Right: https://bit.ly/3Ay5hGE


================
Comment at: llvm/test/CodeGen/X86/avx2-shift.ll:601
+; X64-NEXT:    vpsrlvd %xmm1, %xmm0, %xmm0
+; X64-NEXT:    vpblendw {{.*#+}} xmm0 = xmm2[0],xmm0[1],xmm2[2],xmm0[3],xmm2[4],xmm0[5],xmm2[6],xmm0[7]
 ; X64-NEXT:    retq
----------------
Left: https://bit.ly/41Ewx2j
Right: https://bit.ly/3HbUmGE


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146357/new/

https://reviews.llvm.org/D146357



More information about the llvm-commits mailing list