[PATCH] D147678: [LegalizeTypes][AArch64] Use scalar_to_vector to eliminate bitcast

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 23:06:35 PDT 2023


efriedma added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:22895
+    Results.push_back(DAG.getNode(ISD::SCALAR_TO_VECTOR, DL, VT, Op));
+    return;
+  }
----------------
SCALAR_TO_VECTOR from i32 to v2i16 implicitly discards the high 16 bits of the input.  (The other lane is UNDEF.  UNDEF might happen to be what you want in simple cases, but it won't be in general.)

Something like `(v2i16 extract_subvector (v4i16 bitcast (v2i32 scalar_to_vector (i32 in))), 0)` should have the semantics you want, and lower to something reasonably efficient.


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

https://reviews.llvm.org/D147678



More information about the llvm-commits mailing list