[PATCH] D51553: [DAGCombiner][x86] add transform/hook to load a scalar directly for use in a vector binop

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 12 15:31:31 PDT 2018


spatel marked 2 inline comments as done.
spatel added inline comments.


================
Comment at: test/CodeGen/X86/load-scalar-as-vector.ll:23
+; AVX2-NEXT:    vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; AVX2-NEXT:    vpbroadcastd {{.*#+}} xmm1 = [42,42,42,42]
+; AVX2-NEXT:    vpaddd %xmm1, %xmm0, %xmm0
----------------
spatel wrote:
> lebedev.ri wrote:
> > Why is there a `vpbroadcastd` here, as compared to `AVX1` version?
> For AVX2 targets, we assume that a load+broadcast costs no more than a full vector load, but it saves data space, so that's the default. I suspect that we need to revisit that per-CPU and see if that's actually true.
Oops - in this case, we loaded a scalar though, so there must be something going wrong with our undef knowledge.


https://reviews.llvm.org/D51553





More information about the llvm-commits mailing list