[PATCH] D118644: [x86] invert a vector select IR canonicalization with a binop identity constant
Phoebe Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 1 02:23:26 PST 2022
pengfei added inline comments.
================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:48984-48987
+ case ISD::FADD: // X + -0.0 --> X
+ return C->isZero() && C->isNegative();
+ case ISD::FSUB: // X - 0.0 --> X
+ return C->isZero() && !C->isNegative();
----------------
Do we need to consider the nsz case?
================
Comment at: llvm/test/CodeGen/X86/vector-bo-select.ll:375-376
; AVX2-NEXT: vinserti128 $1, %xmm2, %ymm3, %ymm2
-; AVX2-NEXT: vpand %ymm1, %ymm2, %ymm1
-; AVX2-NEXT: vsubps %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vsubps %ymm1, %ymm0, %ymm1
+; AVX2-NEXT: vblendvps %ymm2, %ymm1, %ymm0, %ymm0
; AVX2-NEXT: retq
----------------
Is the left code better?
================
Comment at: llvm/test/CodeGen/X86/vector-bo-select.ll:383-384
; AVX512F-NEXT: kmovw %edi, %k1
-; AVX512F-NEXT: vmovaps %zmm1, %zmm1 {%k1} {z}
-; AVX512F-NEXT: vsubps %ymm1, %ymm0, %ymm0
+; AVX512F-NEXT: vsubps %ymm1, %ymm0, %ymm1
+; AVX512F-NEXT: vblendmps %zmm1, %zmm0, %zmm0 {%k1}
+; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
----------------
The left seems better.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118644/new/
https://reviews.llvm.org/D118644
More information about the llvm-commits
mailing list