[PATCH] D144789: [DAG] Match select(icmp(x,y),sub(x,y),sub(y,x)) -> abd(x,y) patterns

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 26 10:24:35 PST 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/test/CodeGen/X86/abds-vector-128.ll:1114
+; SSE42-NEXT:    blendvpd %xmm0, %xmm3, %xmm4
+; SSE42-NEXT:    pcmpgtq %xmm2, %xmm1
 ; SSE42-NEXT:    pcmpeqd %xmm0, %xmm0
----------------
so seems multiuse cmp is slight regression. Think it could be fixed if 


================
Comment at: llvm/test/CodeGen/X86/abds-vector-128.ll:1116
 ; SSE42-NEXT:    pcmpeqd %xmm0, %xmm0
 ; SSE42-NEXT:    pxor %xmm1, %xmm0
+; SSE42-NEXT:    paddq %xmm4, %xmm0
----------------
the:
```
pcmpgtq %xmm2, %xmm1
pcmpeqd %xmm0, %xmm0
pxor %xmm1, %xmm0
```

is just a duplicate of `pcmpgtq %xmm1, %xmm0`?

Likewise for the avx/avx2 tests.

Know whats going on there?

But guess at the end of the day, this can be fixed in `LowerABD` by looking for existing dag nodes and will be probably be easier to do after this patch.

Maybe add a TODO in x86 `LowerABD` to fixup missed optimizations. (Likewise we always `blendv` on `cmp` result, but should be doable on the `sub`, and for avx512 should be `vpternlogd` instead of `blendv`)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144789



More information about the llvm-commits mailing list