[PATCH] D96206: [X86] Fold bitcast(logic(bitcast(X), Y)) --> logic'(X, bitcast(Y)) for int-int bitcasts

Pengfei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 21 05:24:24 PST 2021


pengfei accepted this revision.
pengfei added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: llvm/test/CodeGen/X86/vec_saddo.ll:816
 ; SSE-NEXT:    pcmpgtd %xmm2, %xmm4
-; SSE-NEXT:    pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
 ; SSE-NEXT:    pcmpeqd %xmm3, %xmm2
----------------
RKSimon wrote:
> pengfei wrote:
> > I haven't figured the math here out yet, but the removal of this doesn't look correct to me.
> > The previous math is `xmm4[0] & xmm2[1] | xmm4[1]`, but we are changing it to `xmm4[1] & xmm2[1] | xmm4[1]`.
> I think this is SimplifyDemandedElts (called from one of the shuffles below) being able to remove the shuffle now that it can see everything as <4 x i32> - but I haven't confirmed that yet.
Verified it locally by random number https://godbolt.org/z/61eTfr, the change here should be correct.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96206



More information about the llvm-commits mailing list