[PATCH] D76947: [SelectionDAGBuilder][CGP][X86] Move some of SDB's gather/scatter uniform base handling to CGP.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 14:55:22 PDT 2020


efriedma added a comment.

The general approach here makes sense.



================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:5242
+      C = C->getSplatValue();
+    auto *CI = dyn_cast_or_null<ConstantInt>(C);
+    if (!CI || !CI->isZero())
----------------
Does it matter whether the value is specifically zero, as opposed to an arbitrary splat value?


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:5257
+  // We need different handling for structs and sequential types.
+  if (GTI.isStruct()) {
+    // Scalarize the struct index if needed.
----------------
I think it would make sense to unify the handling where the last index is a scalar/splat, rather that splitting it based on whether `GTI.isStruct()` is true.


================
Comment at: llvm/lib/IR/Verifier.cpp:2886
            "Call parameter type does not match function signature!",
-           Call.getArgOperand(i), FTy->getParamType(i), Call);
+           Call.getArgOperand(i)->getType(), FTy->getParamType(i), Call);
 
----------------
Not sure this is an improvement.


================
Comment at: llvm/test/CodeGen/X86/masked_gather_scatter.ll:664
 ; SKX-NEXT:    kxnorw %k0, %k0, %k1
-; SKX-NEXT:    vgatherdps (%rdi,%zmm1,4), %zmm0 {%k1}
+; SKX-NEXT:    vgatherdps (%rax,%zmm1,4), %zmm0 {%k1}
 ; SKX-NEXT:    retq
----------------
Orthogonal, but probably you could add a special-case here: vgather with an all-zero vector is equivalent to vbroadcast, I think?


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

https://reviews.llvm.org/D76947





More information about the llvm-commits mailing list