[llvm] [LoongArch] lower SCALAR_TO_VECTOR to INSERT_VECTOR_ELT (PR #122863)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 18:10:31 PST 2025


================
@@ -255,6 +255,7 @@ LoongArchTargetLowering::LoongArchTargetLowering(const TargetMachine &TM,
       setOperationAction(ISD::SETCC, VT, Legal);
       setOperationAction(ISD::VSELECT, VT, Legal);
       setOperationAction(ISD::VECTOR_SHUFFLE, VT, Custom);
+      setOperationAction(ISD::SCALAR_TO_VECTOR, VT, Custom);
----------------
tangaac wrote:

> Why not make it `Legal` and define patterns in .td files.

~~~td
def : Pat<(v16i8 (scalar_to_vector GRLenVT:$rj)), 
          (VINSGR2VR_B ?, GRLenVT:$rj, 0)>;
~~~

We cannot  replace `scalar_to_vector` with the `VINSGR2VR` instruction because of the unknown `?`.

https://github.com/llvm/llvm-project/pull/122863


More information about the llvm-commits mailing list