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

Lu Weining via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 06:03:24 PST 2025


================
@@ -1562,6 +1562,12 @@ def : Pat<(vector_insert v8f32:$vd, FPR32:$fj, uimm3:$imm),
 def : Pat<(vector_insert v4f64:$vd, FPR64:$fj, uimm2:$imm),
           (XVINSGR2VR_D $vd, (COPY_TO_REGCLASS FPR64:$fj, GPR), uimm2:$imm)>;
 
+// scalar_to_vector
+def : Pat<(v8f32 (scalar_to_vector FPR32:$fj)),
+          (SUBREG_TO_REG (i64 0), FPR32:$fj, sub_32)>;
+def : Pat<(v4f64 (scalar_to_vector FPR64:$fj)),
+          (SUBREG_TO_REG (i64 0), FPR64:$fj, sub_64)>;  
----------------
SixWeining wrote:

```suggestion
          (SUBREG_TO_REG (i64 0), FPR64:$fj, sub_64)>; 
```

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


More information about the llvm-commits mailing list